推荐部分
This commit is contained in:
@@ -66,8 +66,8 @@ public class CategoryInfoController extends BaseController
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
// @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CategoryInfo categoryInfo)
|
||||
{
|
||||
@@ -95,4 +95,16 @@ public class CategoryInfoController extends BaseController
|
||||
{
|
||||
return toAjax(categoryInfoService.deleteCategoryInfoByIds(ids));
|
||||
}
|
||||
|
||||
@PutMapping("/bind/{categoryId}/{ids}")
|
||||
public AjaxResult bindMusic(@PathVariable String categoryId,@PathVariable String[] ids){
|
||||
int insertCount = categoryInfoService.bindMusic(categoryId,ids);
|
||||
if (insertCount > 0){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.back;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.BannerInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
@@ -11,6 +12,7 @@ import com.ruoyi.system.service.IMusicInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
@@ -31,7 +33,7 @@ public class MusicInfoController extends BaseController
|
||||
/**
|
||||
* 查询音乐信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:list')")
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MusicInfo musicInfo)
|
||||
{
|
||||
@@ -63,22 +65,22 @@ public class MusicInfoController extends BaseController
|
||||
return success(musicInfoService.selectMusicInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增音乐信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
@Log(title = "音乐信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MusicInfo musicInfo)
|
||||
{
|
||||
return toAjax(musicInfoService.insertMusicInfo(musicInfo));
|
||||
}
|
||||
// /**
|
||||
// * 新增音乐信息
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
// @Log(title = "音乐信息", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody MusicInfo musicInfo)
|
||||
// {
|
||||
// return toAjax(musicInfoService.insertMusicInfo(musicInfo));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改音乐信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:edit')")
|
||||
@Log(title = "音乐信息", businessType = BusinessType.UPDATE)
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:edit')")
|
||||
// @Log(title = "音乐信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MusicInfo musicInfo)
|
||||
{
|
||||
@@ -95,4 +97,51 @@ public class MusicInfoController extends BaseController
|
||||
{
|
||||
return toAjax(musicInfoService.deleteMusicInfoByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CREATE TABLE `music_info` (
|
||||
* `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
* `music_id` bigint DEFAULT NULL COMMENT '音乐id',
|
||||
* `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名字',
|
||||
* `author` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '作者',
|
||||
* `vip` int DEFAULT NULL COMMENT '1 vip 2 不',
|
||||
* `shelf` int DEFAULT NULL COMMENT '1 商家 2 下架',
|
||||
* `img_addr` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '封面',
|
||||
* `music_addr` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '音乐地址',
|
||||
* `music_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '音乐类型 ordinary 混音mixing',
|
||||
* `creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人',
|
||||
* `modify` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改人',
|
||||
* `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
* `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
* `is_del` int DEFAULT '0' COMMENT '1 删除',
|
||||
* `label` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签',
|
||||
* PRIMARY KEY (`id`) USING BTREE
|
||||
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='音乐信息表';
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
//@Log(title = "音乐信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addMusic")
|
||||
public AjaxResult add(
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("author") String author,
|
||||
@RequestParam("vip") long vip,
|
||||
@RequestParam("label") String label,
|
||||
@RequestParam("img") MultipartFile img,
|
||||
@RequestParam("music") MultipartFile music
|
||||
) {
|
||||
// 1. 处理文件上传
|
||||
if (music != null && !music.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
// String url = fileService.save(file);
|
||||
// bannerInfo.setImageUrl(url);
|
||||
}
|
||||
// 2. 保存bannerInfo
|
||||
MusicInfo musicInfo = new MusicInfo();
|
||||
musicInfo.setName(name);
|
||||
musicInfo.setAuthor(author);
|
||||
musicInfo.setVip(vip);
|
||||
musicInfo.setLabel(label);
|
||||
return toAjax(musicInfoService.insertMusicInfo(musicInfo,img,music));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ public class RecommendInfoController extends BaseController
|
||||
/**
|
||||
* 新增推荐
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
@Log(title = "推荐", businessType = BusinessType.INSERT)
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
// @Log(title = "推荐", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RecommendInfo recommendInfo)
|
||||
{
|
||||
@@ -95,4 +95,14 @@ public class RecommendInfoController extends BaseController
|
||||
{
|
||||
return toAjax(recommendInfoService.deleteRecommendInfoByIds(ids));
|
||||
}
|
||||
|
||||
// 绑定推荐音乐
|
||||
@PutMapping("/bind/{reId}/{musicIds}")
|
||||
public AjaxResult bindMusic(@PathVariable String reId,@PathVariable String[] musicIds){
|
||||
int insertCount = recommendInfoService.bindMusic(reId,musicIds);
|
||||
if (insertCount > 0){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,36 @@
|
||||
package com.ruoyi.web.controller.client;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.service.IBannerInfoService;
|
||||
import com.ruoyi.system.service.ICategoryInfoService;
|
||||
import com.ruoyi.system.service.IMusicInfoService;
|
||||
import com.ruoyi.system.service.IRecommendInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RequestMapping("/client/index")
|
||||
@RestController
|
||||
public class IndexController {
|
||||
public class IndexController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBannerInfoService bannerInfoService;
|
||||
@Autowired
|
||||
private ICategoryInfoService categoryInfoService;
|
||||
@Autowired
|
||||
private IMusicInfoService musicInfoService;
|
||||
@Autowired
|
||||
private IRecommendInfoService recommendInfoService;
|
||||
|
||||
/**
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
@@ -33,6 +47,19 @@ public class IndexController {
|
||||
return AjaxResult.success(categoryInfoService.getCategory());
|
||||
}
|
||||
|
||||
// 根据分类获取分类音乐
|
||||
@GetMapping("/cate/music/{categoryId}")
|
||||
public TableDataInfo getCategoryMusic(@PathVariable String categoryId){
|
||||
startPage();
|
||||
List<MusicInfo> list = musicInfoService.selectMusicInfoByCid(categoryId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// 获取推荐绑定音乐
|
||||
public RecommendInfo getRecommendMusic(){
|
||||
recommendInfoService.findRecommendMusic();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.ruoyi.web.controller.client;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||
import com.ruoyi.system.service.IMusicInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -14,8 +16,9 @@ public class MusicController {
|
||||
private IMusicInfoService musicService;
|
||||
|
||||
// 根据分类获取音乐
|
||||
public void getMusicByCate(){
|
||||
|
||||
@RequestMapping("/cate/music")
|
||||
public void getMusicByCate(@RequestBody CategoryInfo categoryInfo){
|
||||
musicService.findMusicByCate(categoryInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推荐对象 recommend_info
|
||||
*
|
||||
@@ -38,6 +40,8 @@ public class RecommendInfo extends BaseEntity
|
||||
@Excel(name = "描述")
|
||||
private String desc;
|
||||
|
||||
private List<MusicInfo> musics;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
@@ -156,9 +156,10 @@ public class LoginUser implements UserDetails
|
||||
{
|
||||
if (user != null){
|
||||
return user.getUserName();
|
||||
}else {
|
||||
}else if (shopUser != null){
|
||||
return shopUser.getUsername();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MusicType {
|
||||
|
||||
ORDINARY("ordinary","普通"),
|
||||
MIXING("mixing","混音"),
|
||||
|
||||
;
|
||||
//音乐类型 ordinary 混音mixing
|
||||
public final String musicType;
|
||||
public final String desc;
|
||||
|
||||
|
||||
}
|
||||
@@ -62,7 +62,8 @@ public class SecurityUtils
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
|
||||
//throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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