|
@@ -269,64 +269,6 @@
|
|
|
GROUP BY
|
|
|
user_id_
|
|
|
</select>
|
|
|
- <resultMap id="CountStudentTrainDataDto" type="com.yonge.cooleshow.biz.dal.dto.CountStudentTrainDataDto">
|
|
|
- <result property="trainNum" column="train_num_"/>
|
|
|
- <result property="recordNum" column="record_num_"/>
|
|
|
- <result property="avatar" column="avatar_"/>
|
|
|
- <result property="userId" column="user_id_"/>
|
|
|
- <result property="username" column="username_"/>
|
|
|
- <result property="phone" column="phone_"/>
|
|
|
- <result property="totalPlayTime" column="total_play_time_"/>
|
|
|
- <result property="trainDay" column="train_day_"/>
|
|
|
- </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_
|
|
|
- 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="hasCourseUserIds != null and hasCourseUserIds.size > 0">
|
|
|
- AND s.user_id_ IN
|
|
|
- <foreach collection="hasCourseUserIds" open="(" close=")" item="userId" separator=",">
|
|
|
- #{userId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- GROUP BY s.user_id_
|
|
|
- <if test="having == 1">
|
|
|
- HAVING total_play_time_ < ${totalTime} OR train_num_ < ${trainNum}
|
|
|
- </if>
|
|
|
- ORDER BY
|
|
|
- <if test="sort != null and sort != ''">
|
|
|
- ${sort}
|
|
|
- <if test="order != null and order != ''">
|
|
|
- ${order}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="sort == null or sort == ''">
|
|
|
- total_play_time_ DESC
|
|
|
- </if>
|
|
|
- ,s.user_id_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
|
|
|
<select id="getOrganNewCloudStudyNum" resultType="int">
|
|
|
SELECT
|