函数名 | 说明 | 说明/例子 |
---|---|---|
eq | 等于= | 例:eq( "name",“老王”)--->name='老王’ |
ne | 不等于<> | 例:ne("name",老王”)--->name<>'老王' |
gt | 大于> | 例:gt( "age”,18)--->age >18 |
ge | 大于等于>= | 例:gt( "age”,18)--->age >18 |
lt | 小于< | 例:lt( "age",18)--->age< 18 |
le | 小于<= | 例:le( "age",18)--->age<= 18 |
between | BETWEEN值IAND值2 | 例:between(“age",18, 30)--->age between 18 and 30 |
notBetween | NOT BETWEEN值1AND值2 | 例:between(“age",18, 30)--->age not between 18 and 30 |
like | LIKE'%值%' | 例:between(“age",18, 30)--->age between 18 and 30 |
notLike | NOT LIKE'%值%' | 例:notLike("name",“王”)--->name not like'%王% |
notLike | LIKE'%值’ | 例:likeleft("name"王”)--->name like'%王' |
likeRight | LIKE'值%' | 例:likeRight( name,"王“)--->name like'王%’ |
isNull | 字段 IS NULL | 例:isNull("name")--->name is null |
isNotNull | 字段 IS NOT NULL | 例:isNotNull("name”)--->name is not null |
in | 字段 IN(vO,v1,...) | 例:in(“age”,{1,2,3})--->age in(1,2,3) |
notIn | 字段 NOT IN(vO,v1,...) | 例:notIn(“age”,1,2,3)--->age not in(1,2,3) |
inSql | 字段 IN(sql语句) | inSql("id","select id from table where id< 3”) --->id in(select id from table where id< 3) |
notInSql | 字段 NOT IN(sg1语句) | notInSql("id","select id from table where id< 3”)--->age not in(select id from table where id< 3) |
groupBy | 分组:GROUP BY 字段, | 例:groupBy("id",“name")--->group by id, name |
orderByAsc | 排序:ORDER BY字段,...ASC | 例:orderByAsc("id","name")--->order by id ASC,name ASC |
orderByDesc | 排序:ORDER BY字段,...DESC | 例:orderByDesc("id","name")--->order by id DESC,name DESC |
orderBy | 排序:ORDER BY字段, | 例:orderBy(true, true,"id”,name”) --->order by id ASC,name ASC |
having | HAVING(sql语句) | having("sum(age)>{0}”,11)--->having sum(age)>11 |
or | 拼接 OR | 注意事项:主动调用or表示紧接着下一个方法不是用and连接!(不调用or则默认为使用and连接)例:eq(“id”,1).or().eq("name”,"老王”)--->id=lor name ='老王 |
and | AND 嵌套 | 例:and(i->i.eq(~name”,“李白”).ne("status”,“活着”))--->and(name='李白’and status<>'活者’) |
apply | apply | 注意事项:该方法可用于数据库函数 动态入参的params对应前面sq1Having内部的{index}部分,这样是不会有sq1注入风险的,反之会有!例:apply("date_format(dateColumn,’%Y-%m-%d’)={0}","2008-0808”)--->date format(dateColumn,’%Y-%m-%d’)=’2008-08-08’”) |
Last | 无视优化规则直接拼接到sql的最后 | 无视优化规则直接拼接到sq1的最后注意事项:只能调用一次,多次调用以最后一次为准有sq1注入的风险,请谨慎使用例:last(limit 1) |
exists | 拼接 EXISTS(sq1语句) | 例:exists("select id from table where age =1”)->exists(select id from table where age =1) |
notExists | 拼接NOT EXISTS(sq1语句) | 例:notExists("select id from table where age=1”)->not exists(select id from table where age=1) |
nested | 正常嵌套不带AND或者OR | 正常嵌套不带AND或者OR例:nested(i->i.eq("name”,“李白”).ne("status”,,“活着”)) -->(name='李白’and status<> 活着’) |
LambdaQueryWrapper中常用方法说明
于 2024-04-16 11:18:29 首次发布