|
@@ -47,17 +47,17 @@
|
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMusicCompareRecord" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
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_,update_time_,part_index_,tenant_id_)
|
|
|
+ source_time_,feature_,create_time_,create_date_,update_time_,part_index_,tenant_id_)
|
|
|
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}, NOW(), NOW(),#{partIndex},#{tenantId})
|
|
|
+ #{sourceTime},#{feature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{createTime}, #{createDate}, NOW(),#{partIndex},#{tenantId})
|
|
|
</insert>
|
|
|
<insert id="init">
|
|
|
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 DATE_FORMAT(smcr.create_time_,'%Y-%m-%d') = #{date}
|
|
|
- group by DATE_FORMAT(smcr.create_time_,'%Y-%m-%d'),smcr.user_id_;
|
|
|
+ where smcr.create_date_ = #{date}
|
|
|
+ group by smcr.create_date_,smcr.user_id_;
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -142,10 +142,10 @@
|
|
|
AND smcr.feature_ = #{featureType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d %H:%i:%S') >= CONCAT(#{startTime},' 00:00:00')
|
|
|
+ AND smcr.create_date_ >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d %H:%i:%S') <= CONCAT(#{endTime},' 23:59:59')
|
|
|
+ AND smcr.create_date_ <= #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
@@ -186,7 +186,7 @@
|
|
|
LEFT JOIN sys_user su ON smcr.user_id_=su.id_
|
|
|
LEFT JOIN sys_music_score sms ON smcr.sys_music_score_id_ = sms.id_
|
|
|
WHERE EXISTS (SELECT user_id_ FROM student WHERE user_id_=smcr.user_id_)
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
|
|
+ AND smcr.create_date_ BETWEEN #{startTime} AND #{endTime}
|
|
|
<if test="heardLevel!=null">
|
|
|
AND smcr.heard_level_ = #{heardLevel, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
</if>
|
|
@@ -204,14 +204,14 @@
|
|
|
|
|
|
<select id="getUserTrainChartData" resultType="com.ym.mec.biz.dal.dto.StudentTrainChartDto">
|
|
|
SELECT
|
|
|
- DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') trainDate,
|
|
|
+ smcr.create_date_ trainDate,
|
|
|
COUNT(DISTINCT smcr.behavior_id_) trainNum,
|
|
|
SUM(smcr.play_time_) trainTime
|
|
|
FROM sys_music_compare_record smcr
|
|
|
WHERE smcr.user_id_=#{userId}
|
|
|
AND EXISTS (SELECT user_id_ FROM student WHERE user_id_=smcr.user_id_)
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
|
|
- GROUP BY DATE_FORMAT(smcr.create_time_, '%Y-%m-%d')
|
|
|
+ AND smcr.create_date_ BETWEEN #{startTime} AND #{endTime}
|
|
|
+ GROUP BY smcr.create_date_
|
|
|
ORDER BY trainDate;
|
|
|
</select>
|
|
|
|
|
@@ -219,7 +219,7 @@
|
|
|
<where>
|
|
|
sr.music_group_status_='NORMAL' AND stu.user_id_ IS NOT NULL and sr.tenant_id_ = #{tenantId}
|
|
|
<if test="startTime!=null and endTime!=null">
|
|
|
- AND DATE_FORMAT( smcr.create_time_, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
|
+ AND smcr.create_date_ BETWEEN #{startTime} AND #{endTime}
|
|
|
</if>
|
|
|
<if test="musicGroupId!=null">
|
|
|
AND sr.music_group_id_ = #{musicGroupId}
|
|
@@ -482,7 +482,7 @@
|
|
|
</resultMap>
|
|
|
<select id="exportCompareRecord" resultMap="ExportCompareRecordDto">
|
|
|
select o.name_ organ_name_,smcr.user_id_,su.username_,su.phone_,ROUND(sum(smcr.play_time_) / 60) play_time_,
|
|
|
- COUNT(su.id_) play_num_,COUNT(DISTINCT DATE_FORMAT(smcr.create_time_,'%Y-%m-%d')) play_days_,
|
|
|
+ COUNT(su.id_) play_num_,COUNT(DISTINCT smcr.create_date_) play_days_,
|
|
|
COUNT(CASE WHEN smcr.score_ IS NULL THEN NULL ELSE 1 END) heard_num_
|
|
|
from sys_music_compare_record smcr
|
|
|
left join sys_user su ON su.id_ = smcr.user_id_
|
|
@@ -492,10 +492,10 @@
|
|
|
AND FIND_IN_SET(su.organ_id_, #{queryInfo.organId})
|
|
|
</if>
|
|
|
<if test="queryInfo.startDate != null and queryInfo.startDate != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') >= #{queryInfo.startDate}
|
|
|
+ AND smcr.create_date_ >= #{queryInfo.startDate}
|
|
|
</if>
|
|
|
<if test="queryInfo.endDate != null and queryInfo.endDate != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') <= #{queryInfo.endDate}
|
|
|
+ AND smcr.create_date_ <= #{queryInfo.endDate}
|
|
|
</if>
|
|
|
</where>
|
|
|
group by smcr.user_id_
|
|
@@ -510,10 +510,10 @@
|
|
|
AND FIND_IN_SET(su.organ_id_, #{queryInfo.organId})
|
|
|
</if>
|
|
|
<if test="queryInfo.startDate != null and queryInfo.startDate != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') >= #{queryInfo.startDate}
|
|
|
+ AND smcr.create_date_ >= #{queryInfo.startDate}
|
|
|
</if>
|
|
|
<if test="queryInfo.endDate != null and queryInfo.endDate != ''">
|
|
|
- AND DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') <= #{queryInfo.endDate}
|
|
|
+ AND smcr.create_date_ <= #{queryInfo.endDate}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|