mybatis-plus拼接sql

QueryWrapper<PlaLeaveApply> queryWrapper = new QueryWrapper<>();
//模糊查询
queryWrapper.like("apply_no", codeStr);
//根据自增的id排序,不能使用创建时间降序排列,因为如果同时生成很多条数据,创建时间有可能会出现
//相同时间,这样排序的话每次可能都会不能,生成的编码可能会出现重复
queryWrapper.orderByDesc("id");
//根据排列后的数据取第一条数据
queryWrapper.last("LIMIT 1");
System.err.println("查询");
PlaLeaveApply plaLeaveApplypr = plaLeaveApplyMapper.selectOne(queryWrapper);

mysql-plus自定义查询,带分页:https://blog.csdn.net/weixin_43861630/article/details/111616952

你可能感兴趣的:(mybatis-plus,spring,java,spring,boot)