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_,video_file_path_,device_type_,client_id_,play_time_,speed_,monday_, source_time_,feature_,create_time_,create_date_,update_time_,part_index_,tenant_id_,subject_id_, custom_configuration_,practice_time_,practice_source_,result_analyze_,headphone_flag_,instrument_id_,hidden_flag_,del_flag_,play_rate_) VALUES(#{id},#{userId},#{sysMusicScoreId},#{heardLevel,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{behaviorId},#{scoreData}, #{score},#{intonation},#{cadence},#{integrity}, #{recordFilePath},#{videoFilePath},#{deviceType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{clientId},#{playTime},#{speed},#{monday}, #{sourceTime},#{feature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{createTime}, #{createDate}, NOW(),#{partIndex},#{tenantId},#{subjectId} ,#{customConfiguration},#{practiceTime},#{practiceSource},#{resultAnalyze},#{headphoneFlag},#{instrumentId},#{hiddenFlag},#{delFlag},#{playRate}) insert into sys_music_compare_day_data (user_id_, day_, train_num_, train_time_, tenant_id_) select smcr.user_id_,DATE_FORMAT(smcr.create_time_,'%Y-%m-%d'),COUNT(smcr.id_),SUM(smcr.play_time_),smcr.tenant_id_ from sys_music_compare_record smcr where smcr.create_date_ = #{date} group by smcr.create_date_,smcr.user_id_; UPDATE sys_music_compare_record subject_id_ = #{subjectId}, user_id_ = #{userId}, sys_music_score_id_ = #{sysMusicScoreId}, behavior_id_ = #{behaviorId}, score_data_ = #{scoreData}, score_ = #{score}, intonation_ = #{intonation}, integrity_ = #{integrity}, cadence_ = #{cadence}, record_file_path_ = #{recordFilePath}, video_file_path_ = #{videoFilePath}, client_id_ = #{clientId}, device_type_ = #{deviceType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, source_time_ = #{sourceTime}, play_time_ = #{playTime}, speed_ = #{speed}, monday_ = #{monday}, part_index_ = #{partIndex}, feature_ = #{feature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, heard_level_ = #{heardLevel,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, custom_configuration_ = #{customConfiguration}, practice_source_ = #{practiceSource}, practice_time_ = #{practiceTime}, result_analyze_ = #{resultAnalyze}, headphone_flag_ = #{headphoneFlag}, instrument_id_ = #{instrumentId}, hidden_flag_ = #{hiddenFlag}, del_flag_ = #{delFlag}, play_rate_ = #{playRate}, update_time_ = NOW() WHERE id_ = #{id} and tenant_id_ = #{tenantId} DELETE FROM sys_music_compare_record WHERE id_ = #{id} delete from sys_music_compare_day_data where day_ = #{date} smcr.tenant_id_ = #{tenantId} AND smcr.user_id_=#{userId} AND smcr.subject_id_=#{subjectId} AND smcr.feature_ = #{featureType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND smcr.create_date_ >= #{startTime} AND smcr.create_date_ <= #{endTime} sr.music_group_status_='NORMAL' AND stu.user_id_ IS NOT NULL and sr.tenant_id_ = #{tenantId} AND smcr.create_date_ BETWEEN #{startTime} AND #{endTime} AND sr.music_group_id_ = #{musicGroupId} AND (su.username_ LIKE CONCAT('%', #{search}, '%')) AND su.id_ IN #{userId} AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%')) AND su.organ_id_ = #{organId} AND su.id_ NOT IN #{userId} AND su.id_ IN #{userId} AND (mcr.total_play_time_ < ${totalTime} OR mcr.train_num_ < ${trainNum}) AND mcr.heard_level_ = #{heardLevel,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND mcr.heard_level_ IN ('BEGINNER','ADVANCED','PERFORMER') AND (sms.name_ LIKE CONCAT('%',#{search},'%') OR mcr.sys_music_score_id_ = #{search}) AND mcr.create_date_ BETWEEN #{startDate} AND #{endDate} AND mcr.feature_ = #{feature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND mcr.user_id_ = #{studentId}