|
@@ -32,7 +32,7 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
|
|
|
|
|
|
|
|
LifeUserOrderVo queryUserOrderDetail(@Param("orderId") String orderId,@Param("position") String position);
|
|
LifeUserOrderVo queryUserOrderDetail(@Param("orderId") String orderId,@Param("position") String position);
|
|
|
|
|
|
|
|
- @Select("with total_coupon as(\n" +
|
|
|
|
|
|
|
+/* @Select("with total_coupon as(\n" +
|
|
|
"-- 团购\n" +
|
|
"-- 团购\n" +
|
|
|
"\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
|
|
"\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
|
|
|
"from life_group_buy_main lgbm \n" +
|
|
"from life_group_buy_main lgbm \n" +
|
|
@@ -57,12 +57,75 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
|
|
|
"from life_user_order luo\n" +
|
|
"from life_user_order luo\n" +
|
|
|
"left join store_info si on si.id = luo.store_id -- 查询店铺相关 \n" +
|
|
"left join store_info si on si.id = luo.store_id -- 查询店铺相关 \n" +
|
|
|
"left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
|
|
"left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
|
|
|
- "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
|
|
|
|
|
|
|
+ "left join order_coupon_middle ocm on ocm.order_id = luo.id and ocm.delete_flag = 0\n" +
|
|
|
"left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
|
|
"left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
|
|
|
"left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
|
|
"left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
|
|
|
"left join store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
|
|
"left join store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
|
|
|
"left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
|
|
"left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
|
|
|
"left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
|
|
"left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
|
|
|
|
|
+ "${ew.customSqlSegment}")*/
|
|
|
|
|
+ @Select("with total_coupon as(\n" +
|
|
|
|
|
+ "-- 团购\n" +
|
|
|
|
|
+ "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
|
|
|
|
|
+ "\tfrom life_group_buy_main lgbm \n" +
|
|
|
|
|
+ "\tunion all\n" +
|
|
|
|
|
+ "-- 代金券\n" +
|
|
|
|
|
+ "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,0 effective_date_type,expiration_date effective_date_value \n" +
|
|
|
|
|
+ "\tfrom life_coupon lc \n" +
|
|
|
|
|
+ ")\n" +
|
|
|
|
|
+ "select \n" +
|
|
|
|
|
+ " luo.id,\n" +
|
|
|
|
|
+ " luo.buy_time,\n" +
|
|
|
|
|
+ " luo.status,\n" +
|
|
|
|
|
+ " luo.price,\n" +
|
|
|
|
|
+ " luo.final_price,\n" +
|
|
|
|
|
+ " luo.user_id,\n" +
|
|
|
|
|
+ " luo.store_id,\n" +
|
|
|
|
|
+ " luo.order_no,\n" +
|
|
|
|
|
+ " luo.pay_time,\n" +
|
|
|
|
|
+ " luo.cancel_time,\n" +
|
|
|
|
|
+ " luo.finish_time,\n" +
|
|
|
|
|
+ " luo.order_str,\n" +
|
|
|
|
|
+ " luo.expert_order_id,\n" +
|
|
|
|
|
+ " luo.order_appraise,\n" +
|
|
|
|
|
+ " -- 店铺表列:用ANY_VALUE包裹(一个订单对应一个店铺,值唯一)\n" +
|
|
|
|
|
+ " ANY_VALUE(si.store_name) as store_name,\n" +
|
|
|
|
|
+ " ANY_VALUE(si.commission_rate) as commission_rate,\n" +
|
|
|
|
|
+ " ANY_VALUE(si.business_section) as store_type,\n" +
|
|
|
|
|
+ " ANY_VALUE(si.store_status) as store_status,\n" +
|
|
|
|
|
+ " ANY_VALUE(si.business_status) as business_status,\n" +
|
|
|
|
|
+ " -- 聚合列:优惠券数量(唯一聚合列,无需处理)\n" +
|
|
|
|
|
+ " count(ocm.coupon_code) as coupon_count,\n" +
|
|
|
|
|
+ " -- 图片表列:用ANY_VALUE包裹(一个优惠券对应一张图片,值唯一)\n" +
|
|
|
|
|
+ " ANY_VALUE(simg.img_url) as img_url,\n" +
|
|
|
|
|
+ " -- 用户表列:用ANY_VALUE包裹(一个订单对应一个用户,值唯一)\n" +
|
|
|
|
|
+ " ANY_VALUE(lu.user_phone) as user_phone,\n" +
|
|
|
|
|
+ " -- 评论状态:用ANY_VALUE包裹(一个订单最多一条评论,值唯一)\n" +
|
|
|
|
|
+ " ANY_VALUE(IF(sc.id is null,false,true)) as hasComment,\n" +
|
|
|
|
|
+ " -- 优惠券CTE列:拆解tc.*为具体列,用ANY_VALUE包裹\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.coupon_id) as coupon_id,\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.coupon_type) as coupon_type,\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.coupon_name) as coupon_name,\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.image_id) as tc_image_id,\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.effective_date_type) as effective_date_type,\n" +
|
|
|
|
|
+ " ANY_VALUE(tc.effective_date_value) as effective_date_value,\n" +
|
|
|
|
|
+ " -- 异常状态标识:用ANY_VALUE包裹\n" +
|
|
|
|
|
+ " ANY_VALUE(CASE\n" +
|
|
|
|
|
+ " WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
|
|
|
|
|
+ " ELSE 0\n" +
|
|
|
|
|
+ " END) AS abnormalStateFlag,\n" +
|
|
|
|
|
+ " -- 折扣券列:用ANY_VALUE包裹(一个订单对应一个折扣券,值唯一)\n" +
|
|
|
|
|
+ " ANY_VALUE(ldc.nominal_value) as nominal_value,\n" +
|
|
|
|
|
+ " ANY_VALUE(ldc.type) as type\n" +
|
|
|
|
|
+ "from life_user_order luo\n" +
|
|
|
|
|
+ "left join store_info si on si.id = luo.store_id -- 查询店铺相关 \n" +
|
|
|
|
|
+ "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
|
|
|
|
|
+ "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
|
|
|
|
|
+ "left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
|
|
|
|
|
+ "left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
|
|
|
|
|
+ "left join store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
|
|
|
|
|
+ "left join life_discount_coupon_user ldcu on ldcu.id = luo.quan_id \n" +
|
|
|
|
|
+ "left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
|
|
|
"${ew.customSqlSegment}")
|
|
"${ew.customSqlSegment}")
|
|
|
IPage<LifeUserOrderVo> queryUserOrderList(IPage<LifeUserOrderVo> brandedPage,@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrderVo> lifeUserOrderQueryWrapper);
|
|
IPage<LifeUserOrderVo> queryUserOrderList(IPage<LifeUserOrderVo> brandedPage,@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrderVo> lifeUserOrderQueryWrapper);
|
|
|
|
|
|