CHOOSE-WHEN标签:
<choose>
<when test="expiredFlag==0">
AND
b.EX_STATUS not in('EXPIRED','PREEXPIRED')
</when>
<otherwise>
AND
b.EX_STATUS in('EXPIRED','PREEXPIRED')
</otherwise>
</choose>
这里面test如果要做判断多个条件,最外层用单引号
<when test='item.estCount !=null and item.estCount =="4"'> and A.est4_date = #{item.estOneDate}, </when>
if标签:
<if test="sizing != null and sizing != ''"> AND a.EXP_CON_TYPE = #{sizing} </if>
where标签:
<where>
<if test="mainMatCode != null and mainMatCode != ''">
and MAIN_MAT_CODE = #{mainMatCode}
</if>
<if test="accessoryMatCode != null and accessoryMatCode != ''">
and ACCESSORY_MAT_CODE = #{accessoryMatCode}
</if>
</where>
set标签:
<set> <if test="ordNo != null and ordNo != ''"> ORD_NO = #{ordNo}, </if> <if test="itemNo != null and itemNo != ''"> ITEM_NO = #{itemNo}, </if> </set>
trim标签:
<trim prefix="WHERE" prefixoverride="AND |OR">
<if test="name != null and name.length()>0"> AND name=#{name}</if>
<if test="gender != null and gender.length()>0"> AND gender=#{gender}</if>
</trim>
update user
<trim prefix="set" suffixoverride="," suffix=" where id = #{id} ">
<if test="name != null and name.length()>0"> name=#{name} , </if>
<if test="gender != null and gender.length()>0"> gender=#{gender} , </if>
</trim>
bind标签:
<if test="name != null and name !=''"> <bind name="nameLike" value="'%'+name+'%'"/> and name like #{nameLike} </if>