SpringBoot学习备忘

  • 在 mapper.xml 中的 like 的写法
    db1.name like "%"#{name}"%"
    参考mybatis mapper.xml中like的写法

  • 使用PageInfo查询数据库缓慢问题
    可以在Mapper自定义一个count方法覆盖pagehelper 以 分页查询Mapper方法名 + _COUNT pagehelper会走你自定义的count sql语句
    DAO层:

Long getAllUser_COUNT()

Mapper.xml

<select id="getAllUser_COUNT" resultType="Long">
 
  select max(id) from users
</select>;

参考https://blog.csdn.net/qq_40561126/article/details/115007700 的评论部分

posted @ 2022-02-07 11:26  BrianSun  阅读(74)  评论(0编辑  收藏  举报