1.代码
<select id="getList" resultType="com.xxx.xxx.giftcard.response.UserGiftCardListResponse">
select
ugc.id,
ugc.order_id,
ugc.user_id,
ugc.status,
ugc.is_give,
ugc.give_send_time,
ugc.end_receive_time,
ugc.receive_id,
ugc.card_number,
ugc.type,
ugc.convert_time,
ugc.gift_card_id
from
user_gift_card ugc
where
1=1
<if test="isConvert != null">
<choose>
<when test="isConvert == 0">
and ugc.status != 2
</when>
<otherwise>
and ugc.status = 2
</otherwise>
</choose>
</if>
<if test="isBuy != null">
<choose>
<when test="isBuy == 0">
and ugc.user_id = 0
</when>
<otherwise>
and ugc.user_id > 0
</otherwise>
</choose>
</if>
</select>