赞
踩
List<VisitActHandleLog> list = visitActHandleLogService.list(
new QueryWrapper<VisitActHandleLog>()
.eq("field1", "value1")
.eq("field2", "value2")
);
//sql条件部分
WHERE
( field1= ? AND field2= ? )
//代码
List<VisitActHandleLog> list = visitActHandleLogService.list(
new QueryWrapper<VisitActHandleLog>()
.eq("field1", "value1")
.or()
.eq("field2", "value2")
);
//sql条件部分
WHERE
(field1= ? OR field2= ?)
//代码
List<VisitActHandleLog> list = visitActHandleLogService.list(
new QueryWrapper<VisitActHandleLog>()
.eq("field1", "value1")
.or(qw->qw.eq("field2", "value2").eq("field3","value3"))
);
WHERE
( field1= ? OR ( ( field2= ? AND field3= ? ) ) )
这样就可以在or的后面拼接(),实现功能,and()也是如此
List<VisitActHandleLog> list = visitActHandleLogService.list(
new QueryWrapper<VisitActHandleLog>()
.eq("field1", "value1")
.and(qw->qw.eq("field2", "value2").or("field3","value3"))
);
//sql
(field1= ? and (field2= ? or field3= ?))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。