推荐部分
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,4 +63,8 @@ public interface CategoryInfoMapper
|
||||
public int deleteCategoryInfoByIds(String[] ids);
|
||||
|
||||
List<CategoryInfo> selectCategoryList();
|
||||
|
||||
int bindMusic(@Param("categoryId") String categoryId,@Param("ids") String[] ids);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -59,4 +60,8 @@ public interface MusicInfoMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMusicInfoByIds(String[] ids);
|
||||
|
||||
MusicInfo selectByCate(CategoryInfo categoryInfo);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByCid(String categoryId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.MusicRecommend;
|
||||
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -59,4 +61,9 @@ public interface RecommendInfoMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecommendInfoByIds(Long[] ids);
|
||||
|
||||
int bindMusic(@Param("reId") String reId,@Param("musicIds") String[] musicIds);
|
||||
|
||||
|
||||
RecommendInfo selectMusicRecommend();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -62,4 +63,7 @@ public interface ICategoryInfoService
|
||||
public int deleteCategoryInfoById(String id);
|
||||
|
||||
List<CategoryInfo> getCategory();
|
||||
|
||||
int bindMusic(String categoryId,String[] ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,7 +36,7 @@ public interface IMusicInfoService
|
||||
* @param musicInfo 音乐信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMusicInfo(MusicInfo musicInfo);
|
||||
public int insertMusicInfo(MusicInfo musicInfo, MultipartFile img,MultipartFile music);
|
||||
|
||||
/**
|
||||
* 修改音乐信息
|
||||
@@ -59,4 +61,8 @@ public interface IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMusicInfoById(String id);
|
||||
|
||||
List<MusicInfo> findMusicByCate(CategoryInfo categoryInfo);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByCid(String categoryId);
|
||||
}
|
||||
|
||||
@@ -59,4 +59,8 @@ public interface IRecommendInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecommendInfoById(Long id);
|
||||
|
||||
int bindMusic(String reId, String[] musicIds);
|
||||
|
||||
RecommendInfo findRecommendMusic();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.mapper.CategoryInfoMapper;
|
||||
import com.ruoyi.system.service.ICategoryInfoService;
|
||||
@@ -54,6 +56,7 @@ public class CategoryInfoServiceImpl implements ICategoryInfoService
|
||||
@Override
|
||||
public int insertCategoryInfo(CategoryInfo categoryInfo)
|
||||
{
|
||||
categoryInfo.setCategoryId(IdUtil.getSnowflakeNextId());
|
||||
categoryInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return categoryInfoMapper.insertCategoryInfo(categoryInfo);
|
||||
}
|
||||
@@ -99,4 +102,11 @@ public class CategoryInfoServiceImpl implements ICategoryInfoService
|
||||
public List<CategoryInfo> getCategory() {
|
||||
return categoryInfoMapper.selectCategoryList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindMusic(String categoryId,String[] ids) {
|
||||
return categoryInfoMapper.bindMusic(categoryId,ids);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.enums.Audio;
|
||||
import com.ruoyi.common.enums.MusicType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.config.AliConfig;
|
||||
import com.ruoyi.system.mapper.MusicInfoMapper;
|
||||
import com.ruoyi.system.service.IMusicInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -52,9 +60,21 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMusicInfo(MusicInfo musicInfo)
|
||||
public int insertMusicInfo(MusicInfo musicInfo, MultipartFile img, MultipartFile music)
|
||||
{
|
||||
musicInfo.setCreateTime(DateUtils.getNowDate());
|
||||
musicInfo.setMusicId(IdUtil.getSnowflakeNextId());
|
||||
try {
|
||||
String imgAddr = AliConfig.ossUp("musicImg/" + img.getOriginalFilename(), img.getInputStream());
|
||||
String musicAddr = AliConfig.ossUp("musicFile/" + music.getOriginalFilename(), music.getInputStream());
|
||||
musicInfo.setMusicAddr(musicAddr);
|
||||
musicInfo.setImgAddr(imgAddr);
|
||||
musicInfo.setMusicType(MusicType.ORDINARY.getMusicType());
|
||||
musicInfo.setCreator(SecurityUtils.getUsername());
|
||||
musicInfo.setShelf(2L);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return musicInfoMapper.insertMusicInfo(musicInfo);
|
||||
}
|
||||
|
||||
@@ -94,4 +114,17 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
{
|
||||
return musicInfoMapper.deleteMusicInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MusicInfo> findMusicByCate(CategoryInfo categoryInfo) {
|
||||
musicInfoMapper.selectByCate(categoryInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MusicInfo> selectMusicInfoByCid(String categoryId) {
|
||||
return musicInfoMapper.selectMusicInfoByCid(categoryId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.mapper.RecommendInfoMapper;
|
||||
import com.ruoyi.system.service.IRecommendInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -54,6 +55,7 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
|
||||
@Override
|
||||
public int insertRecommendInfo(RecommendInfo recommendInfo)
|
||||
{
|
||||
recommendInfo.setCreator(SecurityUtils.getUsername());
|
||||
recommendInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return recommendInfoMapper.insertRecommendInfo(recommendInfo);
|
||||
}
|
||||
@@ -94,4 +96,16 @@ public class RecommendInfoServiceImpl implements IRecommendInfoService
|
||||
{
|
||||
return recommendInfoMapper.deleteRecommendInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindMusic(String reId, String[] musicIds) {
|
||||
return recommendInfoMapper.bindMusic(reId,musicIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecommendInfo findRecommendMusic() {
|
||||
RecommendInfo recommendInfo = recommendInfoMapper.selectMusicRecommend();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectCategoryList" resultType="com.ruoyi.common.core.domain.entity.CategoryInfo">
|
||||
<select id="selectCategoryList" resultMap="CategoryInfoResult">
|
||||
<include refid="selectCategoryInfoVo" /> where is_del = 0
|
||||
</select>
|
||||
|
||||
<insert id="bindMusic">
|
||||
insert into music_category(music_id,category_id) values
|
||||
<foreach item="id" collection="ids" separator=",">
|
||||
(#{id},#{categoryId})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -116,4 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectByCate" resultType="com.ruoyi.common.core.domain.entity.MusicInfo">
|
||||
|
||||
</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>
|
||||
</mapper>
|
||||
@@ -83,4 +83,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="bindMusic">
|
||||
insert into music_recommend(recommend_id,music_id) values
|
||||
<foreach item="id" collection="musicIds" separator=",">
|
||||
(#{id},#{reId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<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>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user