Mybatis 不等号的表示方法,if……else

原符号 < <= > >= & ’ ”
替换符号 &lt; &lt;= &gt; &gt;= &amp; &apos; &quot;
实例:<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 ***&gt;=*** 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>

阅读更多
换一批

没有更多推荐了,返回首页