|
|
@@ -1,7 +1,6 @@
|
|
|
package shop.alien.mapper;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|
|
@@ -33,37 +32,38 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
|
|
|
|
|
|
LifeUserOrderVo queryUserOrderDetail(@Param("orderId") String orderId,@Param("position") String position);
|
|
|
|
|
|
-/* @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" +
|
|
|
- "from 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" +
|
|
|
- "from life_coupon lc \n" +
|
|
|
- ")\n" +
|
|
|
- "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,luo.expert_order_id,luo.order_appraise,\n" +
|
|
|
- "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
|
|
|
- "count(ocm.coupon_code) coupon_count,\n" +
|
|
|
- "simg.img_url,\n" +
|
|
|
- "lu.user_phone,\n" +
|
|
|
- "IF(sc.id is null,false,true) as hasComment,\n" +
|
|
|
- "tc.*,\n" +
|
|
|
- "CASE\n" +
|
|
|
- " WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
|
|
|
- " ELSE 0\n" +
|
|
|
- " END AS abnormalStateFlag,\n" +
|
|
|
- "ldc.nominal_value,ldc.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 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 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}")*/
|
|
|
+ /* @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" +
|
|
|
+ "from 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,\n" +
|
|
|
+ "case when expiration_type = 1 then 0 else 1 end effective_date_type,case when expiration_type = 1 then expiration_date else validity_period end effective_date_value \n" +
|
|
|
+ "from life_coupon lc \n" +
|
|
|
+ ")\n" +
|
|
|
+ "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,luo.expert_order_id,luo.order_appraise,\n" +
|
|
|
+ "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
|
|
|
+ "count(ocm.coupon_code) coupon_count,\n" +
|
|
|
+ "simg.img_url,\n" +
|
|
|
+ "lu.user_phone,\n" +
|
|
|
+ "IF(sc.id is null,false,true) as hasComment,\n" +
|
|
|
+ "tc.*,\n" +
|
|
|
+ "CASE\n" +
|
|
|
+ " WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
|
|
|
+ " ELSE 0\n" +
|
|
|
+ " END AS abnormalStateFlag,\n" +
|
|
|
+ "ldc.nominal_value,ldc.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 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 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}")*/
|
|
|
@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" +
|
|
|
@@ -138,4 +138,41 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
|
|
|
|
|
|
@Select("SELECT count( luo.id ) FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id WHERE luo.`status` IN ( 0, 1, 2, 7 ) AND luo.delete_flag = 0 AND luo.coupon_type = 2 AND ocm.coupon_id = #{groupId}")
|
|
|
Integer countBuyGroup(@Param("groupId") String groupId);
|
|
|
+
|
|
|
+ @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" +
|
|
|
+ "from 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,\n" +
|
|
|
+ "case when expiration_type = 1 then 0 else 1 end effective_date_type,case when expiration_type = 1 then expiration_date else validity_period end effective_date_value \n" +
|
|
|
+ "from life_coupon lc \n" +
|
|
|
+ ")\n" +
|
|
|
+ "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,luo.expert_order_id,luo.order_appraise,\n" +
|
|
|
+ "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
|
|
|
+ "count(ocm.coupon_code) coupon_count,\n" +
|
|
|
+ "simg.img_url,\n" +
|
|
|
+ "lu.user_phone,\n" +
|
|
|
+ "IF(sc.id is null,false,true) as hasComment,\n" +
|
|
|
+ "tc.*,\n" +
|
|
|
+ "CASE\n" +
|
|
|
+ " WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
|
|
|
+ " ELSE 0\n" +
|
|
|
+ " END AS abnormalStateFlag,\n" +
|
|
|
+ "ldc.nominal_value,ldc.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}")
|
|
|
+ IPage<LifeUserOrderVo> queryPlatformOrderList(IPage<LifeUserOrderVo> brandedPage,@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrderVo> lifeUserOrderQueryWrapper);
|
|
|
+
|
|
|
+ @Select("SELECT count( luo.id ) FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id WHERE luo.`status` IN ( 0, 1, 2, 7 ) AND luo.delete_flag = 0 AND luo.coupon_type = 1 AND ocm.coupon_id = #{groupId}")
|
|
|
+ Integer countCouponByCouponId(@Param("groupId") String groupId);
|
|
|
}
|