Răsfoiți Sursa

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

Dev

See merge request quanshu/mp-server!915
jiang hao 2 ani în urmă
părinte
comite
f00b9c9c4f

+ 3 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/GoodsMgrController.java

@@ -126,6 +126,9 @@ public class GoodsMgrController extends BaseApiController {
         queryWrapper.lambda()
                 .le(null != queryParam.getMaxExchange(), Goods::getExchangePrice, queryParam.getMaxExchange());
 
+        queryWrapper.lambda()
+                .eq(null != queryParam.getType(), Goods::getType, queryParam.getType());
+
         // 状态
         queryWrapper.lambda()
                 .eq(null != queryParam.getStatus(), Goods::getStatus, queryParam.getStatus());

+ 3 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/param/GoodsQueryParam.java

@@ -43,6 +43,9 @@ public class GoodsQueryParam {
     private Long supplierId;
 
 
+    @ApiModelProperty("商品类型:1实物商品,2卡密商品")
+    private Integer type;
+
     /**
      * 最低成本
      */

+ 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>