码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis在where中比较复杂的判断

时间:2018-07-11 20:04:45      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:参数   eth   test   HERE   when   font   AMM   invoice   voice   

        <if test="param.applicationStateInNumber != null and param.applicationStateInNumber != ‘‘">
            and  #{param.applicationStateInNumber,jdbcType=INTEGER} like (case when (fa.whether_invoice is null  and fa.whether_pay is null ) then "1"
            when  (fa. whether_invoice=1 and fa.whether_pay is null ) then  "2、3"
            when (fa.whether_invoice = 1 and fa.whether_pay  = 1) then "4" end)
        </if>

这个是需要判断传入的参数不为空,且传入的参数在一个case when 中,起初把

#{param.applicationStateInNumber,jdbcType=INTEGER}

写成了

param.applicationStateInNumber

报错:badsqlGrammer,未知的参数param.applicationStateInNumber

#{param.applicationStateInNumber,jdbcType=INTEGER}

mybatis在where中比较复杂的判断

标签:参数   eth   test   HERE   when   font   AMM   invoice   voice   

原文地址:https://www.cnblogs.com/huanghuanghui/p/9295808.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!