|
@@ -49,8 +49,7 @@
|
|
|
,(select count(1) as num
|
|
|
from album_music_relate amr
|
|
|
join music_sheet ms on amr.music_sheet_id_ = ms.id_
|
|
|
- left join sys_user su on su.id_ = ms.user_id_
|
|
|
- where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS' and su.del_flag_ = 0
|
|
|
+ where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS'
|
|
|
and amr.album_id_ = t.id_) as musicSheetCount
|
|
|
,t2.num as albumFavoriteCount
|
|
|
<if test="query.userId != null">
|
|
@@ -58,8 +57,7 @@
|
|
|
</if>
|
|
|
from music_album t
|
|
|
left join (select count(1) as num,af.album_id_ from album_favorite af
|
|
|
- left join sys_user su on af.user_id_ = su.id_
|
|
|
- where su.del_flag_ = 0 group by af.album_id_
|
|
|
+ group by af.album_id_
|
|
|
) t2 on t2.album_id_ = t.id_
|
|
|
<where>
|
|
|
t.del_flag_ = 0
|
|
@@ -173,12 +171,10 @@
|
|
|
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_
|
|
|
- left join sys_user su on su.id_ = ms.user_id_
|
|
|
- where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS' and su.del_flag_ = 0
|
|
|
+ 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
|
|
|
- left join sys_user su on af.user_id_ = su.id_
|
|
|
- where su.del_flag_ = 0 group by af.album_id_
|
|
|
+ group by af.album_id_
|
|
|
) t2 on t2.album_id_ = t.id_
|
|
|
<where>
|
|
|
t.del_flag_ = 0
|
|
@@ -207,14 +203,12 @@
|
|
|
, (
|
|
|
select count(1) as num from album_music_relate amr
|
|
|
join music_sheet ms on amr.music_sheet_id_ = ms.id_
|
|
|
- left join sys_user su on su.id_ = ms.user_id_
|
|
|
- where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS' and su.del_flag_ = 0
|
|
|
+ where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS'
|
|
|
and amr.album_id_ = t.id_
|
|
|
) as musicSheetCount
|
|
|
,(
|
|
|
select count(1) as num from album_favorite af
|
|
|
- left join sys_user su on af.user_id_ = su.id_
|
|
|
- where su.del_flag_ = 0 and af.album_id_ = t.id_
|
|
|
+ where af.album_id_ = t.id_
|
|
|
) as albumFavoriteCount
|
|
|
from music_album t
|
|
|
where t.id_ = #{musicAlbumId}
|
|
@@ -227,19 +221,17 @@
|
|
|
,(select group_concat(s.name_) from subject s
|
|
|
where find_in_set(s.id_,t.subject_id_) and s.del_flag_ = 0 ) as subjectNames
|
|
|
,(select count(1) as num
|
|
|
- from album_music_relate amr
|
|
|
- join music_sheet ms on amr.music_sheet_id_ = ms.id_
|
|
|
- left join sys_user su on su.id_ = ms.user_id_
|
|
|
- where ms.del_flag_ = 0 and ms.state_ = 1 and ms.audit_status_ = 'PASS' and su.del_flag_ = 0
|
|
|
- and amr.album_id_ = t.id_) as musicSheetCount
|
|
|
+ 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'
|
|
|
+ and amr.album_id_ = t.id_) as musicSheetCount
|
|
|
,if(t2.num >0,t2.num,0) as albumFavoriteCount
|
|
|
from music_album t
|
|
|
<if test="query.musicId != null">
|
|
|
JOIN album_music_relate t1 ON (t.id_ = t1.album_id_ AND t1.music_sheet_id_ = #{query.musicId})
|
|
|
</if>
|
|
|
left join (select count(1) as num,af.album_id_ from album_favorite af
|
|
|
- left join sys_user su on (af.user_id_ = su.id_ <if test="clientType != null"> AND af.client_type_ = #{clientType} </if>)
|
|
|
- where su.del_flag_ = 0 group by af.album_id_
|
|
|
+ group by af.album_id_
|
|
|
) t2 on t2.album_id_ = t.id_
|
|
|
<where>
|
|
|
t.del_flag_ = 0
|