|
@@ -14,8 +14,6 @@
|
|
|
<result column="service_tag_" property="serviceTag"/>
|
|
|
<result column="operating_tag_" property="operatingTag"/>
|
|
|
<result column="operating_temp_tag_" property="operatingTempTag"/>
|
|
|
- <result column="teacher_id_" property="teacherId"/>
|
|
|
- <result column="teacher_name_" property="teacherName"/>
|
|
|
<result column="is_new_user_" property="isNewUser"/>
|
|
|
<result column="create_time_" property="createTime"/>
|
|
|
<result column="update_time_" property="updateTime"/>
|
|
@@ -87,7 +85,7 @@
|
|
|
<if test="operatingTag != null">
|
|
|
operating_tag_,
|
|
|
</if>
|
|
|
- teacher_id_,create_time_,update_time_,service_tag_update_time_,cooperation_organ_id_,
|
|
|
+ create_time_,update_time_,service_tag_update_time_,cooperation_organ_id_,
|
|
|
care_package_,come_on_package_,member_rank_setting_id_,membership_start_time_,
|
|
|
membership_end_time_,current_grade_num_,current_class_,ext_subject_ids_,tenant_id_)
|
|
|
VALUES
|
|
@@ -98,7 +96,7 @@
|
|
|
<if test="operatingTag != null">
|
|
|
#{operatingTag},
|
|
|
</if>
|
|
|
- #{teacherId},NOW(),NOW(),NOW(),#{cooperationOrganId},
|
|
|
+ NOW(),NOW(),NOW(),#{cooperationOrganId},
|
|
|
#{carePackage},#{comeOnPackage},#{memberRankSettingId},#{membershipStartTime},
|
|
|
#{membershipEndTime},#{currentGradeNum},#{currentClass},#{extSubjectIds},#{tenantId})
|
|
|
</insert>
|
|
@@ -122,9 +120,6 @@
|
|
|
<if test="operatingTempTag != null">
|
|
|
operating_temp_tag_ = #{operatingTempTag},
|
|
|
</if>
|
|
|
- <if test="teacherId != null">
|
|
|
- teacher_id_=#{teacherId},
|
|
|
- </if>
|
|
|
<if test="isNewUser != null">
|
|
|
is_new_user_=#{isNewUser},
|
|
|
</if>
|
|
@@ -261,9 +256,6 @@
|
|
|
<if test="item.operatingTempTag != null">
|
|
|
operating_temp_tag_ = #{item.operatingTempTag},
|
|
|
</if>
|
|
|
- <if test="item.teacherId != null">
|
|
|
- teacher_id_=#{item.teacherId},
|
|
|
- </if>
|
|
|
<if test="item.updateTime != null">
|
|
|
update_time_ = #{item.updateTime},
|
|
|
</if>
|
|
@@ -340,9 +332,6 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</update>
|
|
|
- <update id="batchUpdateAdviser">
|
|
|
- UPDATE student s SET s.teacher_id_ = #{teacherId},s.update_time_ = NOW() WHERE FIND_IN_SET(s.user_id_,#{studentIds})
|
|
|
- </update>
|
|
|
<update id="updateServiceTag">
|
|
|
UPDATE student SET service_tag_ = #{serviceTag},update_time_ = NOW() WHERE user_id_ IN
|
|
|
<foreach collection="studentIds" item="item" open="(" separator="," close=")">
|
|
@@ -350,175 +339,6 @@
|
|
|
</foreach>
|
|
|
</update>
|
|
|
|
|
|
- <resultMap id="student4operating" type="com.ym.mec.biz.dal.dto.Student4operating">
|
|
|
- <result column="organ_name_" property="organName"/>
|
|
|
- <result column="organ_id_" property="organId"/>
|
|
|
- <result column="student_name_" property="studentName"/>
|
|
|
- <result column="student_id_" property="studentId"/>
|
|
|
- <result column="teacher_id_" property="teacherId"/>
|
|
|
- <result column="teacher_name_" property="teacherName"/>
|
|
|
- <result column="operating_tag_" property="operatingTag"/>
|
|
|
- <result column="vip_times_" property="vipTimes"/>
|
|
|
- <result column="free_practice_times_" property="freePracticeTimes"/>
|
|
|
- <result column="buy_practice_times_" property="buyPracticeTimes"/>
|
|
|
- <result column="music_netWork_times_" property="musicNetWorkTimes"/>
|
|
|
- <result column="student_num_" property="studentNum"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <select id="getOperatingStudents" resultMap="student4operating">
|
|
|
- SELECT su.organ_id_,
|
|
|
- o.name_ organ_name_,
|
|
|
- su.username_ student_name_,
|
|
|
- s.user_id_ student_id_,
|
|
|
- tsu.id_ teacher_id_,
|
|
|
- tsu.real_name_ teacher_name_,
|
|
|
- s.operating_tag_,
|
|
|
- a.vip_times_,
|
|
|
- a.buy_practice_times_,
|
|
|
- a.music_netWork_times_,
|
|
|
- p.free_practice_times_,
|
|
|
- su.phone_
|
|
|
- FROM student s
|
|
|
- LEFT JOIN sys_user su ON s.user_id_ = su.id_
|
|
|
- LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_
|
|
|
- LEFT JOIN organization o ON o.id_ = su.organ_id_
|
|
|
- LEFT JOIN (
|
|
|
- SELECT cssp.user_id_,
|
|
|
- SUM(case when (cs.group_type_ = 'VIP' AND cs.teach_mode_='ONLINE') then 1 ELSE 0 END) vip_times_,
|
|
|
- SUM(case when (pg.type_='CHARGE') then 1 ELSE 0 END) buy_practice_times_,
|
|
|
- SUM(case when (cs.type_='MUSIC_NETWORK' OR cs.type_='HIGH_ONLINE') then 1 ELSE 0 END) music_netWork_times_
|
|
|
- FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
|
|
|
- LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE'
|
|
|
- WHERE cs.status_ IN ('NOT_START','UNDERWAY') AND (cs.is_lock_ IS NULL OR cs.is_lock_=0) AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
|
|
|
- GROUP BY cssp.user_id_
|
|
|
- ) a on a.user_id_ = s.user_id_
|
|
|
- LEFT JOIN (
|
|
|
- SELECT student_id_, count(id_) free_practice_times_
|
|
|
- FROM practice_group
|
|
|
- WHERE type_='FREE' AND group_status_ IN ('NORMAL', 'FINISH')
|
|
|
- GROUP BY student_id_
|
|
|
- ) p ON p.student_id_ = s.user_id_
|
|
|
- <include refid="student4OperatingQueryCondition"/>
|
|
|
- ORDER BY s.user_id_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countOperatingStudents" resultType="int">
|
|
|
- SELECT COUNT(s.user_id_) FROM student s
|
|
|
- LEFT JOIN sys_user su ON s.user_id_ = su.id_
|
|
|
- LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_
|
|
|
- LEFT JOIN (
|
|
|
- SELECT cssp.user_id_,
|
|
|
- SUM(case when (cs.group_type_ = 'VIP' AND cs.teach_mode_='ONLINE') then 1 ELSE 0 END) vip_times_,
|
|
|
- SUM(case when (pg.type_='CHARGE') then 1 ELSE 0 END) buy_practice_times_,
|
|
|
- SUM(case when (cs.type_='MUSIC_NETWORK' OR cs.type_='HIGH_ONLINE') then 1 ELSE 0 END) music_netWork_times_
|
|
|
- FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
|
|
|
- LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE'
|
|
|
- WHERE cs.status_ IN ('NOT_START','UNDERWAY') AND (cs.is_lock_ IS NULL OR cs.is_lock_=0) AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
|
|
|
- GROUP BY cssp.user_id_
|
|
|
- ) a on a.user_id_ = s.user_id_
|
|
|
- LEFT JOIN (
|
|
|
- SELECT student_id_, count(id_) free_practice_times_
|
|
|
- FROM practice_group
|
|
|
- WHERE type_='FREE' AND group_status_ IN ('NORMAL', 'FINISH')
|
|
|
- GROUP BY student_id_
|
|
|
- ) p ON p.student_id_ = s.user_id_
|
|
|
- <include refid="student4OperatingQueryCondition"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <sql id="student4OperatingQueryCondition">
|
|
|
- <where>
|
|
|
- su.user_type_ LIKE '%STUDENT%' and s.tenant_id_ = #{tenantId}
|
|
|
- <if test="search != null and search != ''">
|
|
|
- AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_
|
|
|
- LIKE CONCAT('%',#{search},'%'))
|
|
|
- </if>
|
|
|
- <if test="organId != null and organId != ''">
|
|
|
- AND FIND_IN_SET(su.organ_id_,#{organId})
|
|
|
- </if>
|
|
|
- <if test="teacherId!=null">
|
|
|
- AND s.teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="operatingTag !=null">
|
|
|
- AND s.operating_tag_ = #{operatingTag}
|
|
|
- </if>
|
|
|
- <if test='hasVip != null and hasVip=="1"'>
|
|
|
- AND a.vip_times_ >=1
|
|
|
- </if>
|
|
|
- <if test='hasVip != null and hasVip=="0"'>
|
|
|
- AND (a.vip_times_ =0 OR a.vip_times_ IS NULL)
|
|
|
- </if>
|
|
|
- <if test='hasFreePractice != null and hasFreePractice=="1"'>
|
|
|
- AND p.free_practice_times_ >=1
|
|
|
- </if>
|
|
|
- <if test='hasFreePractice != null and hasFreePractice=="0"'>
|
|
|
- AND (p.free_practice_times_ =0 OR p.free_practice_times_ IS NULL)
|
|
|
- </if>
|
|
|
- <if test='hasBuyPractice != null and hasBuyPractice=="1"'>
|
|
|
- AND a.buy_practice_times_ >=1
|
|
|
- </if>
|
|
|
- <if test='hasBuyPractice != null and hasBuyPractice=="0"'>
|
|
|
- AND (a.buy_practice_times_ =0 OR a.buy_practice_times_ IS NULL)
|
|
|
- </if>
|
|
|
- <if test='hasMusicNetWork != null and hasMusicNetWork=="1"'>
|
|
|
- AND a.music_netWork_times_ >=1
|
|
|
- </if>
|
|
|
- <if test='hasMusicNetWork != null and hasMusicNetWork=="0"'>
|
|
|
- AND (a.music_netWork_times_ =0 OR a.music_netWork_times_ IS NULL)
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="getTeacherOperatingStudentsNum" resultType="java.util.Map">
|
|
|
- select teacher_id_ 'key', count(*) 'value'
|
|
|
- FROM student
|
|
|
- WHERE FIND_IN_SET(teacher_id_, #{teacherIds})
|
|
|
- AND operating_tag_ = 1
|
|
|
- GROUP BY teacher_id_
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getBuyNums" resultType="java.util.Map">
|
|
|
- SELECT s.teacher_id_ 'key', COUNT(DISTINCT cssp.user_id_) 'value'
|
|
|
- FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.teach_mode_ = 'ONLINE'
|
|
|
- LEFT JOIN student s ON s.user_id_ = cssp.user_id_
|
|
|
- <if test="groupType != null and groupType==@com.ym.mec.biz.dal.enums.GroupType@PRACTICE">
|
|
|
- LEFT JOIN practice_group pg ON cssp.music_group_id_ = pg.id_ AND cssp.group_type_ = 'PRACTICE'
|
|
|
- </if>
|
|
|
- WHERE s.teacher_id_ = #{teacherId}
|
|
|
- AND cs.status_ IN ('NOT_START', 'UNDERWAY')
|
|
|
- AND (cs.is_lock_ IS NULL OR cs.is_lock_ = 0)
|
|
|
- <if test="groupType != null">
|
|
|
- AND cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
- </if>
|
|
|
- <if test="groupType != null and groupType==@com.ym.mec.biz.dal.enums.GroupType@PRACTICE">
|
|
|
- AND pg.group_status_ IN ('NORMAL', 'FINISH')
|
|
|
- AND pg.buy_months_ >= 1
|
|
|
- </if>
|
|
|
- GROUP BY s.teacher_id_
|
|
|
- </select>
|
|
|
- <select id="getPracticeAndVipNums" resultType="java.util.Map">
|
|
|
- SELECT s.teacher_id_ 'key', COUNT(DISTINCT pg.student_id_) 'value'
|
|
|
- FROM practice_group pg
|
|
|
- LEFT JOIN student s on s.user_id_ = pg.student_id_
|
|
|
- LEFT JOIN course_schedule_student_payment vcssp
|
|
|
- ON vcssp.user_id_ = pg.student_id_ AND vcssp.group_type_ = 'VIP'
|
|
|
- LEFT JOIN course_schedule_student_payment pcssp
|
|
|
- ON pcssp.user_id_ = pg.student_id_ AND pcssp.group_type_ = 'PRACTICE'
|
|
|
- LEFT JOIN course_schedule vcs ON vcs.id_ = vcssp.course_schedule_id_ AND vcs.teach_mode_ = 'ONLINE'
|
|
|
- LEFT JOIN course_schedule pcs ON pcs.id_ = pcssp.course_schedule_id_
|
|
|
- WHERE FIND_IN_SET(s.teacher_id_, #{teacherIds})
|
|
|
- AND pg.group_status_ IN ('NORMAL', 'FINISH')
|
|
|
- AND vcs.status_ IN ('NOT_START', 'UNDERWAY')
|
|
|
- AND pcs.status_ IN ('NOT_START', 'UNDERWAY')
|
|
|
- AND (vcs.is_lock_ IS NULL OR vcs.is_lock_ = 0)
|
|
|
- AND (pcs.is_lock_ IS NULL OR pcs.is_lock_ = 0)
|
|
|
- AND pg.buy_months_ >= 1
|
|
|
- GROUP BY s.teacher_id_
|
|
|
- </select>
|
|
|
-
|
|
|
<select id="getServeStudentIds" resultType="int">
|
|
|
SELECT user_id_
|
|
|
FROM student stu
|
|
@@ -685,11 +505,12 @@
|
|
|
</foreach>
|
|
|
</select>
|
|
|
<select id="getNoTeacherOrNoSubjectStudent" resultMap="Student">
|
|
|
- SELECT * FROM student WHERE teacher_id_ IS NULL OR subject_id_list_ IS NULL OR cooperation_organ_id_ IS NULL limit 0,1000;
|
|
|
+ SELECT * FROM student WHERE subject_id_list_ IS NULL OR cooperation_organ_id_ IS NULL limit 0,1000;
|
|
|
</select>
|
|
|
|
|
|
<select id="getHasVipCourseStudentIdsFromNewStudents" resultType="int">
|
|
|
- SELECT DISTINCT(spo.user_id_) from student_payment_order spo LEFT JOIN student s on spo.user_id_ = s.user_id_ WHERE spo.type_ in ('DOUBLE_ELEVEN2021','DOUBLE_ELEVEN2020','SMALL_CLASS_TO_BUY')
|
|
|
+ SELECT DISTINCT(spo.user_id_) from student_payment_order spo LEFT JOIN student s on spo.user_id_ = s.user_id_
|
|
|
+ WHERE spo.type_ in ('DOUBLE_ELEVEN2021','DOUBLE_ELEVEN2020','SMALL_CLASS_TO_BUY')
|
|
|
and spo.status_ = 'SUCCESS' and spo.expect_amount_ > 0 and s.is_new_user_ = 1
|
|
|
</select>
|
|
|
|
|
@@ -1094,7 +915,8 @@
|
|
|
GROUP BY cssp.course_schedule_id_
|
|
|
</select>
|
|
|
<select id="getStudentByHasCourse" resultType="java.lang.Integer">
|
|
|
- SELECT s.user_id_ FROM student s WHERE s.teacher_id_ = #{teacherId} AND s.user_id_ IN (SELECT t.user_id_ FROM (
|
|
|
+ select distinct student_id_ from student_teacher_mapper WHERE teacher_id_ = #{teacherId}
|
|
|
+ AND student_id_ IN (SELECT t.user_id_ FROM (
|
|
|
(SELECT sr.user_id_
|
|
|
FROM student_registration sr
|
|
|
LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_
|
|
@@ -1328,9 +1150,11 @@
|
|
|
GROUP BY sb.id_
|
|
|
</select>
|
|
|
<select id="queryStuSubjectIdByTeacherId" resultType="com.ym.mec.biz.dal.dto.BaseMapDto">
|
|
|
- select sb.id_ 'key',sb.name_ 'value' from student s
|
|
|
+ select sb.id_ 'key',sb.name_ 'value' from
|
|
|
+ (select distinct student_id_ from student_teacher_mapper WHERE teacher_id_ = #{userId}) stm
|
|
|
+ left join student s ON stm.student_id_ = s.user_id_
|
|
|
LEFT JOIN subject sb ON sb.id_ = s.subject_id_list_
|
|
|
- WHERE s.teacher_id_ = #{userId} AND s.subject_id_list_ IS NOT NULL AND s.subject_id_list_ != ''
|
|
|
+ WHERE s.subject_id_list_ IS NOT NULL AND s.subject_id_list_ != ''
|
|
|
GROUP BY sb.id_
|
|
|
</select>
|
|
|
<select id="queryByOperatingTag" resultType="java.lang.Integer">
|