he2802 3 anni fa
parent
commit
e3cb1984c2

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyQueryBo.java

@@ -111,5 +111,6 @@ public class ExamApplyQueryBo extends BaseEntity {
 	@ApiModelProperty("考试日期")
 	private Long examTime;
 
-
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsAttachedQueryBo.java

@@ -52,4 +52,6 @@ public class GoodsAttachedQueryBo extends BaseEntity {
 	private Long userId;
 	@ApiModelProperty("过来做过的 1过滤 0不过滤")
 	private Integer isDo;
+	@ApiModelProperty("订单商品id")
+	private Long orderGoodsId;
 }

+ 9 - 1
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -77,6 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND cq.goods_id = #{goodsId}
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND cq.order_goods_id = #{orderGoodsId}
+        </if>
         GROUP BY
         e.exam_id
 
@@ -95,6 +98,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND cq.goods_id = #{goodsId}
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND cq.order_goods_id = #{orderGoodsId}
+        </if>
     </select>
 
     <select id="selectTypeNum" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="CollectQuestionVoResult">
@@ -117,7 +123,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND cq.goods_id = #{goodsId}
         </if>
-
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND cq.order_goods_id = #{orderGoodsId}
+        </if>
         GROUP BY
             q.type
     </select>

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -281,6 +281,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and us.user_id =#{userId}
           and us.exam_expend = 1
           and us.goods_id = #{goodsId}
+          and us.order_goods_id = #{orderGoodsId}
     </select>
     <select id="residueSubscribeNext" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="integer">
         SELECT

+ 3 - 3
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 2 THEN
 				-1
 				WHEN ga.type = 3 THEN
-				ifnull( (select `status` from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and ga.goods_id =uer.goods_id  ORDER BY uer.record_id desc limit 1),-1)
+				ifnull( (select `status` from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id  ORDER BY uer.record_id desc limit 1),-1)
 				END record_status
 				,
 				CASE
@@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 2 THEN
 				-1
 				WHEN ga.type = 3 THEN
-				ifnull( (select record_id from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and ga.goods_id =uer.goods_id ORDER BY uer.record_id desc limit 1),-1)
+				ifnull( (select record_id from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id ORDER BY uer.record_id desc limit 1),-1)
 				END record_id
 				,
 				CASE
@@ -119,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 2 THEN
 				-1
 				WHEN ga.type = 3 THEN
-				(select count(*) from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and ga.goods_id =uer.goods_id )
+				(select count(*) from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id )
 				END do_num
 			</if>
 		FROM

+ 5 - 5
zhongzheng-system/src/main/resources/mapper/modules/order/OrderInputMapper.xml

@@ -47,18 +47,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderInputQueryBo" resultMap="OrderInputVoResult">
         SELECT  u.input_order_sn,
-        any_value (u.user_num ) user_num,
+        count( DISTINCT u.user_id ) user_num,
         count( DISTINCT og.goods_id ) goods_num,
         any_value ( cet.education_name ) education_name,
         any_value ( cpt.project_name ) project_name,
         any_value ( cb.business_name ) business_name,
         sum( og.goods_received ) goods_received,
-        any_value (u.order_price ) order_price,
-        any_value (u.pay_price) pay_price,
+        sum(u.order_price ) order_price,
+        sum(u.pay_price) pay_price,
         any_value ( u.create_username ) create_username,
         any_value ( u.create_time ) create_time FROM (SELECT
         oi.*,
-        count( DISTINCT o.user_id ) user_num,
+        o.user_id,
         sum( o.order_price ) order_price,
         sum( o.pay_price ) pay_price,
         o.order_sn
@@ -81,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="endTime != null and endTime != ''">
             AND #{endTime} >= oi.create_time
         </if>
-        GROUP BY oi.id,o.order_sn)u LEFT JOIN order_goods og ON u.order_sn = og.order_sn
+        GROUP BY oi.id,o.order_sn,o.user_id)u LEFT JOIN order_goods og ON u.order_sn = og.order_sn
         LEFT JOIN course_education_type cet ON u.education_type_id = cet.id
         LEFT JOIN course_project_type cpt ON u.project_id = cpt.id
         LEFT JOIN course_business cb ON u.business_id = cb.id