喜欢等bug

This commit is contained in:
menxipeng
2025-09-26 21:47:28 +08:00
parent e6c413d907
commit c00eb734e2
13 changed files with 148 additions and 98 deletions

View File

@@ -42,22 +42,22 @@ public class UmengConfig {
private final PushClient client = new PushClient();
public UmResp send(String token,String deviceTypeUp){
String umAppkey = null;
if (deviceTypeUp.equals(DeviceTypeEnum.ANDROID.name())){
umAppkey = AliKeyConfig.UMApp_Android_Key;
}else if (deviceTypeUp.equals(DeviceTypeEnum.IOS.name())){
umAppkey = AliKeyConfig.UMApp_IOS_Key;
}
// String umAppkey = null;
// if (deviceTypeUp.equals(DeviceTypeEnum.ANDROID.name())){
// umAppkey = AliKeyConfig.UMApp_Android_Key;
// }else if (deviceTypeUp.equals(DeviceTypeEnum.IOS.name())){
// umAppkey = AliKeyConfig.UMApp_IOS_Key;
// }
//687b2df479267e0210b79b6f
String appKey = AliKeyConfig.UMApp_AliKey;
String appSecret = AliKeyConfig.UMApp_AliSecret;
// String appKey = AliKeyConfig.UMApp_AliKey;
// String appSecret = AliKeyConfig.UMApp_AliSecret;
// if (deviceTypeUp.equals(DeviceTypeEnum.ANDROID.name())){
//
// }
// //687b2df479267e0210b79b6f
// String umAppkey = "68a99a66ec2b5b6f8825b8b1";
// String appKey = "204918113";
// String appSecret = "v4UrIhhLZlo0adpmevyCfvThGFbrRer0";
String umAppkey = "68a99a66ec2b5b6f8825b8b1";
String appKey = "204918113";
String appSecret = "v4UrIhhLZlo0adpmevyCfvThGFbrRer0";
// 下面的url要和阿里云云市场购买的商品对应
String url = "https://verify5.market.alicloudapi.com/api/v1/mobile/info?appkey=" + umAppkey;
HttpPost httpPost = new HttpPost(url);
@@ -161,11 +161,12 @@ public class UmengConfig {
public static void main(String[] args) throws Exception {
UmengConfig umengConfig = new UmengConfig();
// System.out.println(DeviceTypeEnum.ANDROID.name());
// UmResp sss1 = umengConfig.send("eyJvIjoiaU9TIiwiayI6ImJNSGJwMktVdjhVaE5zOW1wQWhwYlwvWCtVRTlqcnZKeXhj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MmRcLzhcL2JSTmxFM0txUUFLcDRGQUpxdWJ2bjhQRzdPcGN2bXhuSkF4bTJYNTFkQUZtaTdsSjZuZlc0MlJSNDRZWDBtMlhkczAwY3hZa2s5Q29zeVdWVUdGUkVDMjdjUUFURU9PMWp2TzdlMHEwOTRLZjdnaEx2UFJadlo2bFIxSUxmTTJxeWlQc0V5dmRiSUJyaG1yVEtJOWdqRW5Qc3U2dEZPc1RiZ0oxaVwvNGZBRFBKWDhOczF1Ym9taVl2KzZnVGsyNzlZTmQ3WU9OT21mMzlTOG05RktrNEN3Uk1QT1wvcVVSMGRJN25HbER4U1wvWEFFbWNHU0wxcDllczN0U0lsVUIrbHNcL3luWWZFNWNicDIwRE9NV3ZcL0xLa0I2cXA5RkVtaXV6eDY2MWYzZE9hZnk2WUJ2V2dsQnljU05TSkdDNkpYeTZnWHEwR1wvNE9XTkRPdjFhakIxMnhGRk9PK1dhbUVKcG9Takxic0FFV0V5eEtDb3pXaU9meG0ydEJ0bHdoM2hwXC9Vb3RyRCtIbkY2Z1NOOGtCblVtYnJRU3FzYUdsM2g3WDZSZUREbXdRSmMzSzY0QkxNcCJ9", "ios");
// String sss;
//
// sss = "{\"success\":true,\"data\":{\"mobile\":\"18518753918\",\"score\":null,\"activeScore\":null,\"aesEncryptKey\":null},\"code\":2001,\"message\":\"gain mobile's result success\",\"requestId\":\"0E87E249-42A0-42C0-94D3-7424D45E571E\"}\n";
System.out.println(DeviceTypeEnum.ANDROID.name());
UmResp sss1 = umengConfig.send(
"eyJvIjoiaU9TIiwiayI6ImJNSGJwMktVdjhVaE5zOW1wQWhwYlwvWCtVRTlqcnZKeXhjb091N3BDdVlqcHNEc2RKM3A2M0pJZ056U0JrdlY5UlFPSHo3U25ZMmNcL3ZpbUI3ZHN2THFwQXlkbmRJeDB4NHhLSytFR2pvVEF4eU1oUnpUVHlrNHYzZThCSjNIajJOamJoK0VPdUtRTXV3N2pnS0dIdHJoT3FJRFF4QXJ0NisrUTI1ODhhQWdEV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lQc0V5dmRiSUJyaG1yVEtJOWdqRW5Qc3U2dEZPc1RiZ0oxaVwvNGZBRFBKWDhOczF1Ym9taVl2KzZnVGsyNzlZTmQ3WU9OT21mMzlTOG05RktrNEN3Uk1QT1wvcVVSMGRJN25HbER4U1wvWEFFbWNHU0wxcDllczN0U0lsVUIrbHNcL3luWWZFNWNicDIwRE9NV3ZcL0xLa0I2cXA5RkVtaXV6eDY2MWYzZE9hZnk2WUJ2V2dsQnljU05TSkdDNkpYeTZnWHEwR1wvNE9XTkRPdjFhakIxMnhGRk9PK1dhbUVKcG9Takxic0FFV0V5eEtDb3pXaU9meG0ydEJ0bHdoM2hwXC9Vb3RyRCtIbkY2Z1NOOGtCblVtYnJRU3FzYUdsM2g3WDZSZUREbXdRSmMzSzY0QkxNcCJ9", "IOS");
// String sss;
// sss = "{\"success\":true,\"data\":{\"mobile\":\"18518753918\",\"score\":null,\"activeScore\":null,\"aesEncryptKey\":null},\"code\":2001,\"message\":\"gain mobile's result success\",\"requestId\":\"0E87E249-42A0-42C0-94D3-7424D45E571E\"}\n";
//
// UmResp ss = JSONUtil.toBean(sss, UmResp.class);
// System.out.println(ss);

View File

@@ -7,15 +7,15 @@ import java.util.List;
/**
* 【请填写功能名称】Mapper接口
*
*
* @author ruoyi
* @date 2025-07-18
*/
public interface MusicCollectMapper
public interface MusicCollectMapper
{
/**
* 查询【请填写功能名称】
*
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
@@ -23,7 +23,7 @@ public interface MusicCollectMapper
/**
* 查询【请填写功能名称】列表
*
*
* @param musicCollect 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
@@ -31,7 +31,7 @@ public interface MusicCollectMapper
/**
* 新增【请填写功能名称】
*
*
* @param musicCollect 【请填写功能名称】
* @return 结果
*/
@@ -39,7 +39,7 @@ public interface MusicCollectMapper
/**
* 修改【请填写功能名称】
*
*
* @param musicCollect 【请填写功能名称】
* @return 结果
*/
@@ -47,7 +47,7 @@ public interface MusicCollectMapper
/**
* 删除【请填写功能名称】
*
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
@@ -55,7 +55,7 @@ public interface MusicCollectMapper
/**
* 批量删除【请填写功能名称】
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
@@ -64,4 +64,6 @@ public interface MusicCollectMapper
int delBindMusic(MusicCollect musicCollect);
MusicCollect selectCollectIdAndMusicId(MusicCollect musicCollect);
int deleteMusicCollectByCollectIds(Long[] ids);
}

View File

@@ -9,15 +9,15 @@ import java.util.List;
/**
* 音乐信息Mapper接口
*
*
* @author ruoyi
* @date 2025-07-15
*/
public interface MusicInfoMapper
public interface MusicInfoMapper
{
/**
* 查询音乐信息
*
*
* @param id 音乐信息主键
* @return 音乐信息
*/
@@ -25,7 +25,7 @@ public interface MusicInfoMapper
/**
* 查询音乐信息列表
*
*
* @param musicInfo 音乐信息
* @return 音乐信息集合
*/
@@ -33,7 +33,7 @@ public interface MusicInfoMapper
/**
* 新增音乐信息
*
*
* @param musicInfo 音乐信息
* @return 结果
*/
@@ -41,7 +41,7 @@ public interface MusicInfoMapper
/**
* 修改音乐信息
*
*
* @param musicInfo 音乐信息
* @return 结果
*/
@@ -49,7 +49,7 @@ public interface MusicInfoMapper
/**
* 删除音乐信息
*
*
* @param id 音乐信息主键
* @return 结果
*/
@@ -57,7 +57,7 @@ public interface MusicInfoMapper
/**
* 批量删除音乐信息
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
@@ -92,18 +92,18 @@ public interface MusicInfoMapper
MusicInfo selectByPath(String path);
List<MusicInfo> selectMusicInfoByReId(String reId);
/**
* 根据用户ID查询喜欢的音乐中的一张图片
*
*
* @param userId 用户ID
* @return 音乐图片URL
*/
String selectLikeMusicImageByUserId(@Param("userId") Long userId);
/**
* 根据作者名称或音乐名称模糊搜索音乐
*
*
* @param search 搜索关键词
* @return 音乐信息列表
*/
@@ -112,4 +112,6 @@ public interface MusicInfoMapper
String selectListRandomMusic(String currentMusicId);
UserLikeMusic selectMusicAndUserLike(@Param("userId") Long userId,@Param("musicId") String musicId);
MusicInfo selectUserLikeMusic(@Param("musicId") String musicId,@Param("userId") Long userId);
}

View File

@@ -138,4 +138,6 @@ public interface IMusicInfoService
* @return 音乐信息列表,包含是否是当前用户喜欢的标识
*/
List<MusicInfo> findLikeSearch(String search);
MusicInfo selectUserLikeMusic(String musicId, Long userId);
}

View File

@@ -268,7 +268,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
/**
* 获取上一首播放的音乐ID
*
*
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放
@@ -281,7 +281,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public String getPrevMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
List<MusicInfo> musicList = null;
// 根据播放列表类型获取对应的音乐列表
switch (playlistType) {
case 1: // 历史播放
@@ -313,13 +313,13 @@ public class MusicInfoServiceImpl implements IMusicInfoService
default:
return null;
}
// 如果列表为空返回null
if (musicList == null || musicList.isEmpty()) {
return null;
}
// 根据播放模式获取上一首音乐ID
if (playMode == 1) { // 顺序播放
// 按照ID排序列表
@@ -328,14 +328,14 @@ public class MusicInfoServiceImpl implements IMusicInfoService
Long idB = b.getMusicId();
return idA.compareTo(idB);
});
// 如果没有当前音乐ID返回列表中的最后一首
if (currentMusicId == null || currentMusicId.isEmpty()) {
return musicList.get(musicList.size() - 1).getMusicId().toString();
}
// 查找当前音乐在列表中的位置
int currentIndex = -1;
for (int i = 0; i < musicList.size(); i++) {
@@ -366,7 +366,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
/**
* 获取下一首播放的音乐ID
*
*
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放 6-列表随机
@@ -378,7 +378,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
List<MusicInfo> musicList = null;
// 根据播放列表类型获取对应的音乐列表
switch (playlistType) {
case 1: // 历史播放
@@ -410,15 +410,15 @@ public class MusicInfoServiceImpl implements IMusicInfoService
default:
return null;
}
// 如果列表为空返回null
if (musicList == null || musicList.isEmpty()) {
return null;
}
// 打印调试信息列表大小和当前音乐ID
System.out.println("播放列表大小: " + musicList.size() + ", 当前音乐ID: " + currentMusicId);
// 根据播放模式获取下一首音乐ID
if (playMode == 1) { // 顺序播放
// 按照ID排序列表
@@ -427,17 +427,17 @@ public class MusicInfoServiceImpl implements IMusicInfoService
Long idB = b.getMusicId();
return idA.compareTo(idB);
});
// 打印排序后的ID列表用于调试
for (MusicInfo music : musicList) {
System.out.println(music.getMusicId());
}
// 如果没有当前音乐ID返回列表中的第一首
if (currentMusicId == null || currentMusicId.isEmpty()) {
return musicList.get(0).getMusicId().toString();
}
// 查找当前音乐在列表中的位置
int currentIndex = -1;
for (int i = 0; i < musicList.size(); i++) {
@@ -469,7 +469,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
/**
* 根据用户ID查询喜欢的音乐数量
*
*
* @param userId 用户ID
* @return 喜欢的音乐数量
*/
@@ -477,10 +477,10 @@ public class MusicInfoServiceImpl implements IMusicInfoService
public int findLikeNumsByUserId(Long userId) {
return userLikeMusicMapper.selectLikeMusicCountByUserId(userId);
}
/**
* 获取用户喜欢的音乐中的一张图片
*
*
* @param userId 用户ID
* @return 音乐图片URL
*/
@@ -488,17 +488,17 @@ public class MusicInfoServiceImpl implements IMusicInfoService
public String findLikeMusicImageByUserId(Long userId) {
return musicInfoMapper.selectLikeMusicImageByUserId(userId);
}
/**
* 根据作者名称或音乐名称模糊搜索音乐
*
*
* @param search 搜索关键词
* @return 音乐信息列表,包含是否是当前用户喜欢的标识
*/
@Override
public List<MusicInfo> findLikeSearch(String search) {
// 根据作者名称或音乐名称模糊搜索音乐
List<MusicInfo> musicList = musicInfoMapper.selectMusicInfoBySearch(search);
@@ -532,4 +532,13 @@ public class MusicInfoServiceImpl implements IMusicInfoService
return null;
}
@Override
public MusicInfo selectUserLikeMusic(String musicId, Long userId) {
MusicInfo musicInfo = musicInfoMapper.selectUserLikeMusic(musicId, userId);
if (musicInfo != null){
musicInfo.setLike(true);
return musicInfo;
}
return new MusicInfo();
}
}

View File

@@ -19,12 +19,12 @@ import java.util.stream.Collectors;
/**
* 推荐Service业务层处理
*
*
* @author ruoyi
* @date 2025-07-15
*/
@Service
public class RecommendInfoServiceImpl implements IRecommendInfoService
public class RecommendInfoServiceImpl implements IRecommendInfoService
{
@Autowired
private RecommendInfoMapper recommendInfoMapper;
@@ -35,7 +35,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 查询推荐
*
*
* @param id 推荐主键
* @return 推荐
*/
@@ -47,7 +47,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 查询推荐列表
*
*
* @param recommendInfo 推荐
* @return 推荐
*/
@@ -59,7 +59,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 新增推荐
*
*
* @param recommendInfo 推荐
* @return 结果
*/
@@ -73,7 +73,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 修改推荐
*
*
* @param recommendInfo 推荐
* @return 结果
*/
@@ -86,7 +86,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 批量删除推荐
*
*
* @param ids 需要删除的推荐主键
* @return 结果
*/
@@ -99,7 +99,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
/**
* 删除推荐信息
*
*
* @param id 推荐主键
* @return 结果
*/

View File

@@ -17,12 +17,12 @@ import java.util.stream.Collectors;
/**
* 用户收藏音乐Service业务层处理
*
*
* @author ruoyi
* @date 2025-07-15
*/
@Service
public class UserCollectServiceImpl implements IUserCollectService
public class UserCollectServiceImpl implements IUserCollectService
{
@Autowired
private UserCollectMapper userCollectMapper;
@@ -31,7 +31,7 @@ public class UserCollectServiceImpl implements IUserCollectService
/**
* 查询用户收藏音乐
*
*
* @param id 用户收藏音乐主键
* @return 用户收藏音乐
*/
@@ -43,7 +43,7 @@ public class UserCollectServiceImpl implements IUserCollectService
/**
* 查询用户收藏音乐列表
*
*
* @param userCollect 用户收藏音乐
* @return 用户收藏音乐
*/
@@ -58,7 +58,7 @@ public class UserCollectServiceImpl implements IUserCollectService
if (!collectIdList.isEmpty()) {
List<Map<String, Object>> collectNums = userCollectMapper.selectNumUserCollectIdList(collectIdList);
// 将查询到的歌单音乐数量设置到对应的UserCollect对象中
list.forEach(item -> {
Map<String, Object> collectNum = collectNums.stream()
@@ -73,7 +73,7 @@ public class UserCollectServiceImpl implements IUserCollectService
/**
* 新增用户收藏音乐
*
*
* @param userCollect 用户收藏音乐
* @return 结果
*/
@@ -89,7 +89,7 @@ public class UserCollectServiceImpl implements IUserCollectService
/**
* 修改用户收藏音乐
*
*
* @param userCollect 用户收藏音乐
* @return 结果
*/
@@ -102,19 +102,21 @@ public class UserCollectServiceImpl implements IUserCollectService
/**
* 批量删除用户收藏音乐
*
*
* @param ids 需要删除的用户收藏音乐主键
* @return 结果
*/
@Override
public int deleteUserCollectByIds(Long[] ids)
{
// 删除关联
musicCollectMapper.deleteMusicCollectByCollectIds(ids);
return userCollectMapper.deleteUserCollectByIds(ids);
}
/**
* 删除用户收藏音乐信息
*
*
* @param id 用户收藏音乐主键
* @return 结果
*/

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.MusicCollectMapper">
<resultMap type="MusicCollect" id="MusicCollectResult">
<result property="id" column="id" />
<result property="musicId" column="music_id" />
@@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMusicCollectList" parameterType="MusicCollect" resultMap="MusicCollectResult">
<include refid="selectMusicCollectVo"/>
<where>
<where>
<if test="musicId != null "> and music_id = #{musicId}</if>
<if test="collectId != null "> and collect_id = #{collectId}</if>
</where>
</select>
<select id="selectMusicCollectById" parameterType="String" resultMap="MusicCollectResult">
<include refid="selectMusicCollectVo"/>
where id = #{id}
@@ -69,4 +69,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCollectIdAndMusicId" resultMap="MusicCollectResult">
SELECT * FROM music_collect where music_id=#{musicId} and collect_id=#{collectId}
</select>
</mapper>
<delete id="deleteMusicCollectByCollectIds">
delete from music_collect where collect_id in
<foreach item="collectId" collection="array" open="(" separator="," close=")">
#{collectId}
</foreach>
</delete>
</mapper>

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.MusicInfoMapper">
<resultMap type="MusicInfo" id="MusicInfoResult">
<result property="id" column="id" />
<result property="musicId" column="music_id" />
@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMusicInfoList" parameterType="MusicInfo" resultMap="MusicInfoResult">
<include refid="selectMusicInfoVo"/>
<where>
<where>
<if test="musicId != null "> and music_id = #{musicId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="author != null and author != ''"> and author = #{author}</if>
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="label != null and label != ''"> and label = #{label}</if>
</where>
</select>
<select id="selectMusicInfoById" parameterType="String" resultMap="MusicInfoResult">
<include refid="selectMusicInfoVo"/>
where id = #{id}
@@ -116,14 +116,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteMusicInfoByIds" parameterType="String">
delete from music_info where id in
delete from music_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByCate" resultType="com.ruoyi.common.core.domain.entity.MusicInfo">
</select>
<select id="selectMusicInfoByCid" resultMap="MusicInfoResult">
@@ -140,7 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectRecommendMusic" resultMap="MusicInfoResult">
SELECT mi.*,mr.recommend_id FROM music_recommend mr LEFT JOIN music_info mi on mr.music_id = mi.music_id and mi.is_del=0
SELECT mi.*,mr.recommend_id FROM music_recommend mr
LEFT JOIN music_info mi on mr.music_id = mi.music_id and mi.is_del=0
</select>
<select id="selectMusicByCollectId" resultMap="MusicInfoResult">
@@ -192,14 +193,14 @@ 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
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>
<select id="selectMusicInfoBySearch" resultMap="MusicInfoResult">
<include refid="selectMusicInfoVo"/>
WHERE (name LIKE concat(#{search}, '%') OR author LIKE concat(#{search}, '%'))
@@ -207,10 +208,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectListRandomMusic" resultType="java.lang.String">
SELECT music_info.music_id from music_info where music_id != #{currentMusicId} ORDER BY RAND() LIMIT 1
SELECT music_info.music_id from music_info where music_id != #{currentMusicId} and music_type != 'mixing' ORDER BY RAND() LIMIT 1
</select>
<select id="selectMusicAndUserLike" 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} limit 1
</select>
</mapper>
<select id="selectUserLikeMusic" resultMap="MusicInfoResult">
SELECT * FROM user_like_music where user_id= #{userId} and music_id= #{musicId}
</select>
</mapper>

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.MusicRecommendMapper">
<resultMap type="MusicRecommend" id="MusicRecommendResult">
<result property="id" column="id" />
<result property="recommendId" column="recommend_id" />
@@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMusicRecommendList" parameterType="MusicRecommend" resultMap="MusicRecommendResult">
<include refid="selectMusicRecommendVo"/>
<where>
<where>
<if test="recommendId != null "> and recommend_id = #{recommendId}</if>
<if test="musicId != null "> and music_id = #{musicId}</if>
</where>
</select>
<select id="selectMusicRecommendById" parameterType="String" resultMap="MusicRecommendResult">
<include refid="selectMusicRecommendVo"/>
where id = #{id}
@@ -53,9 +53,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteMusicRecommendByIds" parameterType="String">
delete from music_recommend where id in
delete from music_recommend where recommend_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>