QueryWrapper 常用方法

霄
2022-05-24 / 0 评论 / 66 阅读 / 正在检测是否收录...

AbstractWrapper 下的方法及使用

方法名 说明 使用
allEq(Map<R, V> params) 全部 =(或个别 isNull) allEq(params,true)
eq = eq("real_name”,"王昭君”)
ne <> ne("nick_name”,"空想 4”)
gt > gt("age”,21)
ge >= ge("age”,22)
lt < lt("age”,22)
le <= le("age”,21")
between cloum between ? and ? between("age”,0,21)
notBetween cloum between ? and ? notBetween("age”,0,21)
like cloum like '% 王 %’ like("real_name”,"王”)
notLike not like '% 王 %’ notLike("real_name”,"王”)
likeLeft like '% 王’ likeLeft("real_name”,"昭”)
likeRight like '王 %’ likeRight("real_name”,"昭”)
isNull is null isNull("gender”)
isNotNull is not null isNotNull("gender”)
in in (1,2,3) in("nick_name”,lists)
notIn age not in (1,2,3) notIn("nick_name”,lists)
inSql age in (1,2,3,4,5,6) inSql("nick_name”,"'空想 4’,'空想 5’,'空想 6’")
notInSql age not in (1,2,3,4,5,6) notInSql("nick_name”,"'空想 4’,'空想 5’,'空想 6’")
groupBy group by id,name groupBy("nick_name”,"age”)
orderByAsc order by id ASC,name ASC orderByAsc("nick_name”,"age”)
orderByDesc order by id DESC,name DESC orderByDesc("age”)
orderBy order by id ASC,name ASC orderBy(true,true,"age”)
having having sum(age) > 10 having("sum(age) > 10”)
or id = 1 or name = '老王’ eq("nick_name”,"空想 4”).or(i->i.eq("age”,21) eq("nick_name”,"空想 4”).or().eq("nick_name”,"空想 5”)
and and (name = '李白’ and status <> '活着’) and(i->i.eq("age”,21))
nested (name = '李白’ and status <> '活着’) nested(i->i.eq("age”,21).eq("nick_name”,"空想 4”))
apply id = 1 apply("nick_name = '空想 4’”)
last 最后添加多个以最后的为准,有 sql 注入风险 last("limit 1”)
exists 拼接 EXISTS (sql 语句) exists("select id from table where age = 1”)
notExists 拼接 NOT EXISTS (sql 语句) notExists("select id from table where age = 1”)
扫描二维码,在手机上阅读!
18

评论

博主关闭了当前页面的评论