|
@@ -113,7 +113,11 @@
|
|
|
t1.num as musicSheetCount
|
|
|
,t2.num as albumFavoriteCount
|
|
|
from music_album t
|
|
|
- left join (select count(1) as num,amr.album_id_ from album_music_relate amr group by amr.album_id_) t1 on t1.album_id_ = t.id_
|
|
|
+ left join (select count(1) as num,amr.album_id_
|
|
|
+ from album_music_relate amr
|
|
|
+ join music_sheet ms on amr.music_sheet_id_ = ms.id_
|
|
|
+ where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS'
|
|
|
+ group by amr.album_id_) t1 on t1.album_id_ = t.id_
|
|
|
left join (select count(1) as num,af.album_id_ from album_favorite af group by af.album_id_) t2 on t2.album_id_ = t.id_
|
|
|
<where>
|
|
|
t.del_flag_ = 0
|
|
@@ -144,4 +148,48 @@
|
|
|
left join (select count(1) as num,af.album_id_ from album_favorite af group by af.album_id_) t2 on t2.album_id_ = t.id_
|
|
|
where t.id_ = #{musicAlbumId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectStudentPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicAlbumVo">
|
|
|
+ select <include refid="Base_Column_List"/>
|
|
|
+ ,(select group_concat(mt.name_) from music_tag mt
|
|
|
+ where find_in_set(mt.id_,t.album_tag_) and mt.del_flag_ = 0) as musicTagNames
|
|
|
+ ,if( t1.num>0,t1.num,0) as musicSheetCount
|
|
|
+ ,if(t2.num >0,t2.num,0) as albumFavoriteCount
|
|
|
+ from music_album t
|
|
|
+ left join (select count(1) as num,amr.album_id_
|
|
|
+ from album_music_relate amr
|
|
|
+ join music_sheet ms on amr.music_sheet_id_ = ms.id_
|
|
|
+ where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS'
|
|
|
+ group by amr.album_id_) t1 on t1.album_id_ = t.id_
|
|
|
+ left join (select count(1) as num,af.album_id_ from album_favorite af group by af.album_id_) t2 on t2.album_id_ = t.id_
|
|
|
+ <where>
|
|
|
+ t.del_flag_ = 0
|
|
|
+ <if test="query.idAndName != null and query.idAndName != ''">
|
|
|
+ and (t.id_ like concat('%',#{query.idAndName},'%') or
|
|
|
+ t.album_name_ like concat('%',#{query.idAndName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="query.albumTagIdList != null and query.albumTagIdList.size() != 0">
|
|
|
+ and
|
|
|
+ <foreach collection="query.albumTagIdList" separator="and" item="item">
|
|
|
+ find_in_set(#{item},t.album_tag_)
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="query.albumStatus != null">
|
|
|
+ and t.album_status_ = #{query.albumStatus}
|
|
|
+ </if>
|
|
|
+ <if test="query.auditVersion != null">
|
|
|
+ and t.audit_version_ = #{query.auditVersion}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="query.sortBy != null">
|
|
|
+ <choose>
|
|
|
+ <when test="query.sortBy == 1">
|
|
|
+ order by t2.num desc
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="query.sortBy == null">
|
|
|
+ order by t.id_ desc
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|