博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
目录
[1.1 项目介绍](#1.1 项目介绍)
[1.2 开发技术](#1.2 开发技术)
[3.1 前台功能](#3.1 前台功能)
[3.2 后台功能](#3.2 后台功能)
[5.1 音乐信息Controller模块](#5.1 音乐信息Controller模块)
[5.2 音乐信息Service模块](#5.2 音乐信息Service模块)
[5.3 音乐信息ServiceImpl模块](#5.3 音乐信息ServiceImpl模块)
[5.4 音乐信息Dao模块](#5.4 音乐信息Dao模块)
1、项目介绍及开发技术
1.1 项目介绍
在数字音乐时代,用户面临着海量的音乐选择,而发现符合个人口味的音乐却变得越来越困难。传统的音乐推荐方式往往无法准确捕捉用户的个性化需求。为了解决这一问题,我们开发了一个基于协同过滤算法的个性化音乐推荐系统,旨在为用户提供更加精准的音乐推荐服务。
背景: 随着互联网技术的发展,在线音乐平台迅速崛起,用户可以在平台上接触到各种各样的音乐。然而,用户在享受丰富音乐资源的同时,也面临着选择困难的问题。传统的音乐推荐系统往往采用简单的热门推荐或随机推荐,无法满足用户对个性化音乐的需求。
目的意义:
- 个性化推荐: 系统通过协同过滤算法,分析用户的音乐评分和听歌历史,为用户提供个性化的音乐推荐。
- 提升用户体验: 用户可以通过系统发现新的音乐,增加音乐探索的乐趣,提升音乐聆听体验。
- 增强用户粘性: 通过精准推荐,系统能够增加用户的满意度和忠诚度,提高用户活跃度。
- 促进音乐多样性: 系统不仅推荐热门音乐,还能发现并推荐小众音乐,促进音乐文化的多样性。
- 数据驱动的决策支持: 系统收集的用户数据和反馈信息,为音乐产业提供市场趋势分析和决策支持。
综上所述,基于协同过滤算法的个性化音乐推荐系统旨在为用户提供一个更加智能、个性化的音乐聆听环境,通过技术手段优化音乐推荐流程,提升用户的音乐体验。
1.2 开发技术
类别 | 技术名称 | 用途/描述 |
---|---|---|
开发语言 | Java | 一种广泛使用的面向对象编程语言。 |
框架 | Spring Boot | 简化Spring应用的初始搭建以及开发过程。 |
ORM工具 | MyBatis Plus | MyBatis的增强工具,简化CRUD操作。 |
数据库 | MySQL | 流行的关系型数据库管理系统。 |
构建工具 | Maven | 项目管理和理解工具。 |
开发工具 | IDEA | 集成开发环境,用于代码编写和调试。 |
JDK版本 | JDK 1.8+ | Java开发工具包,提供运行Java程序所需的环境。 |
前端框架 | Vue | 用于构建用户界面的渐进式JavaScript框架。 |
UI框架 | Element UI | 基于Vue的桌面端组件库。 |
前端技术 | HTML | 网页内容的标准标记语言。 |
前端技术 | CSS | 描述HTML文档的样式。 |
前端技术 | JS | 网页脚本语言,用于实现网页的动态效果。 |
2、系统功能设计结构图
功能模块结构图
│
├── 前端
│ ├── 登录/注册
│ ├── 首页
│ ├── 音乐信息
│ ├── 音乐资讯
│ └── 个人中心
│ ├── 个人中心
│ ├── 修改密码
│ ├── 音乐评分
│ ├── 我的歌单
│ └── 我的收藏
│
└── 后端
├── 登录
├── 首页
├── 管理员管理
├── 用户管理
├── 音乐信息管理
│ ├── 音乐类型
│ ├── 标签
│ └── 音乐信息
├── 音乐评分管理
├── 我的歌单管理
└── 新闻资讯管理
系统MVC框架,请求流程展示:
3、功能截图
3.1 前台功能
3.2 后台功能
4、数据库表结构设计
sql
--
-- Table structure for table `config`
--
DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '配置参数名称',
`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `discussyinlexinxi`
--
DROP TABLE IF EXISTS `discussyinlexinxi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `discussyinlexinxi` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`refid` bigint(20) NOT NULL COMMENT '关联表id',
`userid` bigint(20) NOT NULL COMMENT '用户id',
`avatarurl` longtext COMMENT '头像',
`nickname` varchar(200) DEFAULT NULL COMMENT '用户名',
`content` longtext NOT NULL COMMENT '评论内容',
`reply` longtext COMMENT '回复内容',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='音乐信息评论表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `storeup`
--
DROP TABLE IF EXISTS `storeup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `storeup` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`refid` bigint(20) DEFAULT NULL COMMENT 'refid',
`tablename` varchar(200) DEFAULT NULL COMMENT '表名',
`name` varchar(200) NOT NULL COMMENT '名称',
`picture` longtext NOT NULL COMMENT '图片',
`type` varchar(200) DEFAULT NULL COMMENT '类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注)',
`inteltype` varchar(200) DEFAULT NULL COMMENT '推荐类型',
`remark` varchar(200) DEFAULT NULL COMMENT '备注',
`userid` bigint(20) NOT NULL COMMENT '用户id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='我的收藏';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `wodegedan`
--
DROP TABLE IF EXISTS `wodegedan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wodegedan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`songname` varchar(200) DEFAULT NULL COMMENT '歌名',
`yinleleixing` varchar(200) DEFAULT NULL COMMENT '音乐类型',
`singer` varchar(200) DEFAULT NULL COMMENT '歌手',
`tianjiariqi` datetime DEFAULT NULL COMMENT '添加日期',
`yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8 COMMENT='我的歌单';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `yinlepingfen`
--
DROP TABLE IF EXISTS `yinlepingfen`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `yinlepingfen` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`songname` varchar(200) DEFAULT NULL COMMENT '歌名',
`yinleleixing` varchar(200) DEFAULT NULL COMMENT '音乐类型',
`singer` varchar(200) DEFAULT NULL COMMENT '歌手',
`pingfen` int(11) DEFAULT NULL COMMENT '评分',
`pingfenriqi` datetime DEFAULT NULL COMMENT '评分日期',
`yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8 COMMENT='音乐评分';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `yonghu`
--
DROP TABLE IF EXISTS `yonghu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `yonghu` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`yonghuzhanghao` varchar(200) NOT NULL COMMENT '用户账号',
`yonghumima` varchar(200) NOT NULL COMMENT '用户密码',
`yonghuxingming` varchar(200) NOT NULL COMMENT '用户姓名',
`touxiang` longtext COMMENT '头像',
`xingbie` varchar(200) DEFAULT NULL COMMENT '性别',
`shoujihaoma` varchar(200) DEFAULT NULL COMMENT '手机号码',
PRIMARY KEY (`id`),
UNIQUE KEY `yonghuzhanghao` (`yonghuzhanghao`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COMMENT='用户';
/*!40101 SET character_set_client = @saved_cs_client */;
5、关键代码
5.1 音乐信息Controller模块
java
package com.cl.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.cl.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.cl.annotation.IgnoreAuth;
import com.cl.utils.UserBasedCollaborativeFiltering;
import com.cl.entity.YinlexinxiEntity;
import com.cl.entity.view.YinlexinxiView;
import com.cl.service.YinlexinxiService;
import com.cl.service.TokenService;
import com.cl.utils.PageUtils;
import com.cl.utils.R;
import com.cl.utils.MPUtil;
import com.cl.utils.CommonUtil;
import java.io.IOException;
import com.cl.service.StoreupService;
import com.cl.entity.StoreupEntity;
/**
* 音乐信息
* 后端接口
* @author
* @email
*/
@RestController
@RequestMapping("/yinlexinxi")
public class YinlexinxiController {
@Autowired
private YinlexinxiService yinlexinxiService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YinlexinxiEntity yinlexinxi,
HttpServletRequest request){
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
PageUtils page = yinlexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yinlexinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YinlexinxiEntity yinlexinxi,
HttpServletRequest request){
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
PageUtils page = yinlexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yinlexinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YinlexinxiEntity yinlexinxi){
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( yinlexinxi, "yinlexinxi"));
return R.ok().put("data", yinlexinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YinlexinxiEntity yinlexinxi){
EntityWrapper< YinlexinxiEntity> ew = new EntityWrapper< YinlexinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( yinlexinxi, "yinlexinxi"));
YinlexinxiView yinlexinxiView = yinlexinxiService.selectView(ew);
return R.ok("查询音乐信息成功").put("data", yinlexinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YinlexinxiEntity yinlexinxi = yinlexinxiService.selectById(id);
yinlexinxi.setClicknum(yinlexinxi.getClicknum()+1);
yinlexinxiService.updateById(yinlexinxi);
yinlexinxi = yinlexinxiService.selectView(new EntityWrapper<YinlexinxiEntity>().eq("id", id));
return R.ok().put("data", yinlexinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YinlexinxiEntity yinlexinxi = yinlexinxiService.selectById(id);
yinlexinxi.setClicknum(yinlexinxi.getClicknum()+1);
yinlexinxiService.updateById(yinlexinxi);
yinlexinxi = yinlexinxiService.selectView(new EntityWrapper<YinlexinxiEntity>().eq("id", id));
return R.ok().put("data", yinlexinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YinlexinxiEntity yinlexinxi, HttpServletRequest request){
yinlexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yinlexinxi);
yinlexinxiService.insert(yinlexinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YinlexinxiEntity yinlexinxi, HttpServletRequest request){
yinlexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yinlexinxi);
yinlexinxiService.insert(yinlexinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody YinlexinxiEntity yinlexinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(yinlexinxi);
yinlexinxiService.updateById(yinlexinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yinlexinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,YinlexinxiEntity yinlexinxi, HttpServletRequest request,String pre){
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = yinlexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yinlexinxi), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(基于用户收藏的协同算法)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,YinlexinxiEntity yinlexinxi, HttpServletRequest request){
String userId = request.getSession().getAttribute("userId").toString();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("tablename", "yinlexinxi"));
Map<String, Map<String, Double>> ratings = new HashMap<>();
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity storeup : storeups) {
Map<String, Double> userRatings = null;
if(ratings.containsKey(storeup.getUserid().toString())) {
userRatings = ratings.get(storeup.getUserid().toString());
} else {
userRatings = new HashMap<>();
ratings.put(storeup.getUserid().toString(), userRatings);
}
if(userRatings.containsKey(storeup.getRefid().toString())) {
userRatings.put(storeup.getRefid().toString(), userRatings.get(storeup.getRefid().toString())+1.0);
} else {
userRatings.put(storeup.getRefid().toString(), 1.0);
}
}
}
// 创建协同过滤对象
UserBasedCollaborativeFiltering filter = new UserBasedCollaborativeFiltering(ratings);
// 为指定用户推荐物品
String targetUser = userId;
int numRecommendations = limit;
List<String> recommendations = filter.recommendItems(targetUser, numRecommendations);
// 输出推荐结果
System.out.println("Recommendations for " + targetUser + ":");
for (String item : recommendations) {
System.out.println(item);
}
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
ew.in("id", String.join(",", recommendations));
if(recommendations!=null && recommendations.size()>0) {
ew.last("order by FIELD(id, "+"'"+String.join("','", recommendations)+"'"+")");
}
PageUtils page = yinlexinxiService.queryPage(params, ew);
List<YinlexinxiEntity> pageList = (List<YinlexinxiEntity>)page.getList();
if(pageList.size()<limit) {
int toAddNum = limit-pageList.size();
ew = new EntityWrapper<YinlexinxiEntity>();
ew.notIn("id", recommendations);
ew.orderBy("id", false);
ew.last("limit "+toAddNum);
pageList.addAll(yinlexinxiService.selectList(ew));
} else if(pageList.size()>limit) {
pageList = pageList.subList(0, limit);
}
page.setList(pageList);
return R.ok().put("data", page);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
List<Map<String, Object>> result = yinlexinxiService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计(多))
*/
@RequestMapping("/valueMul/{xColumnName}")
public R valueMul(@PathVariable("xColumnName") String xColumnName,@RequestParam String yColumnNameMul, HttpServletRequest request) {
String[] yColumnNames = yColumnNameMul.split(",");
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
List<List<Map<String, Object>>> result2 = new ArrayList<List<Map<String,Object>>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
for(int i=0;i<yColumnNames.length;i++) {
params.put("yColumn", yColumnNames[i]);
List<Map<String, Object>> result = yinlexinxiService.selectValue(params, ew);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
result2.add(result);
}
return R.ok().put("data", result2);
}
/**
* (按值统计)时间统计类型
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
List<Map<String, Object>> result = yinlexinxiService.selectTimeStatValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型(多)
*/
@RequestMapping("/valueMul/{xColumnName}/{timeStatType}")
public R valueMulDay(@PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,@RequestParam String yColumnNameMul,HttpServletRequest request) {
String[] yColumnNames = yColumnNameMul.split(",");
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("timeStatType", timeStatType);
List<List<Map<String, Object>>> result2 = new ArrayList<List<Map<String,Object>>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
for(int i=0;i<yColumnNames.length;i++) {
params.put("yColumn", yColumnNames[i]);
List<Map<String, Object>> result = yinlexinxiService.selectTimeStatValue(params, ew);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
result2.add(result);
}
return R.ok().put("data", result2);
}
/**
* 分组统计
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
List<Map<String, Object>> result = yinlexinxiService.selectGroup(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 总数量
*/
@RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params,YinlexinxiEntity yinlexinxi, HttpServletRequest request){
EntityWrapper<YinlexinxiEntity> ew = new EntityWrapper<YinlexinxiEntity>();
int count = yinlexinxiService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yinlexinxi), params), params));
return R.ok().put("data", count);
}
}
5.2 音乐信息Service模块
java
package com.cl.service;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;
import com.cl.utils.PageUtils;
import com.cl.entity.YinlexinxiEntity;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.cl.entity.view.YinlexinxiView;
/**
* 音乐信息
*
* @author
* @email
*/
public interface YinlexinxiService extends IService<YinlexinxiEntity> {
PageUtils queryPage(Map<String, Object> params);
List<YinlexinxiView> selectListView(Wrapper<YinlexinxiEntity> wrapper);
YinlexinxiView selectView(@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<YinlexinxiEntity> wrapper);
}
5.3 音乐信息ServiceImpl模块
java
package com.cl.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cl.utils.PageUtils;
import com.cl.utils.Query;
import com.cl.dao.YinlexinxiDao;
import com.cl.entity.YinlexinxiEntity;
import com.cl.service.YinlexinxiService;
import com.cl.entity.view.YinlexinxiView;
@Service("yinlexinxiService")
public class YinlexinxiServiceImpl extends ServiceImpl<YinlexinxiDao, YinlexinxiEntity> implements YinlexinxiService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<YinlexinxiEntity> page = this.selectPage(
new Query<YinlexinxiEntity>(params).getPage(),
new EntityWrapper<YinlexinxiEntity>()
);
return new PageUtils(page);
}
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<YinlexinxiEntity> wrapper) {
Page<YinlexinxiView> page =new Query<YinlexinxiView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
public List<YinlexinxiView> selectListView(Wrapper<YinlexinxiEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
@Override
public YinlexinxiView selectView(Wrapper<YinlexinxiEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
@Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<YinlexinxiEntity> wrapper) {
return baseMapper.selectValue(params, wrapper);
}
@Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<YinlexinxiEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper);
}
@Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<YinlexinxiEntity> wrapper) {
return baseMapper.selectGroup(params, wrapper);
}
}
5.4 音乐信息Dao模块
java
package com.cl.dao;
import com.cl.entity.YinlexinxiEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.cl.entity.view.YinlexinxiView;
/**
* 音乐信息
*
* @author
* @email
*/
public interface YinlexinxiDao extends BaseMapper<YinlexinxiEntity> {
List<YinlexinxiView> selectListView(@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
List<YinlexinxiView> selectListView(Pagination page,@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
YinlexinxiView selectView(@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YinlexinxiEntity> wrapper);
}
6、论文目录结构
摘要... I
Abstract... II
1 绪论... 1
1.1 项目简介... 1
1.2 调查研究... 1
1.2.1 研究背景及意义... 1
1.2.2 国内外研究现状... 2
1.2.3 研究主要内容... 2
1.3 论文的章节安排... 3
2 系统相关技术介绍... 4
2.1 Java语言... 4
2.2 SpringBoot框架... 4
2.3 Vue框架... 4
2.4 MySQL数据库... 4
3 系统需求分析... 6
3.1 可行性分析... 6
3.1.1 技术可行性... 6
3.1.2 经济可行性... 6
3.1.3 操作可行性... 6
3.2 系统功能需求... 6
3.2.1 用户端功能需求... 6
3.2.2 XX端功能需求... 6
3.2.3 管理员端功能需求... 6
3.3 系统性能需求... 6
4 系统总体设计... 7
4.1 系统总体架构设计... 7
4.2 系统的功能设计... 7
4.3 数据库设计... 7
4.3.1 概念设计E-R图... 7
4.3.2 逻辑设计关系模式... 7
4.3.3 数据库物理设计... 7
5 系统详细实现... 14
5.1 系统实现环境... 14
5.2 用户端... 14
5.2.1 登录页面... 14
5.2.2 注册页面... 14
5.2.3 XXXX页面... 14
5.2.4 XXXX页面... 14
5.2.5 XXXX页面... 14
5.3 XXXX端... 15
5.3.1 XXXX页面... 15
5.3.2 XXXX页面... 15
5.3.3 XXXX页面... 15
5.3.4 XXXX页面... 15
5.4 管理端... 15
5.4.1 用户管理页面... 15
5.4.2 XXXX页面... 15
5.4.3 XXXX页面... 16
5.4.4 XXXX页面... 16
6 系统测试... 16
6.1 测试目的... 16
6.2 测试方法... 16
6.3 测试用例... 16
6.3.1 XXXX测试... 16
6.3.2 XXXX测试... 16
6.4 测试结果... 16
结论... 17
参考文献... 18
致谢... 19
更多源码:
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→下方联系方式获取源码←