完善功能
This commit is contained in:
@@ -8,12 +8,10 @@ import com.ruoyi.common.core.domain.entity.BannerInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.config.AliConfig;
|
||||
import com.ruoyi.system.service.IBannerInfoService;
|
||||
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;
|
||||
@@ -66,24 +64,9 @@ public class BackIndexController extends BaseController {
|
||||
//@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
//@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("sort") int sort,
|
||||
@RequestParam("jumpUrl") String jumpUrl,
|
||||
@RequestParam("file") MultipartFile file
|
||||
) {
|
||||
public AjaxResult add(@RequestBody BannerInfo bannerInfo) {
|
||||
// 1. 处理文件上传
|
||||
if (file != null && !file.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
// String url = fileService.save(file);
|
||||
// bannerInfo.setImageUrl(url);
|
||||
}
|
||||
// 2. 保存bannerInfo
|
||||
BannerInfo bannerInfo = new BannerInfo();
|
||||
bannerInfo.setSort(sort);
|
||||
bannerInfo.setJumpUrl(jumpUrl);
|
||||
bannerInfo.setName(name);
|
||||
return toAjax(bannerInfoService.insertBannerInfo(bannerInfo,file));
|
||||
return toAjax(bannerInfoService.insertBannerInfo(bannerInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,12 +84,11 @@ public class CategoryInfoController extends BaseController
|
||||
// @PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
// @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("name") String name) throws IOException {
|
||||
String imgAddr = AliConfig.ossUp("config/", file.getOriginalFilename(), file.getInputStream());
|
||||
CategoryInfo categoryInfo = new CategoryInfo();
|
||||
categoryInfo.setBackImg(imgAddr);
|
||||
categoryInfo.setName(name);
|
||||
public AjaxResult add(@RequestBody CategoryInfo categoryInfo) throws IOException {
|
||||
// String imgAddr = AliConfig.ossUp("config/", file.getOriginalFilename(), file.getInputStream());
|
||||
// CategoryInfo categoryInfo = new CategoryInfo();
|
||||
// categoryInfo.setBackImg(imgAddr);
|
||||
// categoryInfo.setName(name);
|
||||
return toAjax(categoryInfoService.insertCategoryInfo(categoryInfo));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,103 @@
|
||||
package com.ruoyi.web.controller.back;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.ShopUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.MusicUtil;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.config.AliConfig;
|
||||
import com.ruoyi.system.mapper.MusicInfoMapper;
|
||||
import com.ruoyi.system.mapper.ShopUserMapper;
|
||||
import com.ruoyi.system.service.ShopUserService;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RequestMapping("/file")
|
||||
@RestController
|
||||
public class FileController {
|
||||
public class FileController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ShopUserMapper shopUserMapper;
|
||||
@Autowired
|
||||
private SysUserPostMapper sysUserPostMapper;
|
||||
@Autowired
|
||||
private MusicInfoMapper musicInfoMapper;
|
||||
|
||||
/**
|
||||
* 下载OSS文件
|
||||
*/
|
||||
@GetMapping("/download/{objectName}")
|
||||
public void downloadOssFile(@PathVariable String objectName, HttpServletResponse response) {
|
||||
@GetMapping("/download/{objectName}/{fileName}")
|
||||
public void downloadOssFile(@RequestParam(value = "musicId",required = false) String musicId, @PathVariable("objectName") String objectName, @PathVariable("fileName") String fileName, HttpServletResponse response) {
|
||||
try {
|
||||
String ossPath = objectName.split("file/download")[1];
|
||||
String ossPath = objectName + "/" + fileName;
|
||||
// 检查用户登录状态
|
||||
|
||||
// 获取文件字节
|
||||
if (objectName.equals("musicFile")) {
|
||||
//TODO:// 获取是否是vip 音乐,检查用户登录状态
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
ShopUser shopUser = shopUserMapper.selectShopUserByUserId(userId);
|
||||
MusicInfo musicInfo = musicInfoMapper.selectByPath(objectName);
|
||||
if (musicInfo.getVip() != null && musicInfo.getVip() == 1) {
|
||||
// 判断用户vip
|
||||
if (!MusicUtil.getShopIsVip(shopUser)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
LoginUser userInfo = SecurityUtils.getLoginUser();
|
||||
SysUser sysUser = userInfo.getUser();
|
||||
if (sysUser == null) {
|
||||
if (StrUtil.isBlank(musicId)) {
|
||||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":400,\"msg\":\"音乐ID不能为空\"}");
|
||||
return;
|
||||
}
|
||||
ShopUser shopUser = userInfo.getShopUser();
|
||||
if (shopUser == null) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||
return;
|
||||
}
|
||||
//shopUser = shopUserMapper.selectShopUserByUserId(userId);
|
||||
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
|
||||
if (musicInfo == null) {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":404,\"msg\":\"音乐信息不存在\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (musicInfo.getVip() != null && musicInfo.getVip() == 1) {
|
||||
// 判断用户vip
|
||||
if (!MusicUtil.getShopIsVip(shopUser)) {
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":403,\"msg\":\"该音乐为VIP专享,请升级VIP后下载\"}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String fileName = ossPath.substring(objectName.lastIndexOf("/") + 1);
|
||||
|
||||
byte[] data = AliConfig.ossDown(ossPath);
|
||||
if (data == null || data.length == 0) {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":404,\"msg\":\"文件不存在或下载失败\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置响应头,支持中文文件名
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
|
||||
assert data != null;
|
||||
response.getOutputStream().write(data);
|
||||
response.getOutputStream().flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
e.printStackTrace();
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"msg\":\"下载失败: " + e.getMessage() + "\"}");
|
||||
response.getWriter().write("{\"code\":500,\"msg\":\"下载失败: " + e.getMessage() + "\"}");
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.MusicInfo;
|
||||
import com.ruoyi.common.core.domain.entity.MusicMaxReq;
|
||||
import com.ruoyi.common.core.domain.entity.MusicScene;
|
||||
import com.ruoyi.common.core.domain.entity.MusicSceneRelate;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@@ -151,11 +152,21 @@ public class MusicInfoController extends BaseController
|
||||
}
|
||||
|
||||
@RequestMapping("/add/mixMusic")
|
||||
public AjaxResult addMixMusicInfo(@RequestBody Map<String,String> param){
|
||||
public AjaxResult addMixMusicInfo(@RequestBody MusicMaxReq param){
|
||||
MusicInfo newMusic = musicInfoService.addMixMusicInfo(param);
|
||||
if (newMusic != null){
|
||||
return AjaxResult.success(newMusic);
|
||||
}
|
||||
return AjaxResult.error("混音错误");
|
||||
}
|
||||
|
||||
// 编辑混音歌曲
|
||||
@RequestMapping("/edit/mixMusic")
|
||||
public AjaxResult editMixMusicInfo(@RequestBody MusicMaxReq param){
|
||||
MusicInfo newMusic = musicInfoService.editMixMusicInfo(param);
|
||||
if (newMusic != null){
|
||||
return AjaxResult.success(newMusic);
|
||||
}
|
||||
return AjaxResult.error("混音错误");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ 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.MusicInfo;
|
||||
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.IMusicInfoService;
|
||||
import com.ruoyi.system.service.IRecommendInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -27,6 +29,8 @@ public class RecommendInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRecommendInfoService recommendInfoService;
|
||||
@Autowired
|
||||
private IMusicInfoService musicInfoService;
|
||||
|
||||
/**
|
||||
* 查询推荐列表
|
||||
@@ -105,4 +109,13 @@ public class RecommendInfoController extends BaseController
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
// 根据推荐获取分类音乐
|
||||
@GetMapping("/music/{reId}")
|
||||
public TableDataInfo geReIdMusic(@PathVariable String reId){
|
||||
startPage();
|
||||
List<MusicInfo> list = musicInfoService.selectMusicInfoByReId(reId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/back/upload")
|
||||
public class UploadOSSController extends BaseController {
|
||||
public class UploadOSSController extends BaseController {
|
||||
|
||||
|
||||
@PostMapping("/music/file")
|
||||
@@ -25,10 +25,10 @@ public class UploadOSSController extends BaseController {
|
||||
// 1. 处理文件上传
|
||||
if (file != null && !file.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
return AjaxResult.error("文件不能为空");
|
||||
return AjaxResult.success("请求成功",AliConfig.ossUp("musicFile/", file.getOriginalFilename(), file.getInputStream()));
|
||||
}
|
||||
|
||||
return AjaxResult.success(AliConfig.ossUp("musicFile/" , file.getOriginalFilename(), file.getInputStream()));
|
||||
return AjaxResult.error("文件不能为空");
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ public class UploadOSSController extends BaseController {
|
||||
) throws IOException {
|
||||
// 1. 处理文件上传
|
||||
if (file != null && !file.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
return AjaxResult.error("文件不能为空");
|
||||
return AjaxResult.success("请求成功",AliConfig.ossUp("musicImg/", file.getOriginalFilename(), file.getInputStream()));
|
||||
}
|
||||
return AjaxResult.success(AliConfig.ossUp("musicImg/" , file.getOriginalFilename(), file.getInputStream()));
|
||||
// 保存文件逻辑
|
||||
return AjaxResult.error("文件不能为空");
|
||||
}
|
||||
|
||||
@PostMapping("/config/file")
|
||||
@@ -51,9 +51,9 @@ public class UploadOSSController extends BaseController {
|
||||
// 1. 处理文件上传
|
||||
if (file != null && !file.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
return AjaxResult.error("文件不能为空");
|
||||
return AjaxResult.success("请求成功",AliConfig.ossUp("config/", file.getOriginalFilename(), file.getInputStream()));
|
||||
}
|
||||
return AjaxResult.success(AliConfig.ossUp("config/" , file.getOriginalFilename(), file.getInputStream()));
|
||||
return AjaxResult.error("文件不能为空");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
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 com.ruoyi.common.core.domain.entity.MusicScene;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
@@ -97,7 +98,7 @@ public class MusicController extends BaseController {
|
||||
|
||||
// 新增用户混音
|
||||
@RequestMapping("/add/mixMusic")
|
||||
public AjaxResult addMixMusicInfo(@RequestBody Map<String,String> param){
|
||||
public AjaxResult addMixMusicInfo(@RequestBody MusicMaxReq param){
|
||||
MusicInfo newMusic = musicService.addMixMusicInfo(param);
|
||||
if (newMusic != null){
|
||||
return AjaxResult.success(newMusic);
|
||||
|
||||
@@ -16,7 +16,7 @@ ruoyi:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8080
|
||||
port: 8081
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class MusicMaxReq extends MusicInfo{
|
||||
|
||||
private String sceneIds;
|
||||
|
||||
private String sceneJson;
|
||||
|
||||
private String sourceMusicId;
|
||||
|
||||
|
||||
}
|
||||
@@ -42,6 +42,9 @@ public class RecommendInfo extends BaseEntity
|
||||
@Excel(name = "描述")
|
||||
private String desc;
|
||||
|
||||
|
||||
private String backImg;
|
||||
|
||||
private List<MusicInfo> musics;
|
||||
|
||||
public void setId(Long id)
|
||||
|
||||
@@ -112,8 +112,8 @@ public class LoginUser implements UserDetails
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
if (userId != null){
|
||||
return userId;
|
||||
if (user != null){
|
||||
return user.getUserId();
|
||||
}else if(shopUser != null){
|
||||
return shopUser.getUserId();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class SecurityUtils
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SecurityConfig
|
||||
/**
|
||||
* 身份验证实现
|
||||
*/
|
||||
@Bean
|
||||
@Bean("authenticationManager")
|
||||
@Primary
|
||||
public AuthenticationManager authenticationManager()
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ public class SysLoginService
|
||||
private TokenService tokenService;
|
||||
|
||||
@Resource
|
||||
@Qualifier("authenticationManager")
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -67,4 +67,5 @@ public interface CategoryInfoMapper
|
||||
int bindMusic(@Param("categoryId") String categoryId,@Param("ids") String[] ids);
|
||||
|
||||
|
||||
int deleteCategoryInfoBycategoryId(String categoryId);
|
||||
}
|
||||
|
||||
@@ -89,4 +89,6 @@ public interface MusicInfoMapper
|
||||
List<MusicInfo> selectRecommendMusicByReId(String reId);
|
||||
|
||||
MusicInfo selectByPath(String path);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByReId(String reId);
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface MusicSceneRelateMapper
|
||||
int insertMusicSceneRelate(MusicSceneRelate musicSceneRelate);
|
||||
|
||||
MusicSceneRelate selectByMusicId(String musicId);
|
||||
|
||||
int deleteByMusicId(Long musicId);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface RecommendInfoMapper
|
||||
|
||||
|
||||
List<RecommendInfo> selectMusicRecommend();
|
||||
|
||||
int deleteRecommendInfoByReId(String reId);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface IBannerInfoService
|
||||
* @param bannerInfo 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBannerInfo(BannerInfo bannerInfo, MultipartFile file);
|
||||
public int insertBannerInfo(BannerInfo bannerInfo);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user