|
@@ -20,13 +20,30 @@
|
|
|
</sql>
|
|
|
|
|
|
<select id="listByQueryWrapper" resultType="com.qs.mp.admin.domain.vo.TicketBoxGoodsVO">
|
|
|
- select if(t2.title is not null, t2.title, t1.title) as title,
|
|
|
- if(t2.pic_url is not null, t2.pic_url, t1.pic_url) as pic_url,
|
|
|
- if(t2.value is not null, t2.value, t1.value) as value,
|
|
|
- if(t2.cost is not null, t2.cost, 0) as cost,
|
|
|
- t1.*
|
|
|
+ select
|
|
|
+ case t1.type
|
|
|
+ when 'goods' then if(t2.title is not null, t2.title, t1.title)
|
|
|
+ when 'coupon' then if(t3.title is not null, t3.title, t1.title)
|
|
|
+ end as title,
|
|
|
+
|
|
|
+ case t1.type
|
|
|
+ when 'goods' then if(t2.pic_url is not null, t2.pic_url, t1.pic_url)
|
|
|
+ when 'coupon' then if(t3.pic_url is not null, t3.pic_url, t1.pic_url)
|
|
|
+ end as pic_url,
|
|
|
+
|
|
|
+ case t1.type
|
|
|
+ when 'goods' then if(t2.value is not null, t2.value, t1.value)
|
|
|
+ when 'coupon' then if(t3.discount is not null, t3.discount, t1.value)
|
|
|
+ end as value,
|
|
|
+
|
|
|
+ case t1.type
|
|
|
+ when 'goods' then if(t2.cost is not null, t2.cost, 0)
|
|
|
+ end as cost,
|
|
|
+
|
|
|
+ t1.*
|
|
|
from mp_ticket_box_goods t1
|
|
|
left join mp_goods t2 on t1.ref_id = t2.goods_id
|
|
|
+ left join mp_coupon t3 on t1.ref_id = t3.coupon_id
|
|
|
${ew.customSqlSegment}
|
|
|
</select>
|
|
|
</mapper>
|