• 02-myBatisPlus的wrapper接口的使用


    02-myBatisPlus的wrapper接口的使用。

    1.直接先上硬菜

    序号函数名说明说明/例子
    1 eq 等于= eq("name","二狗子") ==> where name = '二狗子'
    2 ne 不等于 <> ne("name","二狗子") ==> where name <> '二狗子'
    3 gt 大于 > gt("age",18) ==> where age >18
    4 ge 大于等于 >= ge(""age",18) ==> where age >=18
    5 lt 小于 < lt("age",18") ==> where age <18
    6 le 小于等于 <= le("age",18) ==> where age <=18
    7 between between 值1 and值2 between("age",18,30) ==> where age between 18 and 30
    8 notBetween not between 值1 and值2 not between("age",18,30) ==> where age not between 18 and 30
    9 like like '%值%' like("name","二") ==> where name like '%二%'
    10 notLike not like '%值%' notLike("name","二") ==> where name not like '%二%'
    11 likeLeft like '%值' likeLeft("name","二") ==> where name like '%二'
    12 likeRight like '值%' likeRight("name","二") ==> where name like '二%'
    13 isNull 字段 is null isNUll(”name“) ==> where name is null
    14 isNotNull 字段 is not null isNotNull("name") ==> where name is not null
    15 in 字段 in ( v0,v1,v2...) in("age",{1,2,3}) ==> where age in (1,2,3)
    16 notIn 字段 not in(v0,v1...) notIn("age",{1,2,3}) ==> where age not in(1,2,3)
    17 inSql 字段 in ( sql语句) inSql("id","select id form user where age > 3") ==> id in(select id form user where age > 3)
    18 notInSql 字段 not in ( sql语句) notInSql("id","select id form user where age > 3") ==> id not in(select id form user where age > 3)
    19 groupBy 分组:group by groupBy("id","name") ==> group by id,name
    20 orderByAsc 排序 :order by 正序 orderByAsc("id","name") ==> order by id ASC,name ASC
    21 orderByDesc 排序 :order by 倒序 orderByDesc("id","name") ==> order by id DESC,name DESC
    22 orderBy 排序:order by orderBy("id","name") ==> order by id ASC,name ASC
    23 having having(sql语句) having("sum{age} > {0}",11) ==> having sum(age) >11
    24 or 拼接 or 注意事项:主动调用or表示紧接着下一个方法不是用and连接!(不调用or则用and连接)eq("id",1).or().eq("name","二狗子") ==> id = 1 or name = '二狗子'
    25 and and嵌套 and(mapper.eq("id",1).ne("status",”活着“))==> id = 1 and status <> '活着'
    26 apply 拼接sql 注意事项:该方法可用于数据库函数。动态入参的params对应前面sqlHaving{index}部分。这样是不会有sql注入风险的,反之则会有! apply("date_format(dateColumn,'%Y-%m-%d') = {0}","2020-10-24") ==> date_format(dateColumn,'%Y-%m-%d') = '2020-10-24';
    27 last 无视优化规则直接拼接到sql的最后 注意事项:只能调用一次,多次调用以最后一次为准。有sql注入风险,需要谨慎使用。last("limit 1");
    28 exists 拼接 exists(sql语句) exists("select id from user where age = 1") ==> exists(select id from user where age = 1);
    29 notExists 拼接 not exists(sql语句) notExists("select id from user where age = 1") ==>not exists(select id from user where age = 1);
    30 nested 正常嵌套,不带and或or nested(mapper.eq("id",1).ne("status",”活着“)) ==> (id = 1 and status <> '活着')

    2.wrapper家族的关系


     

    <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">





    只要你不停下来,慢一点也没关系。
  • 相关阅读:
    DHTML【11】--DOM
    sql 查询强制使用HASH连接性能测试比较
    Winform开发框架之读卡器和条码扫描枪的数据接收处理
    DevExpress的XtraReport和微软RDLC报表的使用和对比
    sql server日期时间转字符串
    C#在线更新程序[下载程序、解压缩程序、控制台程序]
    C# 定时器事件(设置时间间隔,间歇性执行某一函数,控制台程序)
    用C#用C#实现窗体在规定时间弹出,例如:10:00.弹出后关闭。并在5分钟后再次弹出。5次后停止。最好有具体代码实现窗体在规定时间弹出,例如:10:00.弹出后关闭。并在5分钟后再次弹出。5次后停止。最好有具体代码
    C#多线程学习之(五)使用定时器进行多线程的自动管理
    C# 文件与目录的基本操作(System.IO)
  • 原文地址:https://www.cnblogs.com/zyl-0110/p/13934534.html
Copyright © 2020-2023  润新知