Browse Source

Merge branch 'dev-v5.2' into dev

he2802 3 years ago
parent
commit
3d7e67c1c1

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -1050,7 +1050,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                             .eq(ClassGrade::getGradeId, goodsVo.getGradeId()));
                     //不存在班级有效期才校验服务期是否过期
                     if(Validator.isEmpty(grade.getClassEndTime())){
-                        throw new CustomException("存在已购买【班级学习服务期未过期】的商品,不可以重复购买商品", 511);
+                        throw new CustomException("存在已购买【学习服务期未过期】的商品,不可以重复购买商品", 511);
                     }
                 }
             }

+ 10 - 7
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -484,18 +484,21 @@
         (case WHEN(SELECT COUNT(1) from profile_tp where `status`=1 and FIND_IN_SET(g.goods_id,goods_ids) ) >0 then 1 ELSE 0 end) as profile_tp_status
         <if test="userId != null and userId != ''">
         ,
-        (SELECT exam_status from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_exam_status,
-        (SELECT performance from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_performance,
-        (SELECT `result` from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_result,
-        (SELECT subscribe_id from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as subscribe_id,
-        (SELECT apply_site_start_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_start_time,
-        (SELECT apply_site_end_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_end_time,
-        (SELECT apply_site_exam_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_exam_time
+        us.exam_status  as sub_exam_status,
+        us.performance  as sub_performance,
+        us.`result` as sub_result,
+        us.subscribe_id,
+        us.apply_site_start_time as sub_apply_site_start_time,
+        us.apply_site_end_time as sub_apply_site_end_time,
+        us.apply_site_exam_time as sub_apply_site_exam_time
         </if>
         FROM
         `order` o
         LEFT JOIN order_goods og ON og.order_sn = o.order_sn
         LEFT JOIN goods g on og.goods_id = g.goods_id
+        <if test="userId != null and userId != ''">
+            LEFT JOIN (SELECT * from  user_subscribe where subscribe_id in (SELECT MAX(subscribe_id) from user_subscribe where user_id = #{userId} and  subscribe_status = 1 GROUP BY order_goods_id)) us on us.order_goods_id = og.order_goods_id
+        </if>
         where 1=1
         AND og.`status` = 1
         AND og.refund_status in (0,1,3)

+ 7 - 1
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -144,7 +144,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN course_business cb ON g.business_id = cb.id
         LEFT JOIN `order` o ON og.order_sn = o.order_sn
         WHERE
-         og.order_sn =  #{orderSn} AND og.goods_id =  #{goodsId}
+              1=1
+        <if test="orderSn != null and orderSn != ''">
+            AND og.order_sn =  #{orderSn} AND og.goods_id =  #{goodsId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND og.order_goods_id=  #{orderGoodsId}
+        </if>
 
     </select>