增加分类筛选等功能
This commit is contained in:
@@ -64,7 +64,7 @@ public interface MusicInfoMapper
|
||||
|
||||
MusicInfo selectByCate(CategoryInfo categoryInfo);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByCid(String categoryId);
|
||||
List<MusicInfo> selectMusicInfoByCid(@Param("categoryId") String categoryId,@Param("musicInfo") MusicInfo musicInfo);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByIds(List<Long> musicIdList);
|
||||
|
||||
@@ -91,4 +91,12 @@ public interface MusicInfoMapper
|
||||
MusicInfo selectByPath(String path);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByReId(String reId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询喜欢的音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
String selectLikeMusicImageByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -62,4 +62,20 @@ public interface UserHistoryMapper
|
||||
public int deleteUserHistoryByIds(String[] ids);
|
||||
|
||||
int deleteUserHistoryByMusicId(@Param("musicIds") String[] musicIds,@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询历史记录数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 历史记录数量
|
||||
*/
|
||||
int selectHistoryNumByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询历史音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
String selectHistoryMusicImageByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -62,4 +62,12 @@ public interface UserLikeMusicMapper
|
||||
public int deleteUserLikeMusicByIds(String[] ids);
|
||||
|
||||
UserLikeMusic selectUserLikeMusicAndUserId(@Param("userId") Long userId,@Param("musicId") String musicId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询喜欢的音乐数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 喜欢的音乐数量
|
||||
*/
|
||||
int selectLikeMusicCountByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface IMusicInfoService
|
||||
|
||||
List<MusicInfo> findMusicByCate(CategoryInfo categoryInfo);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByCid(String categoryId);
|
||||
List<MusicInfo> selectMusicInfoByCid(String categoryId,MusicInfo musicInfo);
|
||||
|
||||
List<MusicInfo> findMusicByCollectId(String collectId);
|
||||
|
||||
@@ -100,4 +100,20 @@ public interface IMusicInfoService
|
||||
* @return 下一首音乐ID
|
||||
*/
|
||||
String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId,String reId, String currentMusicId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询喜欢的音乐数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 喜欢的音乐数量
|
||||
*/
|
||||
int findLikeNumsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户喜欢的音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
String findLikeMusicImageByUserId(Long userId);
|
||||
}
|
||||
|
||||
@@ -63,4 +63,20 @@ public interface IUserHistoryService
|
||||
int insertHistory(Long userId, String musicId);
|
||||
|
||||
int deleteUserHistoryByMusicId(String[] musicId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询历史记录数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 历史记录数量
|
||||
*/
|
||||
int findNumsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户历史音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
String findHistoryMusicImageByUserId(Long userId);
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MusicInfo> selectMusicInfoByCid(String categoryId) {
|
||||
return musicInfoMapper.selectMusicInfoByCid(categoryId);
|
||||
public List<MusicInfo> selectMusicInfoByCid(String categoryId,MusicInfo musicInfo) {
|
||||
return musicInfoMapper.selectMusicInfoByCid(categoryId,musicInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,7 +284,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId);
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId,new MusicInfo());
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
@@ -361,6 +361,28 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID查询喜欢的音乐数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 喜欢的音乐数量
|
||||
*/
|
||||
@Override
|
||||
public int findLikeNumsByUserId(Long userId) {
|
||||
return userLikeMusicMapper.selectLikeMusicCountByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户喜欢的音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
@Override
|
||||
public String findLikeMusicImageByUserId(Long userId) {
|
||||
return musicInfoMapper.selectLikeMusicImageByUserId(userId);
|
||||
}
|
||||
|
||||
//TODO: 待完善
|
||||
public Map<String, String> getMixMusicInfo(String musicId){
|
||||
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
|
||||
@@ -103,4 +103,26 @@ public class UserHistoryServiceImpl implements IUserHistoryService
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return userHistoryMapper.deleteUserHistoryByMusicId(musicIds,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询历史记录数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 历史记录数量
|
||||
*/
|
||||
@Override
|
||||
public int findNumsByUserId(Long userId) {
|
||||
return userHistoryMapper.selectHistoryNumByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户历史音乐中的一张图片
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐图片URL
|
||||
*/
|
||||
@Override
|
||||
public String findHistoryMusicImageByUserId(Long userId) {
|
||||
return userHistoryMapper.selectHistoryMusicImageByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectMusicInfoByCid" resultMap="MusicInfoResult">
|
||||
SELECT m.* FROM music_category mc left JOIN music_info m on mc.music_id = m.music_id WHERE mc.category_id = #{categoryId} and m.shelf=1 and m.is_del=0
|
||||
SELECT m.* FROM music_category mc left JOIN music_info m on mc.music_id = m.music_id
|
||||
WHERE mc.category_id = #{categoryId} and m.shelf=1 and m.is_del=0
|
||||
<if test="musicInfo.vip != null and musicInfo.vip != ''"> and m.vip = #{musicInfo.vip}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMusicInfoByIds" resultMap="MusicInfoResult">
|
||||
@@ -186,4 +188,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectMusicInfoByReId" resultMap="MusicInfoResult">
|
||||
SELECT * FROM music_recommend mr left join music_info mi on mi.music_id=mr.music_id WHERE mi.is_del=0 and mr.recommend_id =#{reId}
|
||||
</select>
|
||||
|
||||
<select id="selectLikeMusicImageByUserId" resultType="java.lang.String">
|
||||
SELECT mi.img_addr FROM user_like_music ulm
|
||||
LEFT JOIN music_info mi ON ulm.music_id = mi.music_id
|
||||
WHERE ulm.user_id = #{userId} AND mi.is_del = 0 AND mi.img_addr IS NOT NULL AND mi.img_addr != ''
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -66,4 +66,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
and user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<select id="selectHistoryNumByUserId" resultType="int">
|
||||
select count(1) from user_history where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectHistoryMusicImageByUserId" resultType="java.lang.String">
|
||||
SELECT mi.img_addr FROM user_history uh
|
||||
LEFT JOIN music_info mi ON uh.music_id = mi.music_id
|
||||
WHERE uh.user_id = #{userId} AND mi.is_del = 0 AND mi.img_addr IS NOT NULL AND mi.img_addr != ''
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -62,4 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectUserLikeMusicAndUserId" resultType="com.ruoyi.common.core.domain.entity.UserLikeMusic">
|
||||
SELECT user_id as userId,music_id as musicId FROM user_like_music where user_id=#{userId} and music_id=#{musicId}
|
||||
</select>
|
||||
|
||||
<select id="selectLikeMusicCountByUserId" resultType="int">
|
||||
SELECT count(1) FROM user_like_music WHERE user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user