Mybatis Plus 插件 LambdaQueryWrapper 与 LambdaUpdateWrapper 【使用指南】
函数名 | 说明 |
---|---|
eq | = |
ne | <> |
gt | > |
ge | >= |
lt | < |
le | <= |
between | between |
notBetween | not between |
like | like %key% |
notLike | not like %key% |
likeLeft | like %key |
likeRight | like key% |
isNull | is null |
isNotNull | is not null |
in | in |
notIn | not in |
inSql | in (sql语句) |
notInSql | not in (sql语句) |
groupBy | group by |
orderByAsc | order by 字段 asc |
orderByDesc | order by 字段 desc |
orderBy | order by 字段 asc/desc |
having | having(sql语句) |
or | a or b eq(“id”,1).or().eq(“name”,“Tom”) |
and | a and b(使用同or) |
apply | 拼接sql,消除sql注入风险 |
last | 无视优化规则,直接拼接到sql的最后(有sql注入的风险) last(“limit 1”) |
exists | exists(sql语句) exists(“select id from table where age = 1”) 【等于】exists (select id from table where age = 1) |
notExists | not exists(sql语句) |
nested | 正常嵌套,不带and或者or nested(i -> i.eq(“name”, “Tom”).ne(“status”, “alive”)) 【等于】(name = ‘Tom’ and status <> ‘alive’) |
allEq | ({id:1,age:null}) 等于:id = 1 and age is null |
func | func(i -> if(true) {i.eq(“id”, 1)} else {i.ne(“id”, 1)}) |
set | set(“name”, null) |
setSql | setSql(sql语句) |