Integer在Mapper中的判断

integer类型 在Mapper中!= null and != -1 进入了判断条件,去掉!=null 就不会进入到判断条件;如果想要使用!= null则在 != -1 的 -1上加上’-1’单引号
举例:

  1. 这样传入dailyType=-1不能拼接上and条件
    在这里插入图片描述

  2. 这样传入dailyType=-1不能拼接上and条件,但Integer可能为null
    在这里插入图片描述

  3. 这样传入dailyType=-1拼接上and条件
    在这里插入图片描述


躬身自省,淳朴而谦逊否——文文的博客

猜你喜欢

转载自blog.csdn.net/weixin_42119415/article/details/116047088