|
@@ -124,6 +124,11 @@
|
|
|
<result property="moduleExamNum" column="module_exam_num"/>
|
|
|
<result property="chapterExamNum" column="chapter_exam_num"/>
|
|
|
<result property="categoryName" column="category_name"/>
|
|
|
+ <result property="moduleNum" column="module_num"/>
|
|
|
+ <result property="chapterNum" column="chapter_num"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="sectionNum" column="section_num"/>
|
|
|
+ <result property="fileNum" column="file_num"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.user.vo.ExamSonStudyRecordVo" id="ExamSonStudyRecordVoResult">
|
|
@@ -792,6 +797,172 @@
|
|
|
ORDER BY s.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="querDangAnHandoutsStudy" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo"
|
|
|
+ resultMap="ExamStudyRecordVoResult">
|
|
|
+ SELECT
|
|
|
+ g.goods_id,
|
|
|
+ #{userId} as user_id,
|
|
|
+ s.create_time,
|
|
|
+ g.goods_name,
|
|
|
+ g.`year`,
|
|
|
+ g.`status`,
|
|
|
+ g.class_hours,
|
|
|
+ g.study_start_time,
|
|
|
+ g.study_end_time,
|
|
|
+ s.service_start_time,
|
|
|
+ s.service_end_time,
|
|
|
+ s.order_goods_id,
|
|
|
+ ( SELECT m.category_name FROM major m WHERE m.id =g.major_id LIMIT 1) AS category_name,
|
|
|
+ ( SELECT i.business_name FROM course_business i WHERE i.id = g.business_id LIMIT 1) AS business_name,
|
|
|
+ ( SELECT p.project_name FROM course_project_type p WHERE p.id = g.project_id LIMIT 1) AS project_name,
|
|
|
+ s.service_start_time,
|
|
|
+ s.service_end_time,
|
|
|
+ ( SELECT count(*) FROM course_file cf WHERE cf.handouts_id =g.handouts_id AND cf.type = 1 AND cf.`status` = 1 ) AS file_num,
|
|
|
+ FROM
|
|
|
+ goods g
|
|
|
+ LEFT JOIN order_goods s ON g.goods_id = s.goods_id
|
|
|
+ LEFT JOIN `order` o ON o.order_sn = s.order_sn
|
|
|
+ WHERE
|
|
|
+ where 1=1
|
|
|
+ AND s.refund_status in (0,1,3)
|
|
|
+ AND s.pay_status in (2,3,4)
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND g.goods_type = 8
|
|
|
+ <if test="userId != null and userId !=''">
|
|
|
+ AND o.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
+ AND g.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="goodsName != null and goodsName != '' ">
|
|
|
+ and g.goods_name like concat('%', #{goodsName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="goodsStatus != null and goodsStatus != '' ">
|
|
|
+ and g.`status` = #{goodsStatus}
|
|
|
+ </if>
|
|
|
+ <if test="studyStartTime != null and studyStartTime != '' ">
|
|
|
+ and (SELECT count(*) FROM user_exam_record r where r.goods_id=g.goods_id AND r.do_mode = 1 AND r.user_id = #{userId} AND r.create_time >= #{studyStartTime} )>0
|
|
|
+ </if>
|
|
|
+ <if test="studyEndTime != null and studyEndTime != '' ">
|
|
|
+ and (SELECT count(*) FROM user_exam_record r where r.goods_id=g.goods_id AND r.do_mode = 1 AND r.user_id = #{userId} AND #{studyEndTime} >= r.create_time )>0
|
|
|
+ </if>
|
|
|
+ ORDER BY s.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="querDangAnLiveStudy" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo"
|
|
|
+ resultMap="ExamStudyRecordVoResult">
|
|
|
+ SELECT
|
|
|
+ g.goods_id,
|
|
|
+ #{userId} as user_id,
|
|
|
+ s.create_time,
|
|
|
+ g.goods_name,
|
|
|
+ g.`year`,
|
|
|
+ g.`status`,
|
|
|
+ g.class_hours,
|
|
|
+ g.study_start_time,
|
|
|
+ g.study_end_time,
|
|
|
+ s.service_start_time,
|
|
|
+ s.service_end_time,
|
|
|
+ s.order_goods_id,
|
|
|
+ ( SELECT m.category_name FROM major m WHERE m.id =g.major_id LIMIT 1) AS category_name,
|
|
|
+ ( SELECT i.business_name FROM course_business i WHERE i.id = g.business_id LIMIT 1) AS business_name,
|
|
|
+ ( SELECT p.project_name FROM course_project_type p WHERE p.id = g.project_id LIMIT 1) AS project_name,
|
|
|
+ (SELECT COUNT(*) FROM goods_course gc LEFT JOIN course_menu cm on cm.course_id = gc.course_id where gc.goods_id=g.goods_id and cm.type = 1 ) as module_num,
|
|
|
+ (( SELECT
|
|
|
+ COUNT( cm.id )
|
|
|
+ FROM
|
|
|
+ goods_course gc
|
|
|
+ LEFT JOIN course_menu cm ON cm.course_id = gc.course_id
|
|
|
+ WHERE
|
|
|
+ gc.goods_id = g.goods_id
|
|
|
+ AND cm.type = 2
|
|
|
+ )+(
|
|
|
+ SELECT
|
|
|
+ count( cmc.chapter_id )
|
|
|
+ FROM
|
|
|
+ goods_course gc
|
|
|
+ LEFT JOIN course_menu cm ON cm.course_id = gc.course_id
|
|
|
+ LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
|
|
|
+ WHERE
|
|
|
+ gc.goods_id = g.goods_id
|
|
|
+ AND cm.type = 1)) as chapter_num,
|
|
|
+ ( SELECT e.education_name FROM course_education_type e WHERE e.id = g.education_type_id LIMIT 1) AS education_name,
|
|
|
+ (( SELECT
|
|
|
+ COUNT( cm.id )
|
|
|
+ FROM
|
|
|
+ goods_course gc
|
|
|
+ LEFT JOIN course_menu cm ON cm.course_id = gc.course_id
|
|
|
+ WHERE
|
|
|
+ gc.goods_id = g.goods_id
|
|
|
+ AND cm.type = 3
|
|
|
+ )+(
|
|
|
+ SELECT
|
|
|
+ count( ccs.section_id )
|
|
|
+ FROM
|
|
|
+ goods_course gc
|
|
|
+ LEFT JOIN course_menu cm ON cm.course_id = gc.course_id
|
|
|
+ LEFT JOIN course_chapter_section ccs ON cm.menu_id = ccs.chapter_id
|
|
|
+ WHERE
|
|
|
+ gc.goods_id = g.goods_id
|
|
|
+ AND cm.type = 2
|
|
|
+ )+(
|
|
|
+ SELECT
|
|
|
+ count( ccs.section_id )
|
|
|
+ FROM
|
|
|
+ goods_course gc
|
|
|
+ LEFT JOIN course_menu cm ON cm.course_id = gc.course_id
|
|
|
+ LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
|
|
|
+ LEFT JOIN course_chapter_section ccs ON cmc.chapter_id = ccs.chapter_id
|
|
|
+ WHERE
|
|
|
+ gc.goods_id = g.goods_id
|
|
|
+ AND cm.type = 1)) as section_num,
|
|
|
+ (SELECT COUNT(DISTINCT section_id) FROM user_study_record r where r.order_goods_id=s.order_goods_id AND r.current_status = 1)
|
|
|
+ as stu_all_num,
|
|
|
+ s.service_start_time,
|
|
|
+ s.service_end_time
|
|
|
+ FROM
|
|
|
+ goods g
|
|
|
+ LEFT JOIN order_goods s ON g.goods_id = s.goods_id
|
|
|
+ LEFT JOIN `order` o ON o.order_sn = s.order_sn
|
|
|
+ WHERE
|
|
|
+ where 1=1
|
|
|
+ AND s.refund_status in (0,1,3)
|
|
|
+ AND s.pay_status in (2,3,4)
|
|
|
+ AND o.`status` = 1
|
|
|
+ AND g.goods_type = 6
|
|
|
+ <if test="userId != null and userId !=''">
|
|
|
+ AND o.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
+ AND g.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="goodsName != null and goodsName != '' ">
|
|
|
+ and g.goods_name like concat('%', #{goodsName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="goodsStatus != null and goodsStatus != '' ">
|
|
|
+ and g.`status` = #{goodsStatus}
|
|
|
+ </if>
|
|
|
+ <if test="studyStartTime != null and studyStartTime != '' ">
|
|
|
+ and (SELECT count(*) FROM user_exam_record r where r.goods_id=g.goods_id AND r.do_mode = 1 AND r.user_id = #{userId} AND r.create_time >= #{studyStartTime} )>0
|
|
|
+ </if>
|
|
|
+ <if test="studyEndTime != null and studyEndTime != '' ">
|
|
|
+ and (SELECT count(*) FROM user_exam_record r where r.goods_id=g.goods_id AND r.do_mode = 1 AND r.user_id = #{userId} AND #{studyEndTime} >= r.create_time )>0
|
|
|
+ </if>
|
|
|
+ ORDER BY s.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="listExamSon" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo"
|
|
|
resultMap="ExamSonStudyRecordVoResult">
|
|
|
SELECT
|