條件查詢
/*條件查詢*/
<if test="nZbyggh != null and nZbyggh != ''">
and o.nZbyggh = #{nZbyggh}
</if>
<if test="cSxbt != '' and cSxbt != null">
<bind name="cSxbtLike" value="'%'+cSxbt+'%'"/>
AND o.c_sxbt LIKE #{cSxbtLike}
</if>
<if test="dBlsx != null">
and o.dBlsx = #{dDjrq}
</if>
比較
- > -- geat than
- >e;
- < -- less than
- <e;
<if test='id != null and id gt 28'></if>
空判斷
<if test="id != null and id !=''"></if>
條件判斷
<if test="ndclzt != '' and ndclzt == 1">
and n_clzt in('0','2')
</if>
<if test="ndclzt != '' and ndclzt == 0">
AND n_clzt ='0'
</if>
<if test="ndclzt != '' and ndclzt == 3">
AND n_clzt in('1','3')
</if>
<if test="ndclzt != '' and ndclzt == 4">
AND n_clzt ='4'
</if>
<if test="username != null and username.indexOf('ji') == 0"> </if> <!-- 是否以什麼開頭 -->
<if test="username != null and username.lastIndexOf('ji') > 0"></if> <!-- 是否以什麼結尾 -->