QueryWrapper↓↓↓↓
构建代码
QueryWrapper<UserPharmacy> wrapper = new QueryWrapper<UserPharmacy>();
wrapper.eq("a.delType", 0)
.and(StrUtil.isNotBlank(userPharmacyQueryDTO.getName()),wrapper1 -> wrapper1.like("u.name",userPharmacyQueryDTO.getName())
.or().like("u.phone",userPharmacyQueryDTO.getName()))
实际效果
SELECT u.userId, u.expiryDate, a.lockType
FROM user_pharmacy u
WHERE a.delType = 0 AND ( u.name LIKE '%38062%' OR u.phone LIKE '%38062%' )
EntityWrapper↓↓↓↓
构建代码
EntityWrapper<SalesOrder> wrapper1 = new EntityWrapper<SalesOrder>();
wrapper1.eq("a.isEnable", "1").eq("a.isProd", "0");
wrapper1.andNew().like( "f.itemName","瓶").or()
.like( "f.itemName","堆码桶").or().like( "f.itemName","壶")
.or().like( "f.itemName","提桶");
实际效果
select * from sys_user
WHERE
(AND a.isEnable = '1' AND a.isProd = '0' )
AND ( f.itemName LIKE '%瓶%'
OR f.itemName LIKE '%堆码桶%'
OR f.itemName LIKE '%壶%'
OR f.itemName LIKE '%提桶%'
OR f.itemName LIKE '%MM%' )
————————————————
原文链接:https://blog.csdn.net/qq_33313155/article/details/115868580