Parcourir la source

订单查询增加优惠券类型

wanxl il y a 1 an
Parent
commit
414506a750

+ 2 - 0
src/main/java/com/sqx/modules/order/dto/OrderQueryDto.java

@@ -41,4 +41,6 @@ public class OrderQueryDto extends PageQuery {
     private Integer riderStationId;
     @ApiModelProperty("商铺类型id")
     private String shopTypeId;
+    @ApiModelProperty("优惠券类型 0 平台 1商家 不选查所有")
+    private String couponType;
 }

+ 3 - 0
src/main/java/com/sqx/modules/order/entity/TbOrder.java

@@ -289,5 +289,8 @@ public class TbOrder implements Serializable {
     @ApiModelProperty("超时时间")
     private Long timeOut;
 
+    @ApiModelProperty("优惠券类型 平台/商家优惠券")
+    private String couponTypeRemark;
+
     public TbOrder() {}
 }

+ 9 - 1
src/main/resources/mapper/order/OrderMapper.xml

@@ -88,7 +88,8 @@
         ti.rider_user_id as riderUserId, tcu.money as couponMoney,
         apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,
         (select rs.station_name from rider_station rs where  rs.id =tiu.rider_station_id ) as stationName,
-        (select st.shop_type_name from shop_type st where  st.id =gs.shop_type_id ) as shopTypeName
+        (select st.shop_type_name from shop_type st where  st.id =gs.shop_type_id ) as shopTypeName,
+        (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) couponTypeRemark,
         from tb_order tor
         left join tb_user tu on tor.user_id = tu.user_id
         left join goods_shop gs on tor.shop_id = gs.shop_id
@@ -97,6 +98,7 @@
         left join tb_coupon_user tcu on tor.coupon_id = tcu.id
         left join activity_part_record apr on apr.order_id = tor.order_id
         left join activity ai on ai.id = apr.activity_id
+        left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
         where 1 = 1
         <if test="query.riderPhone!=null and query.riderPhone!=''">
             and tiu.phone =#{query.riderPhone}
@@ -149,6 +151,12 @@
         <if test="query.shopTypeId!=null and query.shopTypeId!=''">
             and gs.shop_type_id=#{query.shopTypeId}
         </if>
+        <if test="query.couponType=='0'">
+            and tcu.shop_id =0
+        </if>
+        <if test="query.couponType=='1'">
+            and tcu.shop_id !=0
+        </if>
         order by tor.pay_time desc, tor.create_time desc
     </select>