|
@@ -350,127 +350,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
|