|
@@ -245,32 +245,6 @@
|
|
|
GROUP BY
|
|
|
user_id_
|
|
|
</select>
|
|
|
- <select id="countStudentTrain" resultType="java.lang.Integer">
|
|
|
- SELECT COUNT(DISTINCT s.user_id_)
|
|
|
- FROM teacher t
|
|
|
- LEFT JOIN student s ON t.id_ = s.teacher_id_
|
|
|
- LEFT JOIN sys_user su ON su.id_ = s.user_id_
|
|
|
- LEFT JOIN sys_music_compare_record mcr ON mcr.user_id_ = s.user_id_
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- AND (DATE_FORMAT(mcr.create_time_, '%Y-%m-%d') >= #{startTime} OR mcr.id_ IS NULL)
|
|
|
- </if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- AND (DATE_FORMAT(mcr.create_time_, '%Y-%m-%d') <= #{endTime} OR mcr.id_ IS NULL)
|
|
|
- </if>
|
|
|
- WHERE s.teacher_id_ = #{teacherId}
|
|
|
- <if test="search != null and search != ''">
|
|
|
- AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%'))
|
|
|
- </if>
|
|
|
- <if test="visitStudents != null and visitStudents.size > 0">
|
|
|
- AND s.user_id_ NOT IN
|
|
|
- <foreach collection="visitStudents" open="(" close=")" item="userId" separator=",">
|
|
|
- #{userId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="having == 1">
|
|
|
- GROUP BY s.user_id_ HAVING total_play_time_ < 80 OR train_day_ < 4
|
|
|
- </if>
|
|
|
- </select>
|
|
|
<resultMap id="CountStudentTrainDataDto" type="com.ym.mec.biz.dal.dto.CountStudentTrainDataDto">
|
|
|
<result property="trainNum" column="train_num_"/>
|
|
|
<result property="recordNum" column="record_num_"/>
|
|
@@ -280,17 +254,14 @@
|
|
|
<result property="phone" column="phone_"/>
|
|
|
<result property="totalPlayTime" column="total_play_time_"/>
|
|
|
<result property="trainDay" column="train_day_"/>
|
|
|
- <result property="musicGroupName" column="music_group_name_"/>
|
|
|
</resultMap>
|
|
|
<select id="queryStudentTrain" resultMap="CountStudentTrainDataDto">
|
|
|
SELECT s.user_id_,su.avatar_,su.phone_,su.username_,ROUND(SUM(mcr.play_time_) / 60) total_play_time_,
|
|
|
COUNT(DISTINCT DATE_FORMAT(mcr.create_time_,"%Y-%m-%d")) train_day_,
|
|
|
COUNT(DISTINCT mcr.behavior_id_) train_num_,
|
|
|
- COUNT(CASE WHEN mcr.feature_ = 'CLOUD_STUDY_EVALUATION' THEN mcr.behavior_id_ ELSE NULL END) record_num_,GROUP_CONCAT(DISTINCT mg.name_) music_group_name_
|
|
|
+ COUNT(CASE WHEN mcr.feature_ = 'CLOUD_STUDY_EVALUATION' THEN mcr.behavior_id_ ELSE NULL END) record_num_
|
|
|
FROM teacher t
|
|
|
LEFT JOIN student s ON t.id_ = s.teacher_id_
|
|
|
- LEFT JOIN student_registration sr ON sr.user_id_ = s.user_id_ AND sr.music_group_status_ = 'NORMAL'
|
|
|
- LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_ AND mg.status_ = 'PROGRESS'
|
|
|
LEFT JOIN sys_user su ON su.id_ = s.user_id_
|
|
|
LEFT JOIN sys_music_compare_record mcr ON mcr.user_id_ = s.user_id_
|
|
|
<if test="startTime != null and startTime != ''">
|