|  | @@ -103,6 +103,9 @@
 | 
	
		
			
				|  |  |  			<if test="userId!=null">
 | 
	
		
			
				|  |  |  				AND smcr.user_id_=#{userId}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
		
			
				|  |  | +			<if test="featureType != null">
 | 
	
		
			
				|  |  | +				AND smcr.feature_ = #{featureType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  |  			<if test="startTime!=null and endTime!=null">
 | 
	
		
			
				|  |  |  				AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
	
		
			
				|  | @@ -118,7 +121,7 @@
 | 
	
		
			
				|  |  |  			sms.name_ sys_music_score_name_
 | 
	
		
			
				|  |  |  		FROM sys_music_compare_record smcr
 | 
	
		
			
				|  |  |  		LEFT JOIN sys_music_score sms on smcr.sys_music_score_id_ = sms.id_
 | 
	
		
			
				|  |  | -		<include refid="queryCondition"></include>
 | 
	
		
			
				|  |  | +		<include refid="queryCondition"/>
 | 
	
		
			
				|  |  |  		ORDER BY id_ DESC
 | 
	
		
			
				|  |  |  		<include refid="global.limit"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
	
		
			
				|  | @@ -126,7 +129,7 @@
 | 
	
		
			
				|  |  |  	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  |  	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  |  		SELECT COUNT(*) FROM sys_music_compare_record smcr
 | 
	
		
			
				|  |  | -		<include refid="queryCondition"></include>
 | 
	
		
			
				|  |  | +		<include refid="queryCondition"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getUserTrainStat" resultType="com.ym.mec.biz.dal.dto.MusicCompareRankingDto">
 | 
	
	
		
			
				|  | @@ -220,7 +223,7 @@
 | 
	
		
			
				|  |  |  		LEFT JOIN sys_user su ON smcr.user_id_ = su.id_
 | 
	
		
			
				|  |  |  		LEFT JOIN student stu ON stu.user_id_ = smcr.user_id_
 | 
	
		
			
				|  |  |  		LEFT JOIN student_registration sr ON sr.user_id_=smcr.user_id_
 | 
	
		
			
				|  |  | -		<include refid="queryMusicGroupStudentTrainDataConditon"></include>
 | 
	
		
			
				|  |  | +		<include refid="queryMusicGroupStudentTrainDataConditon"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="queryStudentTrainData" resultType="com.ym.mec.biz.dal.dto.EduOrganStudentListDto">
 | 
	
	
		
			
				|  | @@ -233,6 +236,43 @@
 | 
	
		
			
				|  |  |  		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_music_compare_record mcr ON mcr.user_id_ = s.user_id_
 | 
	
		
			
				|  |  | +		WHERE s.teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | +		<if test="startTime != null and startTime != ''">
 | 
	
		
			
				|  |  | +			AND (mcr.create_time_ BETWEEN #{startTime} AND #{endTime} OR mcr.id_ IS NULL)
 | 
	
		
			
				|  |  | +		</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_"/>
 | 
	
		
			
				|  |  | +		<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(DISTINCT CASE WHEN mcr.feature_ = 'CLOUD_STUDY_EVALUATION' THEN mcr.behavior_id_ = NULL ELSE mcr.behavior_id_ 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_
 | 
	
		
			
				|  |  | +		WHERE s.teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | +		<if test="startTime != null and startTime != ''">
 | 
	
		
			
				|  |  | +			AND (mcr.create_time_ BETWEEN #{startTime} AND #{endTime} OR mcr.id_ IS NULL)
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +		GROUP BY s.user_id_
 | 
	
		
			
				|  |  | +		ORDER BY total_play_time_ DESC
 | 
	
		
			
				|  |  | +		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="getOrganNewCloudStudyNum" resultType="int">
 | 
	
		
			
				|  |  |  		SELECT
 | 
	
	
		
			
				|  | @@ -310,39 +350,4 @@
 | 
	
		
			
				|  |  |  							   DATE( smcr.create_time_ ))= CURDATE()) t
 | 
	
		
			
				|  |  |  		GROUP BY t.organ_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_music_compare_record mcr ON mcr.user_id_ = s.user_id_
 | 
	
		
			
				|  |  | -		WHERE s.teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | -		<if test="startTime != null and startTime != ''">
 | 
	
		
			
				|  |  | -			AND (mcr.create_time_ BETWEEN #{startTime} AND #{endTime} OR mcr.id_ IS NULL)
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	<resultMap id="CountStudentTrainDataDto" type="com.ym.mec.biz.dal.dto.CountStudentTrainDataDto">
 | 
	
		
			
				|  |  | -		<result property="trainNum" column="train_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_
 | 
	
		
			
				|  |  | -		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_
 | 
	
		
			
				|  |  | -		WHERE s.teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | -		<if test="startTime != null and startTime != ''">
 | 
	
		
			
				|  |  | -			AND (mcr.create_time_ BETWEEN #{startTime} AND #{endTime} OR mcr.id_ IS NULL)
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		GROUP BY mcr.user_id_
 | 
	
		
			
				|  |  | -		ORDER BY total_play_time_ DESC
 | 
	
		
			
				|  |  | -		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  |  </mapper>
 |