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>

 

posted @ 2020-08-21 18:28  第一君  阅读(18531)  评论(2编辑  收藏  举报