mybatis 中if標簽判斷boolean類型的寫法


例子方法:

 

 

 在入參flag不為空的情況下直接判斷:

 

 1 <if test="flag">
 2        AND order_status IN(1, 2, 3)
 3 </if>
 4 
 5 <if test="!flag">
 6        AND order_status IN(4, 5, 6)
 7 </if>
 8 
 9 <<choose>
10      <when test="!flag">
11              AND order_status  IN (4, 5, 6)
12      </when>
13      <otherwise>
14              AND order_status  IN (1, 2, 3)
15      </otherwise>
16 </choose>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM