|
|
@@ -147,6 +147,8 @@
|
|
|
<result property="goodsYear" column="goods_year"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="profileStatus" column="profile_status"/>
|
|
|
+ <result property="orderSn" column="order_sn"/>
|
|
|
+ <result property="majorId" column="major_id"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
|
|
|
@@ -420,6 +422,105 @@
|
|
|
order by up.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="listUserVideoRecordNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
+ resultMap="ClassPeriodStudentVo">
|
|
|
+ SELECT
|
|
|
+ up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
|
|
|
+ FROM
|
|
|
+ user_period up
|
|
|
+ LEFT JOIN user_period_status ups ON up.id = ups.period_id
|
|
|
+ LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN goods g ON up.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_section cs ON up.section_id = cs.section_id
|
|
|
+ LEFT JOIN `user` u ON up.user_id = u.user_id
|
|
|
+ WHERE
|
|
|
+ up.grade_id > 0 and up.type = 1
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="projectIds != null and projectIds.size()!=0 ">
|
|
|
+ AND g.project_id in
|
|
|
+ <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
|
|
|
+ AND g.education_type_id in
|
|
|
+ <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
+ AND u.realname like concat('%', #{realname}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
+ AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
|
|
|
+ </if>
|
|
|
+ <if test="idCard != null and idCard != ''">
|
|
|
+ AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tenantIds != null and tenantIds.size()!=0 ">
|
|
|
+ AND up.tenant_id in
|
|
|
+ <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by up.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="listUserVideoRecordNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
+ resultType="java.lang.Long">
|
|
|
+ SELECT
|
|
|
+ count(up.id)
|
|
|
+ FROM
|
|
|
+ user_period up
|
|
|
+ LEFT JOIN user_period_status ups ON up.id = ups.period_id
|
|
|
+ LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN goods g ON up.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_section cs ON up.section_id = cs.section_id
|
|
|
+ LEFT JOIN `user` u ON up.user_id = u.user_id
|
|
|
+ WHERE
|
|
|
+ up.grade_id > 0 and up.type = 1
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="projectIds != null and projectIds.size()!=0 ">
|
|
|
+ AND g.project_id in
|
|
|
+ <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
|
|
|
+ AND g.education_type_id in
|
|
|
+ <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
+ AND u.realname like concat('%', #{realname}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
+ AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
|
|
|
+ </if>
|
|
|
+ <if test="idCard != null and idCard != ''">
|
|
|
+ AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tenantIds != null and tenantIds.size()!=0 ">
|
|
|
+ AND up.tenant_id in
|
|
|
+ <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by up.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
<select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
resultMap="ClassPeriodStudentVo">
|
|
|
@@ -449,6 +550,8 @@
|
|
|
cgu.period_status_num,
|
|
|
cgu.period_time,
|
|
|
cgu.order_goods_id,
|
|
|
+ og.order_sn,
|
|
|
+ g.major_id,
|
|
|
/* IFNULL(ge.exam_num,0) as exam_num, */
|
|
|
<if test="userPhoto != null and userPhoto == 1">
|
|
|
up.key_value,
|
|
|
@@ -572,6 +675,289 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <select id="listUserPeriodNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
+ resultType="java.lang.Long">
|
|
|
+ SELECT
|
|
|
+ count(cgu.id)
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = cgu.user_id
|
|
|
+ LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
|
|
|
+ LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
|
+ LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ where 1=1
|
|
|
+ and cgu.`status` =1
|
|
|
+ and cb.`period_check_sign` = 1
|
|
|
+ <if test="projectIds != null and projectIds.size()!=0 ">
|
|
|
+ AND g.project_id in
|
|
|
+ <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
|
|
|
+ AND g.education_type_id in
|
|
|
+ <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus != null ">
|
|
|
+ and cgu.period_status = #{periodStatus}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != '' ">
|
|
|
+ and u.realname like concat('%', #{searchKey}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="idCard != null and idCard !='' ">
|
|
|
+ AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="tenantIds != null and tenantIds.size()!=0 ">
|
|
|
+ AND cgu.tenant_id in
|
|
|
+ <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by cgu.update_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listUserPeriodNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
+ resultType="com.zhongzheng.modules.grade.vo.ClassPeriodStudentNewVo">
|
|
|
+ SELECT
|
|
|
+ u.user_id,
|
|
|
+ u.realname,
|
|
|
+ og.goods_id,
|
|
|
+ u.id_card,
|
|
|
+ cgu.grade_id,
|
|
|
+ u.telphone,
|
|
|
+ up.`status` as profile_status,
|
|
|
+ g.goods_name,
|
|
|
+ cg.class_name,
|
|
|
+ cgu.order_goods_id,
|
|
|
+ (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
|
|
|
+ cgu.period_wait_time as end_time,
|
|
|
+ cgu.tenant_id,
|
|
|
+ CONCAT(cet.education_name,cpt.project_name,cb.business_name) AS fullName
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = cgu.user_id
|
|
|
+ LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
|
|
|
+ LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
|
+ LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ where 1=1
|
|
|
+ and cgu.`status` =1
|
|
|
+ and cb.`period_check_sign` = 1
|
|
|
+ <if test="projectIds != null and projectIds.size()!=0 ">
|
|
|
+ AND g.project_id in
|
|
|
+ <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
|
|
|
+ AND g.education_type_id in
|
|
|
+ <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus != null ">
|
|
|
+ and cgu.period_status = #{periodStatus}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != '' ">
|
|
|
+ and u.realname like concat('%', #{searchKey}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="idCard != null and idCard !='' ">
|
|
|
+ AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="tenantIds != null and tenantIds.size()!=0 ">
|
|
|
+ AND cgu.tenant_id in
|
|
|
+ <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by cgu.update_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getEduIdByTenant" parameterType="map" resultType="java.lang.Long">
|
|
|
+ SELECT id FROM course_education_type WHERE tenant_id = #{tenantId} AND education_name = #{eduName} AND `status` = 1 LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProIdByTenant" parameterType="map" resultType="java.lang.Long">
|
|
|
+ SELECT id FROM course_project_type WHERE tenant_id = #{tenantId} AND project_name = #{proName} AND education_id = #{eduId} AND `status` = 1 LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
+ resultMap="ClassPeriodStudentVo">
|
|
|
+ SELECT
|
|
|
+ u.user_account,
|
|
|
+ u.user_id,
|
|
|
+ cgu.`status`,
|
|
|
+ u.realname,
|
|
|
+ og.goods_id,
|
|
|
+ u.id_card,
|
|
|
+ cgu.grade_id,
|
|
|
+ u.telphone,
|
|
|
+ u.one_inch_photos,
|
|
|
+ u.company_name,
|
|
|
+ up.`status` as profile_status,
|
|
|
+ g.class_hours as class_hours,
|
|
|
+ g.study_start_time as study_start_time,
|
|
|
+ g.study_end_time as study_end_time,
|
|
|
+ g.goods_name,
|
|
|
+ g.code as goods_code,
|
|
|
+ g.stand_price,
|
|
|
+ cgu.period_status,
|
|
|
+ cg.class_start_time,
|
|
|
+ cg.class_end_time,
|
|
|
+ cg.class_name,
|
|
|
+ cgu.period_plush,
|
|
|
+ cgu.period_status_num,
|
|
|
+ cgu.period_time,
|
|
|
+ cgu.order_goods_id,
|
|
|
+ og.order_sn,
|
|
|
+ g.major_id,
|
|
|
+ IFNULL(ge.exam_num,0) as exam_num,
|
|
|
+ <if test="userPhoto != null and userPhoto == 1">
|
|
|
+ up.key_value,
|
|
|
+ </if>
|
|
|
+ cgu.period_wait_time as end_time,
|
|
|
+ (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
|
|
|
+ (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
|
|
|
+ (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
|
|
|
+ (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
|
|
|
+ <if test="userPhoto == null">
|
|
|
+ /* ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_id and up.user_id = u.user_id
|
|
|
+ and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num */
|
|
|
+ </if>
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = cgu.user_id
|
|
|
+ LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
|
|
|
+ LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ LEFT JOIN (SELECT
|
|
|
+ COUNT( m.id ) AS exam_num,
|
|
|
+ c.goods_id
|
|
|
+ FROM
|
|
|
+ course_menu_exam m
|
|
|
+ LEFT JOIN goods_course c ON m.course_id = c.course_id
|
|
|
+ where
|
|
|
+ m.type in (1,3)
|
|
|
+ GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
|
|
|
+ where 1=1
|
|
|
+ and cgu.`status` =1
|
|
|
+ and cb.`period_check_sign` = 1
|
|
|
+ <if test="periodPlush != null and periodPlush != ''">
|
|
|
+ AND cgu.period_plush = #{periodPlush}
|
|
|
+ </if>
|
|
|
+ <if test="officialStatus != null and officialStatus != ''">
|
|
|
+ AND cgu.official_status = #{officialStatus}
|
|
|
+ </if>
|
|
|
+ <if test="changeGrade != null and changeGrade != ''">
|
|
|
+ AND cgu.change_grade = #{changeGrade}
|
|
|
+ </if>
|
|
|
+ <if test="profileStatus != null and profileStatus != ''">
|
|
|
+ AND up.status = #{profileStatus}
|
|
|
+ </if>
|
|
|
+ <if test="gradeId != null and gradeId !='' ">
|
|
|
+ and cgu.grade_id = #{gradeId}
|
|
|
+ </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="schoolId != null and schoolId != ''">
|
|
|
+ AND g.school_id = #{schoolId}
|
|
|
+ </if>
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
+ AND g.major_id = #{majorId}
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus != null ">
|
|
|
+ and cgu.period_status = #{periodStatus}
|
|
|
+ </if>
|
|
|
+ <if test="classStartTime != null and classStartTime != '' ">
|
|
|
+ AND cg.class_start_time >= #{classStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="classEndTime != null and classEndTime != '' ">
|
|
|
+ AND #{classEndTime} >= cg.class_end_time
|
|
|
+ </if>
|
|
|
+ <if test="studyStatus != null and studyStatus == 1 ">
|
|
|
+ and cgu.period_status = -1
|
|
|
+ </if>
|
|
|
+ <if test="studyStatus != null and studyStatus == 2 ">
|
|
|
+ and cgu.period_status != -1
|
|
|
+ </if>
|
|
|
+ <if test="className != null and className !='' ">
|
|
|
+ and cg.class_name like concat('%', #{className}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and searchKey != '' ">
|
|
|
+ and (u.realname like concat('%', #{searchKey}, '%')
|
|
|
+ or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
+ or g.goods_name like concat('%', #{searchKey}, '%')
|
|
|
+ or cg.class_name like concat('%', #{searchKey}, '%')
|
|
|
+ or u.company_name like concat('%', #{searchKey}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="inputOrderSn != null and inputOrderSn != '' ">
|
|
|
+ and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != '' ">
|
|
|
+ and u.company_name like concat('%', #{companyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="idCard != null and idCard !='' ">
|
|
|
+ AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="telphone != null and telphone !='' ">
|
|
|
+ AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="searchStartTime != null and searchStartTime !='' ">
|
|
|
+ AND cgu.create_time >=#{searchStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="searchEndTime != null and searchEndTime !='' ">
|
|
|
+ AND #{searchEndTime} >= cgu.create_time
|
|
|
+ </if>
|
|
|
+ <if test="periodStartTime != null and periodStartTime !='' ">
|
|
|
+ AND cgu.period_time >=#{periodStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="periodEndTime != null and periodEndTime !='' ">
|
|
|
+ AND #{periodEndTime} >= cgu.period_time
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus != 2 and periodStatus != 3">
|
|
|
+ order by cgu.update_time desc
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus == 2 ">
|
|
|
+ order by cgu.period_wait_time,cgu.create_time
|
|
|
+ </if>
|
|
|
+ <if test="periodStatus == 3 ">
|
|
|
+ order by cgu.period_ing_time,cgu.create_time
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listUserPeriodTotal" parameterType="java.lang.Integer" resultType="java.lang.Long">
|
|
|
+ SELECT
|
|
|
+ COUNT( cgu.id )
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ WHERE
|
|
|
+ cgu.`status` = 1
|
|
|
+ AND cb.period_check_sign = 1
|
|
|
+ AND cgu.period_status = #{periodStatus}
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
|
resultType="Long">
|
|
|
SELECT
|
|
|
@@ -1436,6 +1822,25 @@
|
|
|
rp.create_time ASC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectStartNew" parameterType="map" resultType="long">
|
|
|
+ SELECT
|
|
|
+ rp.create_time
|
|
|
+ FROM
|
|
|
+ user_study_record_photo rp
|
|
|
+ LEFT JOIN user_period_status ups ON rp.period_id = ups.id
|
|
|
+ LEFT JOIN user_period up ON up.id = ups.period_id
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="orderGoodsId != null ">
|
|
|
+ AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
|
|
|
+ </if>
|
|
|
+ AND ups.period_status = 1
|
|
|
+ AND up.grade_id = #{gradeId}
|
|
|
+ AND up.user_id = #{userId}
|
|
|
+ ORDER BY
|
|
|
+ rp.create_time ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectStartNoPhoto" parameterType="map" resultType="long">
|
|
|
SELECT
|
|
|
ups.record_start_time
|
|
|
@@ -1455,6 +1860,25 @@
|
|
|
limit 1
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectStartNoPhotoNew" parameterType="map" resultType="long">
|
|
|
+ SELECT
|
|
|
+ ups.record_start_time
|
|
|
+ FROM
|
|
|
+ user_period_status ups
|
|
|
+ LEFT JOIN user_period up ON up.id = ups.period_id
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="orderGoodsId != null ">
|
|
|
+ AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
|
|
|
+ </if>
|
|
|
+ AND ups.period_status = 1
|
|
|
+ AND up.grade_id = #{gradeId}
|
|
|
+ AND up.user_id = #{userId}
|
|
|
+ ORDER BY
|
|
|
+ ups.record_start_time ASC
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectEnd" parameterType="map" resultType="long">
|
|
|
SELECT
|
|
|
usr.end_time
|
|
|
@@ -1521,6 +1945,47 @@
|
|
|
AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
|
|
|
</select>
|
|
|
|
|
|
+ <select id="sendTenAndFifteenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ cgu.user_id,
|
|
|
+ cgu.order_goods_id,
|
|
|
+ cg.class_start_time,
|
|
|
+ cg.class_end_time,
|
|
|
+ og.goods_id,
|
|
|
+ cg.grade_id
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ where 1=1
|
|
|
+ and cgu.status = 1
|
|
|
+ AND (unix_timestamp(now()) BETWEEN cg.class_end_time-950400 and cg.class_end_time-864000 or
|
|
|
+ unix_timestamp(now()) BETWEEN cg.class_end_time-1382400 and cg.class_end_time-1296000)
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="checkTenClassGradeUser" parameterType="map" resultMap="ClassGradeUserGoodsVoResult">
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ cgu.user_id,
|
|
|
+ cgu.order_goods_id,
|
|
|
+ cg.class_end_time,
|
|
|
+ og.goods_id,
|
|
|
+ g.goods_name,
|
|
|
+ cg.class_name as grade_name
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
|
+ LEFT JOIN goods g ON g.goods_id = og.goods_id
|
|
|
+ where 1=1
|
|
|
+ and cg.status = 1
|
|
|
+ and cgu.status = 1
|
|
|
+ and cgu.user_id = #{userId}
|
|
|
+ and (cgu.period_status = -1 or cgu.period_status = 0)
|
|
|
+ AND unix_timestamp(now()) BETWEEN cg.class_end_time-#{startTime} and cg.class_end_time-#{endTime}
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
<select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
|
|
|
|
|
|
@@ -1724,9 +2189,11 @@
|
|
|
WHERE
|
|
|
cgu.user_id = #{userId}
|
|
|
AND cgu.period_status = -1
|
|
|
+ AND cgu.period_wait_time is null
|
|
|
AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
|
|
|
and g.business_id = #{businessId}
|
|
|
and g.goods_id != #{goodsId}
|
|
|
+ and cgu.`status` = 1
|
|
|
AND (
|
|
|
SELECT
|
|
|
IFNULL( count(*), 0 )
|
|
|
@@ -1734,10 +2201,23 @@
|
|
|
user_period up
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
- AND up.user_id = cgu.user_id
|
|
|
- AND up.grade_id = cgu.grade_id
|
|
|
+ AND up.order_goods_id = cgu.order_goods_id
|
|
|
)>0
|
|
|
</select>
|
|
|
+ <select id="getOrderGoods" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.order.domain.OrderGoods">
|
|
|
+ SELECT
|
|
|
+ og.*
|
|
|
+ FROM
|
|
|
+ order_goods og
|
|
|
+ LEFT JOIN `order` o ON og.order_sn = o.order_sn
|
|
|
+ WHERE
|
|
|
+ o.user_id = #{userId}
|
|
|
+ AND og.goods_id = #{goodsId}
|
|
|
+ AND og.refund_status != 2
|
|
|
+ AND og.pay_status != 1
|
|
|
+ AND og.`status` = 1
|
|
|
+ AND o.`status` = 1
|
|
|
+ </select>
|
|
|
|
|
|
<select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
|
|
|
SELECT
|