Browse Source

Merge branch 'dev' into 'mp-server-test'

优化

See merge request quanshu/mp-server!947
jiang hao 2 years ago
parent
commit
9ffef185f3

+ 13 - 4
mp-service/src/main/resources/mapper/admin/TicketBoxGoodsMapper.xml

@@ -24,26 +24,35 @@
             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,
+            when 'coupon_pkg' then if(t4.title is not null, t4.title, t1.title)
+            else 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,
+            when 'coupon_pkg' then if(t4.pic_url is not null, t4.pic_url, t1.pic_url)
+            else 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,
+            when 'coupon_pkg' then if(t4.face_price is not null, t4.face_price, t1.value)
+            else t1.value
+
+        end as value,
 
             case t1.type
             when 'goods' then if(t2.cost is not null, t2.cost, 0)
+            else 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}
+        left join mp_coupon_pkg t4 on t1.ref_id = t4.id
+        ${ew.customSqlSegment}
     </select>
 </mapper>

+ 7 - 1
mp-service/src/main/resources/mapper/admin/TicketBoxMapper.xml

@@ -49,11 +49,15 @@
                 case t2.type
                 when 'goods' then if(t3.title is not null, t3.title, t2.title)
                 when 'coupon' then if(t4.title is not null, t4.title, t2.title)
+                when 'coupon_pkg' then if(t5.title is not null, t5.title, t2.title)
+                else t2.title
                 end as title,
 
                 case t2.type
                 when 'goods' then if(t3.pic_url is not null, t3.pic_url, t2.pic_url)
                 when 'coupon' then if(t4.pic_url is not null, t4.pic_url, t2.pic_url)
+                when 'coupon_pkg' then if(t5.pic_url is not null, t5.pic_url, t2.pic_url)
+                else t2.pic_url
                 end as pic_url,
 
                 t2.type refType,
@@ -63,6 +67,8 @@
              left join mp_ticket_box_goods t2 on t1.box_id = t2.box_id
              left join mp_goods t3 on t2.ref_id = t3.goods_id
              left join mp_coupon t4 on t2.ref_id = t4.coupon_id
-        ${ew.customSqlSegment}
+             left join mp_coupon_pkg t5 on t1.ref_id = t5.id
+
+      ${ew.customSqlSegment}
   </select>
 </mapper>