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