完善功能

This commit is contained in:
menxipeng
2025-08-02 23:10:35 +08:00
parent 7be046e8f5
commit 58e70a009d
32 changed files with 224 additions and 82 deletions

View File

@@ -67,4 +67,5 @@ public interface CategoryInfoMapper
int bindMusic(@Param("categoryId") String categoryId,@Param("ids") String[] ids);
int deleteCategoryInfoBycategoryId(String categoryId);
}

View File

@@ -89,4 +89,6 @@ public interface MusicInfoMapper
List<MusicInfo> selectRecommendMusicByReId(String reId);
MusicInfo selectByPath(String path);
List<MusicInfo> selectMusicInfoByReId(String reId);
}

View File

@@ -16,4 +16,6 @@ public interface MusicSceneRelateMapper
int insertMusicSceneRelate(MusicSceneRelate musicSceneRelate);
MusicSceneRelate selectByMusicId(String musicId);
int deleteByMusicId(Long musicId);
}

View File

@@ -66,4 +66,6 @@ public interface RecommendInfoMapper
List<RecommendInfo> selectMusicRecommend();
int deleteRecommendInfoByReId(String reId);
}

View File

@@ -1,6 +1,8 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysUserPost;
/**
@@ -41,4 +43,6 @@ public interface SysUserPostMapper
* @return 结果
*/
public int batchUserPost(List<SysUserPost> userPostList);
SysUser selectShopUserByUserId(Long userId);
}

View File

@@ -36,7 +36,7 @@ public interface IBannerInfoService
* @param bannerInfo 【请填写功能名称】
* @return 结果
*/
public int insertBannerInfo(BannerInfo bannerInfo, MultipartFile file);
public int insertBannerInfo(BannerInfo bannerInfo);
/**
* 修改【请填写功能名称】

View File

@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.CategoryInfo;
import com.ruoyi.common.core.domain.entity.MusicInfo;
import com.ruoyi.common.core.domain.entity.MusicMaxReq;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -81,5 +82,9 @@ public interface IMusicInfoService
MusicInfo getMusicInfo(Long userId, String musicId);
MusicInfo addMixMusicInfo(Map<String, String> param);
MusicInfo addMixMusicInfo(MusicMaxReq param);
MusicInfo editMixMusicInfo(MusicMaxReq param);
List<MusicInfo> selectMusicInfoByReId(String reId);
}

View File

@@ -55,14 +55,7 @@ public class BannerInfoServiceImpl implements IBannerInfoService
* @return 结果
*/
@Override
public int insertBannerInfo(BannerInfo bannerInfo, MultipartFile file){
bannerInfo.setCreateTime(DateUtils.getNowDate());
try {
String addr = AliConfig.ossUp("config/" , file.getOriginalFilename(), file.getInputStream());
bannerInfo.setBannerAddr(addr);
} catch (IOException e) {
throw new RuntimeException(e);
}
public int insertBannerInfo(BannerInfo bannerInfo){
//上传文件
return bannerInfoMapper.insertBannerInfo(bannerInfo);
}

View File

@@ -105,6 +105,8 @@ public class CategoryInfoServiceImpl implements ICategoryInfoService
@Override
public int bindMusic(String categoryId,String[] ids) {
// 先删除再绑定
categoryInfoMapper.deleteCategoryInfoBycategoryId(categoryId);
return categoryInfoMapper.bindMusic(categoryId,ids);
}

View File

@@ -202,20 +202,21 @@ public class MusicInfoServiceImpl implements IMusicInfoService
}
@Override
public MusicInfo addMixMusicInfo(Map<String, String> param) {
public MusicInfo addMixMusicInfo(MusicMaxReq param) {
//TODO:
// Long userId = SecurityUtils.getUserId();
Long userId = 10000L;
String musicId = param.get("musicId");
String sceneIds = param.get("sceneIds");
String sceneJson = param.get("sceneJson");
String musicId = String.valueOf(param.getMusicId());
String sceneIds = param.getSceneIds();
String sceneJson = param.getSceneJson();
// 新增混音音乐标签
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
if (musicInfo != null){
long newMusicId = IdUtil.getSnowflakeNextId();
musicInfo.setMusicId(newMusicId);
musicInfo.setMusicType(MusicType.MIXING.getMusicType());
musicInfoMapper.insertMusicInfo(musicInfo);
param.setMusicId(newMusicId);
param.setMusicType(MusicType.MIXING.getMusicType());
param.setMusicAddr(musicInfo.getMusicAddr());
musicInfoMapper.insertMusicInfo(param);
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
musicSceneRelate.setMusicId(String.valueOf(newMusicId));
musicSceneRelate.setSceneIds(sceneIds);
@@ -228,6 +229,37 @@ public class MusicInfoServiceImpl implements IMusicInfoService
return null;
}
@Override
public MusicInfo editMixMusicInfo(MusicMaxReq param) {
Long userId = 10000L;
Long musicId = param.getMusicId();
String sceneIds = param.getSceneIds();
String sceneJson = param.getSceneJson();
String sourceMusicId = param.getSourceMusicId();
// 查询混音音乐
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(String.valueOf(musicId));
if (musicInfo != null){
// 先删除在新增
relateMapper.deleteByMusicId(musicId);
//musicSceneMapper.selectMusicSceneById()
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
musicInfoMapper.updateMusicInfo(param);
musicSceneRelate.setMusicId(String.valueOf(musicId));
musicSceneRelate.setSceneIds(sceneIds);
musicSceneRelate.setUserId(userId);
musicSceneRelate.setSceneInfo(sceneJson);
musicSceneRelate.setSourceMusicId(sourceMusicId);
relateMapper.insertMusicSceneRelate(musicSceneRelate);
return musicInfo;
}
return null;
}
@Override
public List<MusicInfo> selectMusicInfoByReId(String reId) {
return musicInfoMapper.selectMusicInfoByReId(reId);
}
//TODO: 待完善
public Map<String, String> getMixMusicInfo(String musicId){

View File

@@ -110,6 +110,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
@Override
public int bindMusic(String reId, String[] musicIds) {
recommendInfoMapper.deleteRecommendInfoByReId(reId);
return recommendInfoMapper.bindMusic(reId,musicIds);
}

View File

@@ -23,6 +23,7 @@
<if test="sort != null "> and sort = #{sort}</if>
<if test="jumpUrl != null and jumpUrl != ''"> and jump_url = #{jumpUrl}</if>
</where>
order by id desc
</select>
<select id="selectBannerInfoById" parameterType="String" resultMap="BannerInfoResult">

View File

@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="modify != null and modify != ''"> and modify = #{modify}</if>
</where>
order by id desc
</select>
<select id="selectCategoryInfoById" parameterType="String" resultMap="CategoryInfoResult">
@@ -65,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="name != null">name = #{name},</if>
<if test="backImg != null">back_img =#{backImg},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -97,4 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<delete id="deleteCategoryInfoBycategoryId">
DELETE FROM music_category where category_id =#{categoryId}
</delete>
</mapper>

View File

@@ -182,4 +182,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByPath" resultMap="MusicInfoResult">
<include refid="selectMusicInfoVo" /> where music_addr=#{path} and is_del=0
</select>
<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>
</mapper>

View File

@@ -24,4 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByMusicId" resultMap="MusicSceneRelateResult">
select * from music_scene_relate where music_id = #{musicId}
</select>
<delete id="deleteByMusicId">
delete from music_scene_relate where music_id=#{musicId}
</delete>
</mapper>

View File

@@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="desc" column="desc" />
<result property="backImg" column="back_img" />
</resultMap>
<sql id="selectRecommendInfoVo">
select id, name, creator, modify, create_time, update_time, is_del, `desc` from recommend_info
select id, name, creator, modify, create_time, update_time, is_del,back_img, `desc` from recommend_info
</sql>
<select id="selectRecommendInfoList" parameterType="RecommendInfo" resultMap="RecommendInfoResult">
@@ -28,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
</where>
order by id desc
</select>
<select id="selectRecommendInfoById" parameterType="Long" resultMap="RecommendInfoResult">
@@ -45,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="desc != null">desc,</if>
<if test="desc != null">`desc`,</if>
<if test="backImg != null">back_img,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="desc != null">#{desc},</if>
<if test="backImg != null">#{backImg}</if>
</trim>
</insert>
@@ -69,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="desc != null">desc = #{desc},</if>
<if test="backImg != null">back_img = #{backImg},</if>
</trim>
where id = #{id}
</update>
@@ -94,4 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMusicRecommend" resultMap="RecommendInfoResult">
SELECT ri.* FROM music_recommend mr LEFT JOIN recommend_info ri on mr.recommend_id = ri.id and ri.is_del=0
</select>
<delete id="deleteRecommendInfoByReId">
DELETE FROM music_recommend where recommend_id=#{reId}
</delete>
</mapper>

View File

@@ -30,5 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>
<select id="selectShopUserByUserId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
select * from sys_user where user_id = #{userId}
</select>
</mapper>

View File

@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
order by id desc
</select>
<select id="selectTagById" parameterType="String" resultMap="TagResult">