原符号 < <= > >= & ’ ”
替换符号 <
<=
>
>=
&
'
"
实例:<select id="checkOrder" parameterType="java.util.Map"
resultType="ZgoodsOrderlist">
select *from z_goods_orderlist
<where>
<if test="goodsid!=null and goodsid!=''">
and goodsid =#{goodsid}
</if>
<if
test="begainTime!=null and begainTime!=''and endTime!=null and endTime!=''">
and ctime between #{begainTime} and #{endTime}
</if>
<if test="goodsname!=null and goodsname!=''">
and upper(goodsname) like
concat(concat('%',upper(#{goodsname})),'%')
</if>
<if test="ordernumber!=null and ordernumber!=''">
and ordernumber =#{ordernumber}
</if>
<if test="nname!=null and nname!=''">
and upper(nname) like
concat(concat('%',upper(#{nname})),'%')
</if>
<if test="currTime!=null and currTime!=''">
and ctime ***>=*** DATE_SUB( CURRENT_DATE() , INTERVAL 3 MONTH );
</if>
<if test="type!=null and type!=''">
<choose>
<when test="type==4">
and type=4 or type =5
</when>
<otherwise>
and type=#{type}
</otherwise>
</choose>
</if>
</where>
order by ctime desc
</select>
Mybatis 不等号的表示方法,if……else
最新推荐文章于 2024-08-06 18:38:54 发布