he2802 3 rokov pred
rodič
commit
680b72f083

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamBeforeQueryBo.java

@@ -66,4 +66,6 @@ public class ExamBeforeQueryBo extends BaseEntity {
 	private List<Integer> status;
 	@ApiModelProperty("用户ID")
 	private Long userId;
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamBeforeServiceImpl.java

@@ -11,6 +11,9 @@ import com.zhongzheng.modules.collect.domain.CollectBank;
 import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.domain.ExamApply;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -33,6 +36,9 @@ import java.util.stream.Collectors;
 @Service
 public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBefore> implements IExamBeforeService {
 
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+
     @Override
     public ExamBeforeVo queryById(Long beforeId){
         ExamBeforeVo examBeforeVo = baseMapper.selectByBefore(beforeId);
@@ -176,6 +182,9 @@ public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBef
         if (verLong < 1){
             throw new IllegalArgumentException("您不符合考前刷题条件,请先预约考试,或者咨询相关工作人员,了解使用条件。");
         }
+        OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>()
+                .eq(OrderGoods::getOrderGoodsId,examBeforeQueryBo.getOrderGoodsId()));
+        examBeforeQueryBo.setGoodsId(orderGoods.getGoodsId());
         ExamBeforeVo examBeforeVo = baseMapper.verifyExamBeforeVo(examBeforeQueryBo);
         return examBeforeVo;
     }

+ 3 - 3
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamBeforeMapper.xml

@@ -124,14 +124,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	AND eb.`status` =1
     </select>
 
-    <select id="verifyInfo" parameterType="long" resultType="Long">
+    <select id="verifyInfo" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultType="Long">
         SELECT
             COUNT(1)
         FROM
             user_subscribe us
         WHERE
             1 =1
-          AND us.goods_id = #{goodsId}
+          AND us.order_goods_id = #{orderGoodsId}
           AND us.exam_status = 0
           AND us.subscribe_status = 1
           AND us.user_id = #{userId}
@@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
-    <select id="verifyExamBeforeVo" parameterType="long" resultMap="ExamBeforeVo">
+    <select id="verifyExamBeforeVo" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultMap="ExamBeforeVo">
         SELECT
             eb.*,
             ebu.url_name,