he2802 преди 3 години
родител
ревизия
7567dcefbf

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeStudentVo.java

@@ -140,4 +140,8 @@ public class ClassGradeStudentVo {
 	private List<UserUpdateVo> userUpdates;
 	@ApiModelProperty("剩余学习次数")
 	private Long studyCount;
+	@ApiModelProperty("0 非复购 1复购 针对业务层次配了【下单前需要  选择班级")
+	private Integer rebuy;
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

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

@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				LEFT JOIN course_subject cs2 ON qb2.subject_id = cs2.id
 		WHERE
 			ga.goods_id = #{goodsId}
-		order by ga.sort desc
+		order by ga.sort asc
     </select>
 
 	<select id="selectDoList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">

+ 12 - 6
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -147,10 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN goods_course gc ON gc.goods_id = g.goods_id
             LEFT JOIN course c ON gc.course_id = c.course_id
         </if>
-        <if test="goodsType ==2 and subjectId >0">
-            LEFT JOIN goods_attached ga on g.goods_id = ga.goods_id
-            LEFT JOIN question_business qb on ga.major_id = qb.major_id
-        </if>
+
         WHERE
         1 = 1
         <if test="status != null and status.size()!=0 ">
@@ -206,12 +203,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND c.subject_id = #{subjectId}
         </if>
         <if test="goodsType ==2 and subjectId >0">
-            AND ((
+            AND g.goods_id in(
+            SELECT
+            ga.goods_id
+            FROM
+            goods_attached ga
+            LEFT JOIN question_business qb ON ga.major_id = qb.major_id
+            WHERE
+            ((
             qb.type = 4
             AND ga.type = 1
             )
             OR ( qb.type = 3 AND ga.type = 2 )
-            OR ( qb.type = 2 AND ga.type = 3 )) AND qb.subject_id = #{subjectId}
+            OR ( qb.type = 2 AND ga.type = 3 ))
+            AND qb.subject_id = #{subjectId}
+            )
         </if>
         ORDER BY g.create_time DESC
     </select>

+ 8 - 1
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -144,6 +144,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="studyStartTime" column="study_start_time"/>
         <result property="studyEndTime" column="study_end_time"/>
         <result property="studyCount" column="study_count"/>
+        <result property="rebuy" column="rebuy"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
 
@@ -303,7 +305,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         cgu.learn_status,
         (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
         (SELECT COUNT(DISTINCT ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id = ubr.goods_id where ubr.`status`=1 and ubr.user_id = u.user_id and ubr.grade_id = cgu.grade_id and ubr.report_status=1) as record_num,
-        (g.study_count-1) as study_count
+        (g.study_count-1) as study_count,
+        og.order_goods_id,
+        og.rebuy
         FROM
         class_grade_user cgu
         LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
@@ -328,6 +332,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="studyCountMore != null and studyCountMore == 1 ">
             AND g.study_count > 1
         </if>
+        <if test="studyCountMore != null and studyCountMore == 0 ">
+            AND g.study_count = 1
+        </if>
         order by cgu.create_time desc
     </select>