mybatis用法记录

2016-08-18 12:14

1:条件语句 
<if test="couponType != null and couponType !='' and couponType == '1'.toString()">

AND coupon.coupon_amount>0 AND coupon.coupon_amount_return = 1
</if>
 
2: 循环语句
<foreach item="item" index="index" collection="uuids" open="(" separator="," close=")">
#{item}
</foreach>

3:大于与小于不能直接使用
<![CDATA[
SELECT isnull(sum(main.fee),0) as fee FROM [counter].[dbo].[T_COUNTER_TRANS_COUPON] coupon
left join [counter].[dbo].[T_COUNTER_TRANS_MAIN] main on coupon.trade_id=main.trade_id
where main.state_now IN ('0000','2100') AND coupon.coupon_id in
]]>