MySQL使用 QueryWrapper查询条件in可以直接使用数字的

   Page page = new Page<>(current, size);
        QueryWrapper qw = new QueryWrapper<>();

        if (beginDate != null && !beginDate.equals("") && endDate != null && !endDate.equals("")) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try {
                beginDate = beginDate.concat(BEGIN_TIME);
                endDate = endDate.concat(END_TIME);
                Date startTime = formatter.parse(beginDate);
                Date endTime = formatter.parse(endDate);
                qw.between("create_time", startTime, endTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        if (status != null) {
            qw.eq("status", status);
        } else {
            qw.in("status", 0,1,3,4);
        }
        if (eventCode != null) {
            qw.eq("event_code", eventCode);
        }

        qw.orderByDesc("id");
        return eventTagProcessMapper.selectPage(page, qw);

不一样的结果的,使用需要注意

MySQL使用 QueryWrapper查询条件in可以直接使用数字的_第1张图片

你可能感兴趣的:(2020年工作,mysql,Mybatis)