Mybatis中mapper.xml参数为0时,参数不能生效_Chasedream_hs的博客-CSDN博客

<if test="status != null and status != '' or status ==0">      AND status= #{status,jdbcType=INTEGER}  </if> 

参数为0时,xml中 status !=''会将0排除了,如果只是判断不等null,0是可以传递过去的

上边的是严谨写法

也可以写成这样:

<if test="status != null">      AND status= #{status,jdbcType=INTEGER}  </if> 

原网址: 访问
创建于: 2021-09-16 10:38:39
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论