<if test="valiStatus==null || valiStatus=='' || valiStatus==4 ">
                b.work_permit_card_cert is not null and b.work_permit_card_cert!=1 and b.delete_flag =0
            </if>
            <if test="valiStatus==0">
                u.user_type = 0 and b.work_permit_card_cert = 0 and b.delete_flag =0 
            </if>
            <if test="valiStatus==2">
                u.user_type=1 and b.work_permit_card_cert=2 and b.delete_flag =0 
            </if>

其中viliStauts 是一个 Integer 型的参数 , 如果 传入 4 和2  是可以正确的执行 if 条件的 。。

但是如果传入0 的话 , 就会出现 前两个 if 条件都判断正确的情况,导致sql 错误。

解决办法是不要写valiStatus=='' 的判断,(以后要注意类型问题,Integer 就不要判断 ==''了)

 

其他知识点:  like concat('%'+#{a} + '%');

      并且 : 使用 and

相关文章:

  • 2021-06-28
  • 2021-10-08
  • 2022-02-15
  • 2021-11-13
  • 2022-01-20
  • 2022-03-05
  • 2022-12-23
猜你喜欢
  • 2021-04-02
  • 2021-11-06
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案