|
@@ -11,6 +11,8 @@
|
|
|
<result column="audio_type_" jdbcType="VARCHAR" property="audioType"/>
|
|
|
<result column="music_tag_" jdbcType="VARCHAR" property="musicTag"/>
|
|
|
<result column="play_speed_" jdbcType="INTEGER" property="playSpeed"/>
|
|
|
+ <result column="favorite_count_" jdbcType="INTEGER" property="favoriteCount"/>
|
|
|
+ <result column="first_pass_audit_time_" jdbcType="TIMESTAMP" property="firstPassAuditTime"/>
|
|
|
<result column="can_evaluate_" jdbcType="TINYINT" property="canEvaluate"/>
|
|
|
<result column="show_fingering_" jdbcType="TINYINT" property="showFingering"/>
|
|
|
<result column="charge_type_" jdbcType="TINYINT" property="chargeType"/>
|
|
@@ -43,6 +45,8 @@
|
|
|
t.audio_type_ as audioType,
|
|
|
t.music_tag_ as musicTag,
|
|
|
t.play_speed_ as playSpeed,
|
|
|
+ t.favorite_count_ as favoriteCount,
|
|
|
+ t.first_pass_audit_time_ as firstPassAuditTime,
|
|
|
t.can_evaluate_ as canEvaluate,
|
|
|
t.show_fingering_ as showFingering,
|
|
|
t.charge_type_ as chargeType,
|
|
@@ -159,8 +163,6 @@
|
|
|
where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
|
|
|
,(select group_concat(s.name_) from subject s
|
|
|
where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
|
|
|
- ,(select count(1) from music_favorite f
|
|
|
- where f.music_sheet_id_ = t.id_) as favoriteCount
|
|
|
,amr.sort_number_ as albumSortNumber
|
|
|
from music_sheet t
|
|
|
left join album_music_relate amr on t.id_ = amr.music_sheet_id_
|
|
@@ -291,7 +293,9 @@
|
|
|
<result column="reason" jdbcType="VARCHAR" property="reason"/>
|
|
|
<result column="accompanimentType" jdbcType="VARCHAR" property="accompanimentType"/>
|
|
|
<result column="notation" jdbcType="VARCHAR" property="notation"/>
|
|
|
- <result column="musicImg" jdbcType="VARCHAR" property="musicImg"/>
|
|
|
+ <result column="musicImg" jdbcType="VARCHAR" property="musicImg"/>
|
|
|
+ <result column="favoriteCount" jdbcType="VARCHAR" property="favoriteCount"/>
|
|
|
+ <result column="firstPassAuditTime" jdbcType="VARCHAR" property="firstPassAuditTime"/>
|
|
|
<result column="realName" jdbcType="VARCHAR" property="realName"/>
|
|
|
<result column="auditTime" jdbcType="VARCHAR" property="auditTime"/>
|
|
|
<result column="auditName" jdbcType="VARCHAR" property="auditName"/>
|
|
@@ -315,26 +319,14 @@
|
|
|
,su.avatar_ as addUserAvatar
|
|
|
,(select group_concat(mt.name_) from music_tag mt
|
|
|
where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
|
|
|
- ,(select count(1) as num from music_favorite af
|
|
|
- left join sys_user su on af.user_id_ = su.id_
|
|
|
- where su.del_flag_ = 0 and af.music_sheet_id_ = t.id_) as favoriteCount
|
|
|
,(select group_concat(s.name_) from subject s
|
|
|
where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0) as subjectNames
|
|
|
<if test="param.studentId != null">
|
|
|
,if(mf.id_ is not null,1,0) as favorite
|
|
|
-<!-- ,case when mspr.id_ is not null then 1-->
|
|
|
-<!-- when t.charge_type_ = 'FREE' then 1-->
|
|
|
-<!-- else 0 end as play-->
|
|
|
</if>
|
|
|
from music_sheet t
|
|
|
left join sys_user su on t.create_by_ = su.id_
|
|
|
- left join (select count(1) as num,mf.music_sheet_id_
|
|
|
- from music_favorite mf group by mf.music_sheet_id_) t2 on t2.music_sheet_id_ = t.id_
|
|
|
<if test="param.studentId != null">
|
|
|
-<!-- left join music_sheet_purchase_record mspr-->
|
|
|
-<!-- on mspr.music_sheet_id_ = t.id_-->
|
|
|
-<!-- and mspr.student_id_ = #{param.studentId}-->
|
|
|
-<!-- and order_status_ = 'PAID'-->
|
|
|
left join music_favorite mf on (t.id_ = mf.music_sheet_id_ and mf.user_id_ = #{param.studentId} <if test="clientType != null"> AND mf.client_type_ = #{clientType}</if> )
|
|
|
</if>
|
|
|
<where>
|
|
@@ -345,9 +337,23 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
order by
|
|
|
- <if test="param.myself == null or param.myself == false ">
|
|
|
- t.top_flag_ desc, t.sort_number_ desc, t2.num desc,
|
|
|
- </if>
|
|
|
+ <choose>
|
|
|
+ <when test="param.musicSortType != null and param.musicSortType.code == 'TOP'">
|
|
|
+ t.top_flag_ desc, t.sort_number_ desc,
|
|
|
+ </when>
|
|
|
+ <when test="param.musicSortType != null and param.musicSortType.code == 'HOT'">
|
|
|
+ t.favorite_count_ desc,
|
|
|
+ </when>
|
|
|
+ <when test="param.musicSortType != null and param.musicSortType.code == 'NEW'">
|
|
|
+ t.first_pass_audit_time_ desc,
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="param.myself == null or param.myself == false ">
|
|
|
+ t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc,
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
t.id_ desc
|
|
|
</select>
|
|
|
|
|
@@ -737,5 +743,21 @@
|
|
|
</where>
|
|
|
GROUP BY t1.music_sheet_id_
|
|
|
</select>
|
|
|
+
|
|
|
+ <update id="updateFavoriteCount">
|
|
|
+ update music_sheet set favorite_count_ =
|
|
|
+ <choose>
|
|
|
+ <when test="state.code == 0">
|
|
|
+ favorite_count_ - 1
|
|
|
+ </when>
|
|
|
+ <when test="state.code == 1">
|
|
|
+ favorite_count_ + 1
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ favorite_count_
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ where id_ = #{musicSheetId}
|
|
|
+ </update>
|
|
|
<!--单曲专辑数量统计-->
|
|
|
</mapper>
|