mybatis在where中比较复杂的判断


        <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}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM