会员
This commit is contained in:
@@ -77,5 +77,13 @@ public interface ShopUserMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserOnlineTime(ShopUser shopUser);
|
||||
|
||||
/**
|
||||
* 查询用户的音乐标签
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 音乐标签列表
|
||||
*/
|
||||
public List<String> selectUserMusicTags(String userId);
|
||||
|
||||
}
|
||||
@@ -69,4 +69,12 @@ public interface IShopUserService
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserOnlineTime(ShopUser shopUser);
|
||||
|
||||
/**
|
||||
* 获取用户标签列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户标签列表(以分号分隔的字符串)
|
||||
*/
|
||||
public String getUserTags(String userId);
|
||||
}
|
||||
|
||||
@@ -156,4 +156,38 @@ public class ShopUserServiceImpl implements IShopUserService
|
||||
|
||||
return shopUserMapper.updateUserOnlineTime(updateUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户标签列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户标签列表(以分号分隔的字符串)
|
||||
*/
|
||||
@Override
|
||||
public String getUserTags(String userId) {
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 查询用户的音乐标签
|
||||
List<String> tagList = shopUserMapper.selectUserMusicTags(userId);
|
||||
|
||||
if (tagList == null || tagList.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 将标签列表转换为分号分隔的字符串
|
||||
StringBuilder tags = new StringBuilder();
|
||||
for (int i = 0; i < tagList.size(); i++) {
|
||||
String tag = tagList.get(i);
|
||||
if (tag != null && !tag.isEmpty()) {
|
||||
tags.append(tag);
|
||||
if (i < tagList.size() - 1) {
|
||||
tags.append(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tags.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,4 +200,13 @@
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 查询用户的音乐标签 -->
|
||||
<select id="selectUserMusicTags" parameterType="String" resultType="String">
|
||||
SELECT mi.label FROM user_history uh
|
||||
LEFT JOIN music_info mi on uh.music_id = mi.music_id
|
||||
LEFT JOIN shop_user su on uh.user_id = su.user_id
|
||||
WHERE su.user_id = #{userId} AND mi.label IS NOT NULL AND mi.label != ''
|
||||
GROUP BY mi.label
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user