he2802 пре 3 година
родитељ
комит
d0c95d7491

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -220,11 +220,11 @@ public class OrderGoodsVo {
 	@ApiModelProperty("已经直播次数")
 	private Integer overLiveNum = 0;
 	@ApiModelProperty("直播总秒数")
-	private Long liveTime = 0L;
+	private Long liveTime;
 	@ApiModelProperty("观看直播累计时长秒数")
-	private Long seeTime = 0L;
+	private Long seeTime;
 	@ApiModelProperty("已参加直播次数")
-	private Integer joinLiveNum = 0;
+	private Integer joinLiveNum;
 	@ApiModelProperty("直播开始时间")
 	private Long liveStartTime;
 	@ApiModelProperty("直播结束时间")

+ 19 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -153,6 +153,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         , (SELECT count(*) from order_goods og where og.goods_id = g.goods_id and  og.pay_status IN ( 2, 3, 4 )
             AND og.refund_status IN (0,3,1) ) as order_num
         </if>
+        <if test="getOrderNum != null and getOrderNum == 1" >
+            ,ou.goods_live_num
+        </if>
         FROM
         goods g
         LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
@@ -162,6 +165,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN school s ON s.id = g.school_id
         LEFT JOIN major m ON g.major_id = m.id
         LEFT JOIN order_input_template ot ON cb.template_status = ot.id
+        <if test="getOrderNum != null and getOrderNum == 1" >
+            LEFT JOIN (
+            SELECT
+            og.goods_id,
+            sum( CASE WHEN g.goods_type = 6 THEN 1 ELSE 0 END ) AS goods_live_num
+            FROM
+            `order` o
+            LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+            LEFT JOIN goods g ON og.goods_id = g.goods_id
+            WHERE o.`status` = 1
+            AND og.refund_status in (0,1,3)
+            AND og.pay_status in (2,3,4)
+            GROUP BY
+            og.goods_id
+            ) ou ON g.goods_id = ou.goods_id
+        </if>
         WHERE
         1 = 1
         AND g.goods_type != 5

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

@@ -82,6 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="officialStatus" column="official_status"/>
         <result property="classStatus" column="class_status"/>
         <result property="closeReason" column="close_reason"/>
+        <result property="joinLiveNum" column="join_live_num"/>
+        <result property="seeTime" column="see_time"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
@@ -346,7 +348,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         og.order_goods_id,
         u.realname,
         u.id_card,
-        u.user_id
+        u.user_id,
+        un.live_num as join_live_num,
+        un.study_duration as see_time
         FROM `order` o
         LEFT JOIN order_goods og ON o.order_sn = og.order_sn
         LEFT JOIN goods g ON og.goods_id = g.goods_id
@@ -354,6 +358,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
         LEFT JOIN course_business cb ON g.business_id = cb.id
         LEFT JOIN `user` u ON u.user_id = o.user_id
+        LEFT JOIN (SELECT
+        usr.order_goods_id,
+        count( DISTINCT usr.section_id ) live_num,
+        SUM( usr.study_duration ) study_duration
+        FROM
+        user_study_record usr
+        LEFT JOIN course_section cs ON usr.section_id = cs.section_id
+        WHERE
+        cs.section_type IN ( 2, 3 )
+        GROUP BY
+        usr.order_goods_id)un on un.order_goods_id = og.order_goods_id
         WHERE
         1 = 1
         AND g.goods_type = 6

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -1309,4 +1309,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND cs.`name` like concat('%', #{sectionName}, '%')
             </if>
     </select>
+
+
 </mapper>