|
|
@@ -182,6 +182,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="expendBefore" column="expend_before"/>
|
|
|
<result property="periodPlushMsg" column="official_status_msg"/>
|
|
|
<result property="officialStatusMsg" column="period_plush_msg"/>
|
|
|
+ <result property="companyName" column="company_name"/>
|
|
|
+ <result property="gradeName" column="class_name"/>
|
|
|
+ <result property="endTime" column="end_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
@@ -562,6 +565,171 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order by user_info_status desc ,user_status desc ,cgu.id desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="listGradeAll" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassGradeStudentVo">
|
|
|
+ SELECT
|
|
|
+ cgu.id,
|
|
|
+ cgu.official_status_time,
|
|
|
+ cgu.official_status_num,
|
|
|
+ u.user_account,
|
|
|
+ u.user_id,
|
|
|
+ u.company_name,
|
|
|
+ cgu.`status`,
|
|
|
+ u.realname,
|
|
|
+ og.goods_id,
|
|
|
+ u.id_card,
|
|
|
+ cgu.grade_id,
|
|
|
+ u.telphone,
|
|
|
+ g.class_hours,
|
|
|
+ cgu.period_status,
|
|
|
+ cgu.finish_status,
|
|
|
+ cgu.period_plush,
|
|
|
+ g.study_start_time,
|
|
|
+ g.study_end_time,
|
|
|
+ cg.class_start_time,
|
|
|
+ cg.class_end_time,
|
|
|
+ cg.interface_push_id,
|
|
|
+ cgu.official_status,
|
|
|
+ cgu.official_status_msg,
|
|
|
+ cgu.period_plush_msg,
|
|
|
+ cgu.learn_status,
|
|
|
+ cgu.period_wait_time as end_time,
|
|
|
+ (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id where c.goods_id=og.goods_id and m.type in (1,3) ) as exam_num,
|
|
|
+ (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.user_id = u.user_id and ubr.grade_id = cgu.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.report_status=1 and ubr.current_status = 1) as record_num,
|
|
|
+ (og.study_count) as study_count,
|
|
|
+ og.order_goods_id,
|
|
|
+ og.rebuy_order_goods_id,
|
|
|
+ og.service_start_time,
|
|
|
+ og.service_end_time,
|
|
|
+ g.goods_name,
|
|
|
+ og.order_sn,
|
|
|
+ og.seven_year,
|
|
|
+ m.category_name,
|
|
|
+ g.major_id,
|
|
|
+ u.province,
|
|
|
+ cg.class_name,
|
|
|
+ cgu.reason,
|
|
|
+ cgu.tenant_id as org_id,
|
|
|
+ cb.business_name,
|
|
|
+ cpt.project_name,
|
|
|
+ (SELECT IFNULL(SUM(usr.study_duration),0) from user_study_record usr where usr.user_id = cgu.user_id and usr.grade_id = cgu.grade_id) as user_study_duration,
|
|
|
+ (SELECT count(*) from class_grade_user cgu where cgu.order_goods_id = og.order_goods_id) as use_study_count,
|
|
|
+ ueg.exam_number,
|
|
|
+ ueg.do_number,
|
|
|
+ ueg.expend_number,
|
|
|
+ ueg.expend_before
|
|
|
+ FROM
|
|
|
+ class_grade_user cgu
|
|
|
+ LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
|
|
|
+ LEFT JOIN `user` u ON u.user_id = cgu.user_id
|
|
|
+ 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 major m ON g.major_id = m.id
|
|
|
+ LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
+ LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
|
+ LEFT JOIN user_exam_goods ueg ON ueg.order_goods_id = og.order_goods_id
|
|
|
+ where 1=1 and cgu.`status` = 1
|
|
|
+ <if test="sevenCode != null and sevenCode !='' ">
|
|
|
+ AND cg.seven_code = #{sevenCode}
|
|
|
+ </if>
|
|
|
+ <if test="gradeId != null and gradeId !='' and (sevenCode == null or sevenCode =='')">
|
|
|
+ and cgu.grade_id = #{gradeId}
|
|
|
+ </if>
|
|
|
+ <if test="choice != null and choice == 1 ">
|
|
|
+ and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and cgur.order_goods_id = cgu.order_goods_id AND (unix_timestamp(now()) < cge.class_end_time or cge.class_start_time is null) and cge.`status`=1 and cgur.`status` =1)= 0 and cgu.period_status=0
|
|
|
+ AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) < cgde.class_end_time or cgde.class_start_time is null)) =0
|
|
|
+ </if>
|
|
|
+ <if test="choice != null and choice == 2 ">
|
|
|
+ and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and cgur.order_goods_id = cgu.order_goods_id AND (unix_timestamp(now()) < cge.class_end_time or cge.class_start_time is null)
|
|
|
+ and cge.`status`=1 and cgur.`status` =1)> 0
|
|
|
+ AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) < cgde.class_end_time or cgde.class_start_time is null)) =0
|
|
|
+ </if>
|
|
|
+ <if test="studyCountMore != null and studyCountMore == 2 ">
|
|
|
+ AND og.study_count > 0 AND cgu.change_grade = 0
|
|
|
+ </if>
|
|
|
+ <if test="studyCountMore != null and studyCountMore == 1 ">
|
|
|
+ AND og.study_count > 0 AND cgu.change_grade = 1
|
|
|
+ </if>
|
|
|
+ <if test="studyCountMore != null and studyCountMore == 0 ">
|
|
|
+ AND og.study_count = 0
|
|
|
+ </if>
|
|
|
+ <if test="officialStatus != null and officialStatus == 1 ">
|
|
|
+ AND cgu.official_status = 1
|
|
|
+ </if>
|
|
|
+ <if test="officialStatus != null and officialStatus == 0 ">
|
|
|
+ AND (cgu.official_status is NULL or cgu.official_status=0)
|
|
|
+ </if>
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
+ AND u.realname like concat('%', #{realname}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
+ AND (u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
+ </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 like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="idCards != null and idCards.size() != 0">
|
|
|
+ AND u.id_card IN
|
|
|
+ <foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderSn != null and orderSn != ''">
|
|
|
+ AND og.order_sn = #{orderSn}
|
|
|
+ </if>
|
|
|
+ <if test="goodsName != null and goodsName != ''">
|
|
|
+ AND g.goods_name like concat('%', #{goodsName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="searchStartTime != null and searchStartTime != ''">
|
|
|
+ AND cgu.create_time > #{searchStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="searchEndTime != null and searchEndTime != ''">
|
|
|
+ AND cgu.create_time < #{searchEndTime}
|
|
|
+ </if>
|
|
|
+ <if test="finishStatus != null">
|
|
|
+ AND cgu.finish_status = #{finishStatus}
|
|
|
+ </if>
|
|
|
+ <if test="learnStatus != null">
|
|
|
+ AND cgu.learn_status = #{learnStatus}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
+ AND g.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
+ AND m.id = #{majorId}
|
|
|
+ </if>
|
|
|
+ <if test="hasInterface != null and hasInterface == 0">
|
|
|
+ AND cg.interface_account_id is null AND cg.no_interface_account_id is null
|
|
|
+ </if>
|
|
|
+ <if test="hasInterface != null and hasInterface == 1">
|
|
|
+ AND cg.interface_account_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="hasInterface != null and hasInterface == 2">
|
|
|
+ AND cg.no_interface_account_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="hasBindWx != null and hasBindWx == 1 ">
|
|
|
+ AND u.union_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="hasBindWx != null and hasBindWx == 0 ">
|
|
|
+ AND u.union_id is null
|
|
|
+ </if>
|
|
|
+ <if test="hasFollowWx != null and hasFollowWx == 1 ">
|
|
|
+ AND uwf.gzh_open_id is not null
|
|
|
+ </if>
|
|
|
+ <if test="hasFollowWx != null and hasFollowWx == 0 ">
|
|
|
+ AND uwf.gzh_open_id is null
|
|
|
+ </if>
|
|
|
+ order by user_info_status desc ,user_status desc ,cgu.id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="listGradeInform" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeQueryBo" resultMap="ClassGradeUserListVo">
|
|
|
SELECT
|
|
|
g.*,
|