소스 검색

关联奖级取消优惠券快照

cup 2 년 전
부모
커밋
b9d36e4861
1개의 변경된 파일21개의 추가작업 그리고 6개의 파일을 삭제
  1. 21 6
      mp-service/src/main/resources/mapper/admin/TicketAwardsPrizeMapper.xml

+ 21 - 6
mp-service/src/main/resources/mapper/admin/TicketAwardsPrizeMapper.xml

@@ -41,13 +41,28 @@
 
     <select id="listByQueryWrapper" resultType="com.qs.mp.admin.domain.TicketAwardsPrize">
         select
-            if(t1.prize_type = 'goods' AND t2.title is not null ,t2.title,t1.title) as title,
-            if(t1.prize_type = 'goods' AND t2.pic_url is not null,t2.pic_url,t1.pic_url) as pic_url,
-            if(t1.prize_type = 'goods' AND t2.value is not null,t2.value,t1.value) as value,
-            if(t1.prize_type = 'goods' AND t2.cost is not null,t2.cost,0) as cost,
+            case t1.prize_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.prize_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.prize_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.prize_type
+                when 'goods' then if(t2.cost is not null, t2.cost, 0)
+            end as cost,
             t1.*
         from mp_ticket_awards_prize t1
-         left join mp_goods t2 on t1.ref_id = t2.goods_id
-        ${ew.customSqlSegment}
+            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>