1.getOne查询注意
wrapper.last(“LIMIT 1”);
2.自定义like查询
wrapper.apply(“pac like {0}”, pac);
3多条件并列复杂查询
3.1
wrapper.eq(“name”, name);
wrapper.and(wq -> wq.eq(“before_item_id”, “”).or().isNull(“before_item_id”));
结果: name=‘张三’ and (before_item_id=’’ or before_item_id is null )
3.2
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq(“type”, type);
wrapper.and(wr -> {
for (String item :pacs) {
wr.like(“pac”, item + “%”).or();
}
});
结果: type=‘1’ and (pac like ‘4413__’ or pac like ‘4415__’)