咨询等功能完善
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
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.ConsultInfo;
|
||||
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.IConsultInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 咨询列Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/info")
|
||||
public class ConsultInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IConsultInfoService consultInfoService;
|
||||
|
||||
/**
|
||||
* 查询咨询列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ConsultInfo consultInfo)
|
||||
{
|
||||
startPage();
|
||||
List<ConsultInfo> list = consultInfoService.selectConsultInfoList(consultInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出咨询列列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:export')")
|
||||
@Log(title = "咨询列", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ConsultInfo consultInfo)
|
||||
{
|
||||
List<ConsultInfo> list = consultInfoService.selectConsultInfoList(consultInfo);
|
||||
ExcelUtil<ConsultInfo> util = new ExcelUtil<ConsultInfo>(ConsultInfo.class);
|
||||
util.exportExcel(response, list, "咨询列数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取咨询列详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(consultInfoService.selectConsultInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增咨询列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
@Log(title = "咨询列", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ConsultInfo consultInfo)
|
||||
{
|
||||
return toAjax(consultInfoService.insertConsultInfo(consultInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改咨询列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:edit')")
|
||||
@Log(title = "咨询列", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ConsultInfo consultInfo)
|
||||
{
|
||||
return toAjax(consultInfoService.updateConsultInfo(consultInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除咨询列
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:remove')")
|
||||
@Log(title = "咨询列", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(consultInfoService.deleteConsultInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class IndexController extends BaseController {
|
||||
return AjaxResult.success(categoryInfoService.getCategory());
|
||||
}
|
||||
|
||||
// 根据分类获取分类音乐
|
||||
// 根据分类获取分类音乐 TODO: 分类播放
|
||||
@GetMapping("/cate/music/{categoryId}")
|
||||
public TableDataInfo getCategoryMusic(@PathVariable String categoryId){
|
||||
startPage();
|
||||
@@ -68,7 +68,7 @@ public class IndexController extends BaseController {
|
||||
}
|
||||
|
||||
@GetMapping("/re/music/{reId}")
|
||||
// 获取推荐音乐
|
||||
// 获取推荐音乐 TODO: 推荐播放
|
||||
public TableDataInfo getRecommendMusicByReId(@PathVariable String reId){
|
||||
startPage();
|
||||
List<MusicInfo> list = recommendInfoService.findRecommendMusicByReId(reId);
|
||||
|
||||
@@ -34,9 +34,9 @@ public class MusicController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
// 创建歌单
|
||||
// 获取收藏音乐 TODO: 收藏播放
|
||||
@RequestMapping("/collect/music/{collectId}")
|
||||
public TableDataInfo createPlaylist(@PathVariable String collectId){
|
||||
public TableDataInfo collectPlaylist(@PathVariable String collectId){
|
||||
startPage();
|
||||
List<MusicInfo> list = musicService.findMusicByCollectId(collectId);
|
||||
//musicService.createPlaylist();
|
||||
@@ -51,7 +51,7 @@ public class MusicController extends BaseController {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
// 获取我喜欢的音乐
|
||||
// 获取我喜欢的音乐 TODO: 喜欢播放
|
||||
@RequestMapping("/like/music")
|
||||
public TableDataInfo likeMusic(){
|
||||
startPage();
|
||||
@@ -74,7 +74,7 @@ public class MusicController extends BaseController {
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
|
||||
// 查询历史
|
||||
// 查询历史 TODO: 历史播放
|
||||
@RequestMapping("/history/music")
|
||||
public TableDataInfo historyMusic(){
|
||||
startPage();
|
||||
@@ -116,4 +116,28 @@ public class MusicController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取下一首播放的音乐ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param reId 推荐ID,当playlistType=3时必填
|
||||
* @param currentMusicId 当前播放的音乐ID,用于顺序播放时获取下一首
|
||||
* @return 下一首音乐ID
|
||||
*/
|
||||
@GetMapping("/getNextMusicId")
|
||||
public AjaxResult getNextMusicId(@RequestParam(defaultValue = "1") Integer playMode,
|
||||
@RequestParam Integer playlistType,
|
||||
@RequestParam(required = false) String categoryId,
|
||||
@RequestParam(required = false) String collectId,
|
||||
@RequestParam(required = false) String reId,
|
||||
@RequestParam(required = false) String currentMusicId){
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
String nextMusicId = musicService.getNextMusicId(userId, playMode, playlistType, categoryId, collectId, reId,currentMusicId);
|
||||
return AjaxResult.success("请求成功",nextMusicId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ spring:
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
max-file-size: 500MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
max-request-size: 1000MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
@@ -139,3 +139,4 @@ umApp:
|
||||
appAliSecret: v4UrIhhLZlo0adpmevyCfvThGFbrRer0
|
||||
androidKey: 687b2df479267e0210b79b6f
|
||||
IOSKey: 687b2e1679267e0210b79b70
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 咨询列对象 consult_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class ConsultInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private String id;
|
||||
|
||||
/** 文章名称 */
|
||||
@Excel(name = "文章名称")
|
||||
private String title;
|
||||
|
||||
/** 子标题 */
|
||||
@Excel(name = "子标题")
|
||||
private String subTitle;
|
||||
|
||||
/** 封面图片 */
|
||||
@Excel(name = "封面图片")
|
||||
private String bannerImg;
|
||||
|
||||
/** 轮播图片 */
|
||||
@Excel(name = "轮播图片")
|
||||
private String rotaImg;
|
||||
|
||||
/** 正文 */
|
||||
@Excel(name = "正文")
|
||||
private String content;
|
||||
|
||||
/** 作者 */
|
||||
@Excel(name = "作者")
|
||||
private String author;
|
||||
|
||||
/** 1 删除 */
|
||||
@Excel(name = "1 删除")
|
||||
private Long isDel;
|
||||
|
||||
}
|
||||
@@ -62,4 +62,7 @@ public class ShareInfo extends BaseEntity
|
||||
|
||||
private String musicAuthor;
|
||||
|
||||
|
||||
private String musicType;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.ConsultInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 咨询列Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
public interface ConsultInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询咨询列
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 咨询列
|
||||
*/
|
||||
public ConsultInfo selectConsultInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询咨询列列表
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 咨询列集合
|
||||
*/
|
||||
public List<ConsultInfo> selectConsultInfoList(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 新增咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConsultInfo(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 修改咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConsultInfo(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 删除咨询列
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConsultInfoById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除咨询列
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConsultInfoByIds(String[] ids);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.ConsultInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 咨询列Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
public interface IConsultInfoService
|
||||
{
|
||||
/**
|
||||
* 查询咨询列
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 咨询列
|
||||
*/
|
||||
public ConsultInfo selectConsultInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询咨询列列表
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 咨询列集合
|
||||
*/
|
||||
public List<ConsultInfo> selectConsultInfoList(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 新增咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConsultInfo(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 修改咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConsultInfo(ConsultInfo consultInfo);
|
||||
|
||||
/**
|
||||
* 批量删除咨询列
|
||||
*
|
||||
* @param ids 需要删除的咨询列主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConsultInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除咨询列信息
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConsultInfoById(String id);
|
||||
}
|
||||
@@ -87,4 +87,17 @@ public interface IMusicInfoService
|
||||
MusicInfo editMixMusicInfo(MusicMaxReq param);
|
||||
|
||||
List<MusicInfo> selectMusicInfoByReId(String reId);
|
||||
|
||||
/**
|
||||
* 获取下一首播放的音乐ID
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param currentMusicId 当前播放的音乐ID,用于顺序播放时获取下一首
|
||||
* @return 下一首音乐ID
|
||||
*/
|
||||
String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId,String reId, String currentMusicId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.ConsultInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.mapper.ConsultInfoMapper;
|
||||
import com.ruoyi.system.service.IConsultInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 咨询列Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Service
|
||||
public class ConsultInfoServiceImpl implements IConsultInfoService
|
||||
{
|
||||
@Autowired
|
||||
private ConsultInfoMapper consultInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询咨询列
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 咨询列
|
||||
*/
|
||||
@Override
|
||||
public ConsultInfo selectConsultInfoById(String id)
|
||||
{
|
||||
return consultInfoMapper.selectConsultInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询咨询列列表
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 咨询列
|
||||
*/
|
||||
@Override
|
||||
public List<ConsultInfo> selectConsultInfoList(ConsultInfo consultInfo)
|
||||
{
|
||||
return consultInfoMapper.selectConsultInfoList(consultInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertConsultInfo(ConsultInfo consultInfo)
|
||||
{
|
||||
consultInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return consultInfoMapper.insertConsultInfo(consultInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改咨询列
|
||||
*
|
||||
* @param consultInfo 咨询列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateConsultInfo(ConsultInfo consultInfo)
|
||||
{
|
||||
consultInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return consultInfoMapper.updateConsultInfo(consultInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除咨询列
|
||||
*
|
||||
* @param ids 需要删除的咨询列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConsultInfoByIds(String[] ids)
|
||||
{
|
||||
return consultInfoMapper.deleteConsultInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除咨询列信息
|
||||
*
|
||||
* @param id 咨询列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConsultInfoById(String id)
|
||||
{
|
||||
return consultInfoMapper.deleteConsultInfoById(id);
|
||||
}
|
||||
}
|
||||
@@ -260,6 +260,106 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
return musicInfoMapper.selectMusicInfoByReId(reId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一首播放的音乐ID
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param currentMusicId 当前播放的音乐ID,用于顺序播放时获取下一首
|
||||
* @return 下一首音乐ID
|
||||
*/
|
||||
@Override
|
||||
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
||||
List<MusicInfo> musicList = null;
|
||||
|
||||
// 根据播放列表类型获取对应的音乐列表
|
||||
switch (playlistType) {
|
||||
case 1: // 历史播放
|
||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||
break;
|
||||
case 2: // 分类播放
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId);
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
return null; // 推荐播放必须提供推荐ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
|
||||
break;
|
||||
case 4: // 收藏播放
|
||||
if (collectId == null || collectId.isEmpty()) {
|
||||
return null; // 收藏播放必须提供收藏ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
|
||||
break;
|
||||
case 5: // 喜欢播放
|
||||
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果列表为空,返回null
|
||||
if (musicList == null || musicList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 打印调试信息:列表大小和当前音乐ID
|
||||
System.out.println("播放列表大小: " + musicList.size() + ", 当前音乐ID: " + currentMusicId);
|
||||
|
||||
// 根据播放模式获取下一首音乐ID
|
||||
if (playMode == 1) { // 顺序播放
|
||||
// 按照ID排序列表
|
||||
musicList.sort((a, b) -> {
|
||||
Long idA = a.getMusicId();
|
||||
Long idB = b.getMusicId();
|
||||
return idA.compareTo(idB);
|
||||
});
|
||||
|
||||
// 打印排序后的ID列表,用于调试
|
||||
for (MusicInfo music : musicList) {
|
||||
System.out.println(music.getMusicId());
|
||||
}
|
||||
|
||||
// 如果没有当前音乐ID,返回列表中的第一首
|
||||
if (currentMusicId == null || currentMusicId.isEmpty()) {
|
||||
return musicList.get(0).getMusicId().toString();
|
||||
}
|
||||
|
||||
// 查找当前音乐在列表中的位置
|
||||
int currentIndex = -1;
|
||||
for (int i = 0; i < musicList.size(); i++) {
|
||||
if (musicList.get(i).getMusicId().toString().equals(currentMusicId)) {
|
||||
currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果找到当前音乐,返回下一首;否则返回第一首
|
||||
if (currentIndex != -1) {
|
||||
int nextIndex = (currentIndex + 1) % musicList.size(); // 循环播放
|
||||
return musicList.get(nextIndex).getMusicId().toString();
|
||||
} else {
|
||||
String firstMusicId = musicList.get(0).getMusicId().toString();
|
||||
System.out.println("未找到当前音乐,返回第一首: " + firstMusicId);
|
||||
return firstMusicId;
|
||||
}
|
||||
} else if (playMode == 2) { // 随机播放
|
||||
// 生成随机索引
|
||||
int randomIndex = (int) (Math.random() * musicList.size());
|
||||
String randomMusicId = musicList.get(randomIndex).getMusicId().toString();
|
||||
System.out.println("随机播放,索引: " + randomIndex + ", ID: " + randomMusicId);
|
||||
return randomMusicId;
|
||||
} else {
|
||||
return null; // 不支持的播放模式
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//TODO: 待完善
|
||||
public Map<String, String> getMixMusicInfo(String musicId){
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.ConsultInfoMapper">
|
||||
|
||||
<resultMap type="ConsultInfo" id="ConsultInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="subTitle" column="sub_title" />
|
||||
<result property="bannerImg" column="banner_img" />
|
||||
<result property="rotaImg" column="rota_img" />
|
||||
<result property="content" column="content" />
|
||||
<result property="author" column="author" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConsultInfoVo">
|
||||
select id, title, sub_title, banner_img, rota_img, content, author, create_time, update_time, is_del from consult_info
|
||||
</sql>
|
||||
|
||||
<select id="selectConsultInfoList" parameterType="ConsultInfo" resultMap="ConsultInfoResult">
|
||||
<include refid="selectConsultInfoVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="subTitle != null and subTitle != ''"> and sub_title = #{subTitle}</if>
|
||||
<if test="bannerImg != null and bannerImg != ''"> and banner_img = #{bannerImg}</if>
|
||||
<if test="rotaImg != null and rotaImg != ''"> and rota_img = #{rotaImg}</if>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
<if test="author != null and author != ''"> and author = #{author}</if>
|
||||
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectConsultInfoById" parameterType="String" resultMap="ConsultInfoResult">
|
||||
<include refid="selectConsultInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertConsultInfo" parameterType="ConsultInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into consult_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null">title,</if>
|
||||
<if test="subTitle != null">sub_title,</if>
|
||||
<if test="bannerImg != null">banner_img,</if>
|
||||
<if test="rotaImg != null">rota_img,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="author != null">author,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDel != null">is_del,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="subTitle != null">#{subTitle},</if>
|
||||
<if test="bannerImg != null">#{bannerImg},</if>
|
||||
<if test="rotaImg != null">#{rotaImg},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="author != null">#{author},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDel != null">#{isDel},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateConsultInfo" parameterType="ConsultInfo">
|
||||
update consult_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="subTitle != null">sub_title = #{subTitle},</if>
|
||||
<if test="bannerImg != null">banner_img = #{bannerImg},</if>
|
||||
<if test="rotaImg != null">rota_img = #{rotaImg},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="author != null">author = #{author},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteConsultInfoById" parameterType="String">
|
||||
delete from consult_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteConsultInfoByIds" parameterType="String">
|
||||
delete from consult_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -102,7 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mi.img_addr as musicImgAddr,
|
||||
mi.music_addr as musicAddr,
|
||||
mi.music_id as musicId,
|
||||
mi.author as musicAuthor
|
||||
mi.author as musicAuthor,
|
||||
mi.music_type as musicType
|
||||
FROM share_info si
|
||||
left join shop_user su on si.user_id = su.user_id
|
||||
LEFT JOIN music_info mi on si.music_id = mi.music_id
|
||||
|
||||
44
ruoyi-ui/src/api/consult/info.js
Normal file
44
ruoyi-ui/src/api/consult/info.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询咨询列列表
|
||||
export function listInfo(query) {
|
||||
return request({
|
||||
url: '/system/info/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询咨询列详细
|
||||
export function getInfo(id) {
|
||||
return request({
|
||||
url: '/system/info/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增咨询列
|
||||
export function addInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改咨询列
|
||||
export function updateInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除咨询列
|
||||
export function delInfo(id) {
|
||||
return request({
|
||||
url: '/system/info/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -30,6 +30,34 @@ import Layout from '@/layout'
|
||||
|
||||
// 公共路由
|
||||
export const constantRoutes = [
|
||||
// 咨询管理路由
|
||||
{
|
||||
path: '/consult',
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/consult/index'),
|
||||
name: 'ConsultList',
|
||||
meta: { title: '咨询列表', icon: 'list' }
|
||||
},
|
||||
{
|
||||
path: 'add',
|
||||
component: () => import('@/views/consult/add'),
|
||||
name: 'ConsultAdd',
|
||||
meta: { title: '添加文章', activeMenu: '/consult/index' },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'edit/:id',
|
||||
component: () => import('@/views/consult/edit'),
|
||||
name: 'ConsultEdit',
|
||||
meta: { title: '编辑文章', activeMenu: '/consult/index' },
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/redirect',
|
||||
component: Layout,
|
||||
|
||||
243
ruoyi-ui/src/views/consult/index.vue
Normal file
243
ruoyi-ui/src/views/consult/index.vue
Normal file
@@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="文章名称" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入文章名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="子标题" prop="subTitle">
|
||||
<el-input
|
||||
v-model="queryParams.subTitle"
|
||||
placeholder="请输入子标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input
|
||||
v-model="queryParams.author"
|
||||
placeholder="请输入作者"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:info:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:info:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:info:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:info:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="文章名称" align="center" prop="title" />
|
||||
<el-table-column label="子标题" align="center" prop="subTitle" />
|
||||
<el-table-column label="封面图片" align="center" prop="bannerImg">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 80px; height: 50px"
|
||||
:src="scope.row.bannerImg"
|
||||
:preview-src-list="[scope.row.bannerImg]">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="轮播图片" align="center" prop="rotaImg">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.rotaImg" type="info">{{ scope.row.rotaImg.split(',').length }}张图片</el-tag>
|
||||
<el-tag v-else type="info">无图片</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="正文" align="center" prop="content">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" effect="dark" :content="scope.row.content" placement="top-start">
|
||||
<div class="content-preview">{{ scope.row.content | ellipsis }}</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者" align="center" prop="author" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:info:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:info:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 已移除对话框,改为使用独立页面 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listInfo, getInfo, delInfo } from "@/api/consult/info"
|
||||
import { parseTime } from "@/utils/ruoyi"
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
filters: {
|
||||
// 内容截取过滤器
|
||||
ellipsis(value) {
|
||||
if (!value) return '';
|
||||
if (value.length > 30) {
|
||||
return value.slice(0, 30) + '...';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 咨询列表格数据
|
||||
infoList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: null,
|
||||
subTitle: null,
|
||||
content: null,
|
||||
author: null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询咨询列列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listInfo(this.queryParams).then(response => {
|
||||
this.infoList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$router.push('/consult/add');
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
const id = row.id || this.ids
|
||||
this.$router.push(`/consult/edit/${id}`);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除咨询列编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delInfo(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/info/export', {
|
||||
...this.queryParams
|
||||
}, `info_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -206,6 +206,7 @@
|
||||
:limit="1"
|
||||
:file-type="['mp3', 'wav', 'flac']"
|
||||
action="/back/upload/music/file"
|
||||
:fileSize="500"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -11,7 +11,7 @@ const name = process.env.VUE_APP_TITLE || '音乐APP后台管理系统' // 网
|
||||
|
||||
// const baseUrl = 'http://localhost:8080' // 后端接口
|
||||
// const baseUrl = 'http://60.205.107.210:8080' // 后端接口
|
||||
const baseUrl = 'http://192.168.31.239:8080' // 后端接口
|
||||
const baseUrl = 'http://192.168.31.240:8080' // 后端接口
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
|
||||
Reference in New Issue
Block a user