| 
					
				 | 
			
			
				@@ -40,11 +40,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<!-- 向数据库增加一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMusicCompareRecord" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		<!-- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		<selectKey resultClass="int" keyProperty="id" >  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		</selectKey> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		INSERT INTO sys_music_compare_record (id_,user_id_,sys_music_score_id_,heard_level_,behavior_id_,score_data_,score_,intonation_,cadence_,integrity_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		                                      record_file_path_,device_type_,client_id_,play_time_,monday_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 											feature_,create_time_) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -250,23 +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> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<resultMap id="CountStudentTrainDataDto" type="com.ym.mec.biz.dal.dto.CountStudentTrainDataDto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		<result property="trainNum" column="train_num_"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		<result property="recordNum" column="record_num_"/> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -276,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 != ''"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -299,8 +274,27 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		<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> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		ORDER BY total_play_time_ DESC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<if test="having == 1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HAVING total_play_time_ < 80 OR train_num_ < 4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</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> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |