第二次课程提交 (2)

This commit is contained in:
Y1NanPing 2025-07-19 17:24:11 +08:00
parent 6b0d3c13e8
commit 8f88132e32
2 changed files with 29 additions and 1 deletions

View File

@ -3,7 +3,35 @@
<mapper namespace="com.atguigu.tingshu.album.mapper.AlbumInfoMapper">
<select id="findUserAlbumPage" resultType="com.atguigu.tingshu.vo.album.AlbumListVo">
select
ai.id album_id,
ai.album_title,
ai.cover_url,
ai.include_track_count,
ai.is_finished,
ai.status,
sum(if(stat_type = '0401', stat_num, 0)) playStatNum,
max(if(stat_type = '0402', stat_num, 0)) subscribeSta,
max(if(stat_type = '0403', stat_num, 0)) buyStatNum,
max(if(stat_type = '0404', stat_num, 0)) commentStatNum
from album_info ai
inner join album_stat stat on stat.album_id = ai.id and stat.is_deleted = 0
<where>
<if test="vo.userId != null">
and ai.user_id = #{vo.userId}
</if>
<if test="vo.status != null and vo.status != ''">
and ai.status = #{vo.status}
</if>
<if test="vo.albumTitle != null and vo.albumTitle != ''">
and ai.album_title like concat('%', #{vo.albumTitle}, '%')
</if>
and ai.is_deleted = 0
</where>
group by ai.id
order by ai.id desc
</select>
</mapper>