推荐部分
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user