网站做漏洞扫描费用,西安知名的集团门户网站建设公司,怎样开网店详细步骤,济宁做网站公司目录
1.系统的受众说明
2 需求分析
2.1用例图及用例分析
2.1.1 用户用例图及用例分析
2.1.2 管理员用例图及用例分析
2.2 系统结构图和流程图
2.2.1 音乐播放器的系统流程图#xff08;图2.2.1-1#xff09;
2.2.2 系统功能表#xff08;表2.2.2…目录
1.系统的受众说明
2 需求分析
2.1用例图及用例分析
2.1.1 用户用例图及用例分析
2.1.2 管理员用例图及用例分析
2.2 系统结构图和流程图
2.2.1 音乐播放器的系统流程图图2.2.1-1
2.2.2 系统功能表表2.2.2-1和系统功能结构图图2.2.2-1
2.3 系统界面需求
2.4 系统性能需求
3 初步设计
3.1 系统的可行性研究
3.1.1 技术可行性
3.1.2 经济可行性
3.1.3 法律可行性
3.2 软件目标
3.3 总体设计路线
4详细设计
4.1 整体概括
4.1.1 项目目的和目标
4.1.2 软件运转环境
4.2 详细需求
4.2.1 E-R图
4.3 功能需求
4.3.1 播放器的前端
4.3.2 播放器的后端
4.3.3 数据库设计
4.3.3.1 admin表
4.3.3.2 conllect表
4.3.3.3 comment表
4.3.3.4 consumer表
4.3.3.5 list_song表
4.3.3.6 rank表
4.3.3.7 singer表
4.3.3.8 song表
4.3.3.9 song_list表
5 编程实现
5.1 外部接口-前端界面实现
5.1.1 登录页面
5.1.2 播放器
5.1.3 首页
5.1.4 歌词页面
5.1.5 歌单详情页
5.2 内部接口-后端实现
5.2.1 管理员模块
5.2.2 收藏模块
5.2.3 评论区模块
5.2.4 前端用户控制模块
5.2.5 歌单模块
5.2.6 评价模块
5.2.7 歌手模块
5.2.8 歌曲模块
5.3 数据库交互
6 界面展示与测试
6.1 前端界面展示
6.2 后端界面展示
6.3 数据库界面展示 1.系统的受众说明 1 在校学习的学生可用于日常学习使用或是毕业设计使用 2 毕业一到两年的开发人员用于锻炼自己的独立功能模块设计能力增强代码编写能力。 3 亦可以部署为商化项目使用。 4 需要完整资料及源码请在文末获取联系方式领取。 2 需求分析
2.1用例图及用例分析
根据项目的目标我们可获得项目系统的基本需求以下从不同角度来描述系统的需求并且使用用例图来描述系统的功能需求我们分成三部分来概括即播放器的前端播放器的后端和数据库。以下分别描述
2.1.1 用户用例图及用例分析 图2.1.1-1 用户用例图 用例名称播放 参与者用户 目标使得用户可以播放在歌单中选中的歌曲 前置条件播放器正在运行 基本事件流1. 用户单击“播放”按钮 2. 播放器将播放列表中的当前歌曲 用例名称暂停 参与者用户 目标使得用户可以暂停在歌单中选中的歌曲 前置条件歌曲正在播放且未停止和暂停 基本事件流1. 用户单击“暂停”按钮 2. 播放器将暂停当前歌曲 用例名称上一首/下一首 参与者用户 目标使得用户可以听上一首或下一首歌曲 前置条件播放器正在播放或暂停 基本事件流1. 用户单击“上一首或下一首”按钮 2. 播放器将播放上一首或下一首歌曲 用例名称分享 参与者用户 目标使得用户可以分享当前歌曲 前置条件播放器正在运行 基本事件流1. 用户单击“分享”按钮 2. 生成并复制分享链接 用例名称下载 参与者用户 目标使得用户可以下载在歌单中选中的歌曲 前置条件播放器正在运行 基本事件流1. 用户单击“下载”按钮 2. 下载当前歌曲到本地 用例名称评论 参与者用户 目标使得用户可以评论在歌单中选中的歌曲 前置条件播放器正在运行 基本事件流1. 用户单击“评论”按钮 2. 在当前歌曲下方输入评论的内容 用例名称收藏 参与者用户 目标使得用户可以收藏喜爱的歌曲 前置条件播放器正在运行、成功登录系统 基本事件流1. 用户单击“收藏”按钮 2. 播放器将播放列表中的当前歌曲
2.1.2 管理员用例图及用例分析 图2.1.2-1 管理员用例图 用例名称修改 参与者管理员 目标使得管理员可以修改选中的用户、歌手、歌单歌曲 前置条件程序运行在播放菜单选项中 基本事件流1. 管理员单击“修改”按钮 2. 管理员将修改选中的用户、歌手、歌单和歌曲 用例名称删除 参与者管理员 目标使得管理员可以删除选中的用户、歌手、歌单歌曲 前置条件程序运行在播放菜单选项中 基本事件流1. 管理员单击“删除”按钮 2. 管理员将修改选中的用户、歌手、歌单和歌曲 用例名称歌词显示 参与者管理员 目标使得管理员可以修改选中的用户、歌手、歌单歌曲 前置条件是的程序进入播放器歌词设置状态 基本事件流1. 管理员单击“添加歌词”按钮 2. 歌词文本框中显示歌词
2.2 系统结构图和流程图
2.2.1 音乐播放器的系统流程图图2.2.1-1 图2.2.1-1 流程图
2.2.2 系统功能表表2.2.2-1和系统功能结构图图2.2.2-1 功能类别 子功能 子功能 播放列表 播放列表菜单 退出播放 从歌单寻找歌曲 歌曲菜单 播放-进入播放界面 删除-数据库同步更新 重命名-数据库同步更新 向上、下移动-数据库同步更新 播放 播放歌曲-线程启动-时间更新 暂停 暂停歌曲-线程暂停-时间暂停 播放界面 上一首 播放列表索引变化-寻找上一首歌曲 下一首 播放列表索引发生变化-寻找下一首歌曲 播放界面菜单 返回到播放列表 返回到主菜单 从歌单寻找歌曲 退出播放器 隐藏播放界面 主菜单 退出程序 程序退出 进入播放列表 显示播放列表
表2.2.2-1 系统功能表 图2.2.1-1 系统功能图 2.3 系统界面需求
播放器界面要求布局合理颜色舒适控制按钮友好为了减少开发工程量图片素材多数为本地项目素材图2.3-1 图2.3-1 播放器界面
说明左下角实心三角为暂停按钮右下角实心爱心为收藏按钮蓝色条为音轨。
2.4 系统性能需求
根据客户端电脑系统要求无响应时间为5秒所以就有如下性能需求
当要求歌曲播放时程序响应时间最长不能超过5秒当要求歌曲暂停时程序响应时间最长不能超过5秒当要求歌曲上/下一首时程序响应时间最长不能超过5秒当要求收藏歌曲时程序响应时间最长不能超过5秒当要求分享歌曲时程序响应时间最长不能超过5秒当要求评论歌曲时程序响应时间最长不能超过5秒当要求下载歌曲时程序响应时间最长不能超过5秒。 3 初步设计
3.1 系统的可行性研究
3.1.1 技术可行性
音乐管理系统可以利用现有的技术资源和工具进行开发和实施。现有的硬件和软件设备可以满足系统的需求例如存储音乐文件、处理用户请求和提供良好的用户体验。同时系统可以利用现有的数据库和网络技术来实现音乐文件的上传、存储和管理以及提供高效的搜索和推荐功能。因此从技术可行性的角度来看音乐管理系统是可行的。
3.1.2 经济可行性
音乐管理系统的开发和实施可以带来经济效益。系统可以提高音乐版权管理的效率减少人力成本并为音乐公司或个人艺术家带来更多的商业机会。此外系统还可以通过广告、订阅和销售音乐等方式产生收入。通过对系统开发和运营成本与预期收益进行比较可以得出音乐管理系统在经济上是可行的结论。
3.1.3 法律可行性
音乐管理系统需要遵守相关的法律法规特别是音乐版权保护和数据隐私方面的要求。系统需要确保音乐版权的合法使用并保护用户的个人信息安全。通过合规性的评估和合法的授权可以确保音乐管理系统在法律上是可行的。
综上所述从技术、经济、法律和操作等方面的考虑音乐管理系统是可行的。它可以利用现有的技术资源和工具进行开发和实施带来经济效益同时遵守相关的法律法规并具备良好的操作性。因此音乐管理系统的开发和实施是有前景和潜力的。
3.2 软件目标
本系统属于用户常用的音乐播放器。可以方便用户平时对音乐文件的操作。本系统应达以下目标
软件采用人机交互的方式界面美观友好、操作灵活、方便、富有个性化。能够对音乐文件进行有效地管理。系统应最大限度的实现易维护性和易操作性。
3.3 总体设计路线
在 web开发中界面的设计是很重要的因为它区别于Android的开发。它的界面大又要在这么大的界面上尽可能多的不去留白所以在UI设计上组件的摆放问题以及屏幕之间滑动跳转问题都是在设计工程中要考虑到的其次Web程序主要应用在客户端上为了方便用户操作必须考虑到组件摆放的易操作性所以要考虑到组件摆放的区域问题初次之外在UI设计的编写上也要考虑到代码的可更改问题如果单纯的用Vue实现那么软件的进一步更改开发上可能会遇到很大的问题所以该系统的大部分界面都是通过Vue和Java代码共同实现的。
在完成音乐播放器界面的设计后就是功能模块的设计了功能这一块是根据需求来的有怎么样的需求就对应怎么样的功能设计该音乐播放器所要实现的功能都是通过各个类之间调用实现的这样就增加了代码的可读性对于音乐播放器来说最主要的还是实现音乐播放功能第一部分就是音乐文件读取、音频文件信息读取其次是对音乐的操作然后就是播放器的个性化设置所以要做好也是一件不简单的事情。 4详细设计
4.1 整体概括
4.1.1 项目目的和目标
本项目的目的是开发一个能够播放的音乐文本格式的播放器。设计的主要实现功能是播放MP3等格式的音乐文件而且能控制播放、停止、音量控制、选择上一曲、选择下一曲、收藏、评论、分享、设置头像、歌曲列表文件的管理操作、在线播放、在线下载、等多种功能界面简洁操作简单。
4.1.2 软件运转环境
操作系统Win10
支持环境JAVA 、SpringBoot、MyBatis、MySQL、Vue、Nodejs等
开发环境IDEA、Visual studio Code、Navicat等。 4.2 详细需求
依据项目我们能够获取项目系统的基本需求从不一样的方面来描述系统的需求。
4.2.1 E-R图 4.3 功能需求
系统的功能需求我们分为三个主要部分即用户端管理员端和数据库。以下分别描绘
4.3.1 播放器的前端
首页点击歌单中的音乐播放列表中的歌曲进行播放播放时跳转播放界面并显示歌手信息同时会匹配歌词把相应的歌词显示在歌词面板中。暂停当歌曲正在播放时点击歌曲播放界面下方的暂停键暂停目前播放的歌曲同时歌曲停止转动。上一曲歌曲正在播放点击上一曲键播放列表中上一首歌曲。下一曲歌曲正在播放点击下一曲键播放列表中下一首歌曲。下载当歌曲正在播放时点击歌曲播放界面下方的下载键会在本地下载当前播放的歌曲。收藏当歌曲正在播放时点击歌曲播放界面下方的爱心键会收藏当前播放的歌曲。分享当歌曲正在播放时点击歌曲播放界面下方的分享键会自动生成分享链接并复制此链接可粘贴到聊天框分享当前播放的歌曲。评论当歌曲正在播放时点击歌曲播放界面下方的评论区可任意输入文字来评论当前歌曲。设置点击头像进入设置可修改头像设置用户基本信息。 4.3.2 播放器的后端
管理员登录首页是数据的统计图表可以分析当前用户的比例以及歌曲、歌手、国际的比例。
2用户管理查询已经注册过系统的用户并且可以去新增或者删除用户。
3歌手管理添加或者删除歌手添加成功可以更新相应的歌手图片。歌曲管理点击歌曲管理为歌手添加歌曲
4歌单管理输入添加歌单内容可以创建歌单、更新歌单的图片、对某个歌单有评论的管理、还可以对相应的歌单新增歌曲。 4.3.3 数据库设计
4.3.3.1 admin表 数据名称 数据类型 数据描述 id int 主键 name varchar(255) 账号 password varchar(255) 密码
4.3.3.2 conllect表 数据名称 数据类型 数据描述 id int 主键 user_id int 用户id type tinyint(1) 收藏类型 song_id int 歌曲id song_list_id int 歌单id create_time datetime(0) 收藏时间
4.3.3.3 comment表 数据名称 数据类型 数据描述 id int 主键 user_id int 用户id type tinyint(1) 评论类型 song_id int 歌曲id song_list_id int 歌单id content varchar(255) 评论内容 create_time datetime(0) 收藏时间 up int 评论点赞数
4.3.3.4 consumer表 数据名称 数据类型 数据描述 id int 主键 username varchar(255) 账号 password varchar(255) 密码 sex tinyint(1) 性别 phone_num char(15) 电话 email char(30) 邮箱 birth datetime(0) 生日 introduction varchar(255) 签名 location varchar(255) 地区 avator varchar(255) 头像 create_time datetime(0) 创建时间 update_time datetime(0) 更新时间
4.3.3.5 list_song表 数据名称 数据类型 数据描述 id int 主键 song_id int 歌曲id song_list_id int 歌单id
4.3.3.6 rank表 数据名称 数据类型 数据描述 id int 主键 song_list_id int 歌单id consumer_id int 用户id score int 评分
4.3.3.7 singer表 数据名称 数据类型 数据描述 id int 主键 name varchar(255) 姓名 sex tinyint(1) 性别 pic varchar(255) 头像 birth datetime(0) 生日 location varchar(255) 地区 introduction varchar(1600) 简介
4.3.3.8 song表 数据名称 数据类型 数据描述 id int 主键 singer_id int 歌手id name varchar(255) 歌名 introduction varchar(255) 简介 create_time datetime(0) 创建时间 update_time datetime(0) 更新时间 pic varchar(255) 歌曲图片 lyric text 歌词 url varchar(255) 歌曲地址
4.3.3.9 song_list表 数据名称 数据类型 数据描述 id int 主键 title varchar(255) 标题 pic varchar(255) 歌单图片 introduction text 简介 style varchar(255) 风格 5 编程实现
5.1 外部接口-前端界面实现
5.1.1 登录页面 div classsignin div classsignUp-head span帐号登录/span /div el-form :modelloginForm refloginForm label-width70px classdemo-ruleForm :rulesrules el-form-item propusername label用户名 el-input v-modelloginForm.username placeholder用户名/el-input /el-form-item el-form-item proppassword label密码 el-input typepassword v-modelloginForm.password placeholder密码 keyup.enter.nativehandleLoginIn/el-input /el-form-item div classlogin-btn el-button clickgoSignUp注册/el-button el-button typeprimary clickhandleLoginIn登录/el-button /div /el-form /div
5.1.2 播放器 div classplay-bar :class{ show: !toggle } div clicktoggle !toggle classitem-up :class{ turn: toggle } svg classicon use xlink:href#icon-jiantou-shang-cuxiantiao/use /svg /div div classkongjian !-- 上一首 -- div classitem clickprev svg classicon use xlink:href#icon-ziyuanldpi/use /svg /div !-- 播放 -- div classitem clicktogglePlay svg classicon use :xlink:hrefplayButtonUrl/use /svg /div !-- 下一首 -- div classitem clicknext svg classicon use xlink:href#icon-ziyuanldpi1/use /svg /div !-- 歌曲图片 -- div classitem-img clicktoLyric img :srcpicUrl / /div !-- 播放进度 -- div classplaying-speed !-- 播放开始时间 -- div classcurrent-time{{ nowTime }}/div div classprogress-box div classitem-song-title div{{ this.title }}/div div{{ this.artist }}/div /div div refprogress classprogress mousemovemousemove !-- 进度条 -- div refbg classbg clickupdatemove div refcurProgress classcur-progress :style{ width: curLength % } /div /div !-- 拖动的点点 -- div refidot classidot :style{ left: curLength % } mousedownmousedown mouseupmouseup /div /div /div !-- 播放结束时间 -- div classleft-time{{ songTime }}/div !-- 音量 -- div classitem item-volume svg v-ifvolume 0 classicon use xlink:href#icon-yinliangjingyinheix/use /svg svg v-else classicon use xlink:href#icon-yinliang1/use /svg el-slider classvolume v-modelvolume :verticaltrue /el-slider /div !-- 收藏 -- div classitem clickcollection svg :class{ active: isActive } classicon use xlink:href#icon-xihuan-shi/use /svg /div !-- 分享 -- div classitem clickshare stylepadding-bottom: -5px svg width16 height19 xmlnshttp://www.w3.org/2000/svg xmlns:svghttp://www.w3.org/2000/svg xmlns:sehttp://svg-edit.googlecode.com classbi bi-share-fill se:nonce62333 g classlayer titleLayer 1/title path dm11,2.5a2.5,2.5 0 1 1 0.6,1.63l-6.72,3.12a2.5,2.5 0 0 1 0,1.5l6.72,3.12a2.5,2.5 0 1 1 -0.48,0.88l-6.72,-3.12a2.5,2.5 0 1 1 0,-3.26l6.72,-3.12a2.5,2.5 0 0 1 -0.12,-0.75z idsvg_62333_1 / /g /svg /div !-- 下载 -- div classitem clickdownload svg classicon use xlink:href#icon-xiazai/use /svg /div !-- 当前播放的歌曲列表 -- div classitem clickchangeAside svg classicon use xlink:href#icon-liebiao/use /svg /div /div /div /div 5.1.3 首页 div classhome swiper / div classsection v-for(item,index) in songsList :keyindex div classsection-title{{item.name}}/div content-list :contentListitem.list/content-list /div /div 5.1.4 歌词页面 div classsong-lyric h1 classlyric-title歌词/h1 !-- 有歌词 -- ul classhas-lyric v-iflyr.length keyindex li v-for(item, index) in lyr v-bind:keyindex {{ item[1] }} /li /ul !-- 没有歌词 -- div v-else classno-lyric keyno-lyric span暂无歌词/span /div /div 5.1.5 歌单详情页 div classsong-list-album div classalbum-slide div classalbum-img img :srcattachImageUrl(tempList.pic) /div div classalbum-info h2简介/h2 span {{tempList.introduction}} /span /div /div div classalbum-content div classalbum-title p{{tempList.title}}/p /div div classalbum-score div h3歌单评分/h3 div el-rate v-modelaverage disabled/el-rate /div /div span{{average*2}}/span div h3评价/h3 div clicksetRank el-rate v-modelrank allow-half show-text/el-rate /div /div /div div classsongs-body album-content :songListlistOfSongs template slottitle歌单/template /album-content comment :playIdsongListId :type1/comment /div /div /div 5.2 内部接口-后端实现
5.2.1 管理员模块 /** * 判断是否登录成功 */ApiOperation(value 登录)RequestMapping(value /admin/login/status,method RequestMethod.POST)public Object loginStatus(HttpServletRequest request, HttpSession session){ JSONObject jsonObject new JSONObject(); String name request.getParameter(name); String password request.getParameter(password); boolean flag adminService.verifyPassword(name,password); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,登录成功); session.setAttribute(Consts.NAME,name); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名或密码错误); return jsonObject;}/** * 打包项目接口 */ApiOperation(value 后台接口)GetMapping(value /manage)public ModelAndView index() { return new ModelAndView(/src/main/resources/static/screenIndex/index.html);} 5.2.2 收藏模块 /** * 添加收藏 */ApiOperation(value 添加收藏)RequestMapping(value /add,method RequestMethod.POST)public Object addCollect(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String userId request.getParameter(userId); //用户id String type request.getParameter(type); //收藏类型0歌曲1歌单 String songId request.getParameter(songId); //歌曲id if(songIdnull||songId.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,收藏歌曲为空); return jsonObject; } if(CollectService.existSongId(Integer.parseInt(userId),Integer.parseInt(songId))){ jsonObject.put(Consts.CODE,2); jsonObject.put(Consts.MSG,已收藏); return jsonObject; } //保存到收藏的对象中 Collect Collect new Collect(); Collect.setUserId(Integer.parseInt(userId)); Collect.setType(new Byte(type)); Collect.setSongId(Integer.parseInt(songId)); boolean flag CollectService.insert(Collect); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,收藏成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,收藏失败); return jsonObject;}/** * 删除收藏 */ApiOperation(value 取消收藏)RequestMapping(value /delete,method RequestMethod.GET)public Object deleteCollect(HttpServletRequest request){ String userId request.getParameter(userId); //用户id String songId request.getParameter(songId); //歌曲id boolean flag CollectService.deleteByUserIdSongId(Integer.parseInt(userId),Integer.parseInt(songId)); return flag;}/** * 查询所有收藏 */ApiOperation(value 查看所有收藏)RequestMapping(value /allCollect,method RequestMethod.GET)public Object allCollect(HttpServletRequest request){ return CollectService.allCollect();}/** * 查询某个用户的收藏列表 */ApiOperation(value 用户的收藏列表)RequestMapping(value /collectOfUserId,method RequestMethod.GET)public Object collectOfUserId(HttpServletRequest request){ String userId request.getParameter(userId); //用户id return CollectService.collectOfUserId(Integer.parseInt(userId));} 5.2.3 评论区模块 /** * 添加评论 */ApiOperation(value 添加评论)RequestMapping(value /add,method RequestMethod.POST)public Object addComment(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String userId request.getParameter(userId); //用户id String type request.getParameter(type); //评论类型0歌曲1歌单 String songId request.getParameter(songId); //歌曲id String songListId request.getParameter(songListId); //歌单id String content request.getParameter(content).trim(); //评论内容 //保存到评论的对象中 Comment comment new Comment(); comment.setUserId(Integer.parseInt(userId)); comment.setType(new Byte(type)); if(new Byte(type) 0){ comment.setSongId(Integer.parseInt(songId)); }else{ comment.setSongListId(Integer.parseInt(songListId)); } comment.setContent(content); boolean flag commentService.insert(comment); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,评论成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,评论失败); return jsonObject;}/** * 修改评论 */ApiOperation(value 修改评论)RequestMapping(value /update,method RequestMethod.POST)public Object updateComment(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String id request.getParameter(id).trim(); //主键 String userId request.getParameter(userId).trim(); //用户id String type request.getParameter(type).trim(); //评论类型0歌曲1歌单 String songId request.getParameter(songId).trim(); //歌曲id String songListId request.getParameter(songListId).trim(); //歌单id String content request.getParameter(content).trim(); //评论内容 //保存到评论的对象中 Comment comment new Comment(); comment.setId(Integer.parseInt(id)); comment.setUserId(Integer.parseInt(userId)); comment.setType(new Byte(type)); if(songId!nullsongId.equals()){ songId null; }else { comment.setSongId(Integer.parseInt(songId)); } if(songListId!nullsongListId.equals()){ songListId null; }else { comment.setSongListId(Integer.parseInt(songListId)); } comment.setContent(content); boolean flag commentService.update(comment); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,修改成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,修改失败); return jsonObject;}/** * 删除评论 */ApiOperation(value 删除评论)RequestMapping(value /delete,method RequestMethod.GET)public Object deleteComment(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 boolean flag commentService.delete(Integer.parseInt(id)); return flag;}/** * 根据主键查询整个对象 */ApiOperation(value 根据主键查询整个对象)RequestMapping(value /selectByPrimaryKey,method RequestMethod.GET)public Object selectByPrimaryKey(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 return commentService.selectByPrimaryKey(Integer.parseInt(id));}/** * 查询所有评论 */ApiOperation(value 查询所有评论)RequestMapping(value /allComment,method RequestMethod.GET)public Object allComment(HttpServletRequest request){ return commentService.allComment();}/** * 查询某个歌曲下的所有评论 */ApiOperation(value 查询某个歌曲下的所有评论)RequestMapping(value /commentOfSongId,method RequestMethod.GET)public Object commentOfSongId(HttpServletRequest request){ String songId request.getParameter(songId); //歌曲id return commentService.commentOfSongId(Integer.parseInt(songId));}/** * 查询某个歌单下的所有评论 */ApiOperation(value 查询某个歌单下的所有评论)RequestMapping(value /commentOfSongListId,method RequestMethod.GET)public Object commentOfSongListId(HttpServletRequest request){ String songListId request.getParameter(songListId); //歌曲id return commentService.commentOfSongListId(Integer.parseInt(songListId));}/** * 给某个评论点赞 */ApiOperation(value 给某个评论点赞)RequestMapping(value /like,method RequestMethod.POST)public Object like(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String id request.getParameter(id).trim(); //主键 String up request.getParameter(up).trim(); //用户id //保存到评论的对象中 Comment comment new Comment(); comment.setId(Integer.parseInt(id)); comment.setUp(Integer.parseInt(up)); boolean flag commentService.update(comment); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,点赞成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,点赞失败); return jsonObject;} 5.2.4 前端用户控制模块 /** * 添加前端用户 */ApiOperation(value 注册、添加前端用户)RequestMapping(value /add,method RequestMethod.POST)public Object addConsumer(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String username request.getParameter(username).trim(); //账号 String password request.getParameter(password).trim(); //密码 String sex request.getParameter(sex).trim(); //性别 String phoneNum request.getParameter(phoneNum).trim(); //手机号 String email request.getParameter(email).trim(); //电子邮箱 String birth request.getParameter(birth).trim(); //生日 String introduction request.getParameter(introduction).trim();//签名 String location request.getParameter(location).trim(); //地区 String avator request.getParameter(avator).trim(); //头像地址 if(usernamenull||username.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名不能为空); return jsonObject; } Consumer consumer1 consumerService.getByUsername(username); if(consumer1!null){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名已存在); return jsonObject; } if(passwordnull||password.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,密码不能为空); return jsonObject; } //把生日转换成Date格式 DateFormat dateFormat new SimpleDateFormat(yyyy-MM-dd); Date birthDate new Date(); try { birthDate dateFormat.parse(birth); } catch (ParseException e) { e.printStackTrace(); } //保存到前端用户的对象中 Consumer consumer new Consumer(); consumer.setUsername(username); consumer.setPassword(password); consumer.setSex(new Byte(sex)); consumer.setPhoneNum(phoneNum); consumer.setEmail(email); consumer.setBirth(birthDate); consumer.setIntroduction(introduction); consumer.setLocation(location); consumer.setAvator(avator); boolean flag consumerService.insert(consumer); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,添加成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,添加失败); return jsonObject;}/** * 修改前端用户 */ApiOperation(value 修改前端用户)RequestMapping(value /update,method RequestMethod.POST)public Object updateConsumer(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String id request.getParameter(id).trim(); //主键 String username request.getParameter(username).trim(); //账号 String password request.getParameter(password).trim(); //密码 String sex request.getParameter(sex).trim(); //性别 String phoneNum request.getParameter(phoneNum).trim(); //手机号 String email request.getParameter(email).trim(); //电子邮箱 String birth request.getParameter(birth).trim(); //生日 String introduction request.getParameter(introduction).trim();//签名 String location request.getParameter(location).trim(); //地区 if(usernamenull||username.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名不能为空); return jsonObject; } if(passwordnull||password.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,密码不能为空); return jsonObject; } //把生日转换成Date格式 DateFormat dateFormat new SimpleDateFormat(yyyy-MM-dd); Date birthDate new Date(); try { birthDate dateFormat.parse(birth); } catch (ParseException e) { e.printStackTrace(); } //保存到前端用户的对象中 Consumer consumer new Consumer(); consumer.setId(Integer.parseInt(id)); consumer.setUsername(username); consumer.setPassword(password); consumer.setSex(new Byte(sex)); consumer.setPhoneNum(phoneNum); consumer.setEmail(email); consumer.setBirth(birthDate); consumer.setIntroduction(introduction); consumer.setLocation(location); boolean flag consumerService.update(consumer); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,修改成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,修改失败); return jsonObject;}/** * 删除前端用户 */ApiOperation(value 删除前端用户)RequestMapping(value /delete,method RequestMethod.GET)public Object deleteConsumer(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 boolean flag consumerService.delete(Integer.parseInt(id)); return flag;}/** * 根据主键查询整个对象 */ApiOperation(value 根据主键查询整个对象)RequestMapping(value /selectByPrimaryKey,method RequestMethod.GET)public Object selectByPrimaryKey(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 return consumerService.selectByPrimaryKey(Integer.parseInt(id));}/** * 查询所有前端用户 */ApiOperation(value 查询所有前端用户)RequestMapping(value /allConsumer,method RequestMethod.GET)public Object allConsumer(HttpServletRequest request){ return consumerService.allConsumer();}/** * 更新前端用户图片 */ApiOperation(value 更新前端用户图片)RequestMapping(value /updateConsumerPic,method RequestMethod.POST)public Object updateConsumerPic(RequestParam(file) MultipartFile avatorFile, RequestParam(id)int id){ JSONObject jsonObject new JSONObject(); if(avatorFile.isEmpty()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,文件上传失败); return jsonObject; } //文件名当前时间到毫秒原来的文件名 String fileName System.currentTimeMillis()avatorFile.getOriginalFilename(); //文件路径 String filePath System.getProperty(user.dir)System.getProperty(file.separator)userImages; //如果文件路径不存在新增该路径 File file1 new File(filePath); if(!file1.exists()){ file1.mkdir(); } //实际的文件地址 File dest new File(filePathSystem.getProperty(file.separator)fileName); //存储到数据库里的相对文件地址 String storeAvatorPath /userImages/fileName; try { avatorFile.transferTo(dest); Consumer consumer new Consumer(); consumer.setId(id); consumer.setAvator(storeAvatorPath); boolean flag consumerService.update(consumer); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,上传成功); jsonObject.put(avator,storeAvatorPath); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败); return jsonObject; } catch (IOException e) { jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败e.getMessage()); }finally { return jsonObject; }}/** * 前端用户登录 */ApiOperation(value 前端用户登录)RequestMapping(value /login,method RequestMethod.POST)public Object login(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String username request.getParameter(username).trim(); //账号 String password request.getParameter(password).trim(); //密码 if(usernamenull||username.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名不能为空); return jsonObject; } if(passwordnull||password.equals()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,密码不能为空); return jsonObject; } //保存到前端用户的对象中 Consumer consumer new Consumer(); consumer.setUsername(username); consumer.setPassword(password); boolean flag consumerService.verifyPassword(username,password); if(flag){ //验证成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,登录成功); jsonObject.put(userMsg,consumerService.getByUsername(username)); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,用户名或密码错误); return jsonObject;} 5.2.5 歌单模块 /** * 给歌单添加歌曲 */ApiOperation(value 给歌单添加歌曲)RequestMapping(value /add,method RequestMethod.POST)public Object addListSong(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); //获取前端传来的参数 String songId request.getParameter(songId).trim(); //歌曲id String songListId request.getParameter(songListId).trim(); //歌单id ListSong listSong new ListSong(); listSong.setSongId(Integer.parseInt(songId)); listSong.setSongListId(Integer.parseInt(songListId)); boolean flag listSongService.insert(listSong); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,保存成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,保存失败); return jsonObject;}/** * 根据歌单id查询歌曲 */ApiOperation(value 根据歌单id查询歌曲)RequestMapping(value /detail,method RequestMethod.GET)public Object detail(HttpServletRequest request){ String songListId request.getParameter(songListId); return listSongService.listSongOfSongListId(Integer.parseInt(songListId));}/** * 删除歌单里的歌曲 */ApiOperation(value 删除歌单里的歌曲)RequestMapping(value /delete,method RequestMethod.GET)public Object delete(HttpServletRequest request){ String songId request.getParameter(songId).trim(); //歌曲id String songListId request.getParameter(songListId).trim(); //歌单id boolean flag listSongService.deleteBySongIdAndSongListId(Integer.parseInt(songId),Integer.parseInt(songListId)); return flag;} 5.2.6 评价模块 /** * 新增评价 */ApiOperation(value 新增评价)RequestMapping(value /rank/add,method RequestMethod.POST)public Object add(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String songListId request.getParameter(songListId); String consumerId request.getParameter(consumerId); String score request.getParameter(score); Rank rank new Rank(); rank.setSongListId(Integer.parseInt(songListId)); rank.setConsumerId(Integer.parseInt(consumerId)); rank.setScore(Integer.parseInt(score)); boolean flag rankService.insert(rank); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,评价成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,评价失败); return jsonObject;}/** * 计算平均分 */ApiOperation(value 计算平均分)RequestMapping(value /rank,method RequestMethod.GET)public Object rankOfSongListId(HttpServletRequest request){ String songListId request.getParameter(songListId); return rankService.rankOfSongListId(Integer.parseInt(songListId));} 5.2.7 歌手模块 /** * 添加歌手 */ApiOperation(value 添加歌手)RequestMapping(value /add,method RequestMethod.POST)public Object addSinger(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String name request.getParameter(name).trim(); //姓名 String sex request.getParameter(sex).trim(); //性别 String pic request.getParameter(pic).trim(); //头像 String birth request.getParameter(birth).trim(); //生日 String location request.getParameter(location).trim();//地区 String introduction request.getParameter(introduction).trim();//简介 //把生日转换成Date格式 DateFormat dateFormat new SimpleDateFormat(yyyy-MM-dd); Date birthDate new Date(); try { birthDate dateFormat.parse(birth); } catch (ParseException e) { e.printStackTrace(); } //保存到歌手的对象中 Singer singer new Singer(); singer.setName(name); singer.setSex(new Byte(sex)); singer.setPic(pic); singer.setBirth(birthDate); singer.setLocation(location); singer.setIntroduction(introduction); boolean flag singerService.insert(singer); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,添加成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,添加失败); return jsonObject;}/** * 修改歌手 */ApiOperation(value 修改歌手)RequestMapping(value /update,method RequestMethod.POST)public Object updateSinger(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String id request.getParameter(id).trim(); //主键 String name request.getParameter(name).trim(); //姓名 String sex request.getParameter(sex).trim(); //性别 String birth request.getParameter(birth).trim(); //生日 String location request.getParameter(location).trim();//地区 String introduction request.getParameter(introduction).trim();//简介 //把生日转换成Date格式 DateFormat dateFormat new SimpleDateFormat(yyyy-MM-dd); Date birthDate new Date(); try { birthDate dateFormat.parse(birth); } catch (ParseException e) { e.printStackTrace(); } //保存到歌手的对象中 Singer singer new Singer(); singer.setId(Integer.parseInt(id)); singer.setName(name); singer.setSex(new Byte(sex)); singer.setBirth(birthDate); singer.setLocation(location); singer.setIntroduction(introduction); boolean flag singerService.update(singer); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,修改成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,修改失败); return jsonObject;}/** * 删除歌手 */ApiOperation(value 删除歌手)RequestMapping(value /delete,method RequestMethod.GET)public Object deleteSinger(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 boolean flag singerService.delete(Integer.parseInt(id)); return flag;}/** * 根据主键查询整个对象 */ApiOperation(value 根据主键查询整个对象)RequestMapping(value /selectByPrimaryKey,method RequestMethod.GET)public Object selectByPrimaryKey(HttpServletRequest request){ String id request.getParameter(id).trim(); //主键 return singerService.selectByPrimaryKey(Integer.parseInt(id));}/** * 查询所有歌手 */ApiOperation(value 查询所有歌手)RequestMapping(value /allSinger,method RequestMethod.GET)public Object allSinger(HttpServletRequest request){ return singerService.allSinger();}/** * 根据歌手名字模糊查询列表 */ApiOperation(value 根据歌手名字模糊查询列表)RequestMapping(value /singerOfName,method RequestMethod.GET)public Object singerOfName(HttpServletRequest request){ String name request.getParameter(name).trim(); //歌手名字 return singerService.singerOfName(%name%);}/** * 根据性别查询 */ApiOperation(value 根据性别查询)RequestMapping(value /singerOfSex,method RequestMethod.GET)public Object singerOfSex(HttpServletRequest request){ String sex request.getParameter(sex).trim(); //性别 return singerService.singerOfSex(Integer.parseInt(sex));}/** * 更新歌手图片 */ApiOperation(value 更新歌手图片)RequestMapping(value /updateSingerPic,method RequestMethod.POST)public Object updateSingerPic(RequestParam(file) MultipartFile avatorFile, RequestParam(id)int id){ JSONObject jsonObject new JSONObject(); if(avatorFile.isEmpty()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,文件上传失败); return jsonObject; } //文件名当前时间到毫秒原来的文件名 String fileName System.currentTimeMillis()avatorFile.getOriginalFilename(); //文件路径 String filePath System.getProperty(user.dir)System.getProperty(file.separator)img System.getProperty(file.separator)singerPic; //如果文件路径不存在新增该路径 File file1 new File(filePath); if(!file1.exists()){ file1.mkdir(); } //实际的文件地址 File dest new File(filePathSystem.getProperty(file.separator)fileName); //存储到数据库里的相对文件地址 String storeAvatorPath /img/singerPic/fileName; try { avatorFile.transferTo(dest); Singer singer new Singer(); singer.setId(id); singer.setPic(storeAvatorPath); boolean flag singerService.update(singer); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,上传成功); jsonObject.put(pic,storeAvatorPath); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败); return jsonObject; } catch (IOException e) { jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败e.getMessage()); }finally { return jsonObject; }} 5.2.8 歌曲模块 /** * 添加歌曲 */ApiOperation(value 添加歌曲)RequestMapping(value /add,method RequestMethod.POST)public Object addSong(HttpServletRequest request, RequestParam(file)MultipartFile mpFile){ JSONObject jsonObject new JSONObject(); //获取前端传来的参数 String singerId request.getParameter(singerId).trim(); //所属歌手id String name request.getParameter(name).trim(); //歌名 String introduction request.getParameter(introduction).trim(); //简介 String pic /img/songPic/tubiao.jpg; //默认图片 String lyric request.getParameter(lyric).trim(); //歌词 //上传歌曲文件 if(mpFile.isEmpty()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,歌曲上传失败); return jsonObject; } //文件名当前时间到毫秒原来的文件名 String fileName System.currentTimeMillis()mpFile.getOriginalFilename(); //文件路径 String filePath System.getProperty(user.dir)System.getProperty(file.separator)song; //如果文件路径不存在新增该路径 File file1 new File(filePath); if(!file1.exists()){ file1.mkdir(); } //实际的文件地址 File dest new File(filePathSystem.getProperty(file.separator)fileName); //存储到数据库里的相对文件地址 String storeUrlPath /song/fileName; try { mpFile.transferTo(dest); Song song new Song(); song.setSingerId(Integer.parseInt(singerId)); song.setName(name); song.setIntroduction(introduction); song.setPic(pic); song.setLyric(lyric); song.setUrl(storeUrlPath); boolean flag songService.insert(song); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,保存成功); jsonObject.put(avator,storeUrlPath); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,保存失败); return jsonObject; } catch (IOException e) { jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,保存失败e.getMessage()); }finally { return jsonObject; }}/** * 根据歌手id查询歌曲 */ApiOperation(value 根据歌手id查询歌曲)RequestMapping(value /singer/detail,method RequestMethod.GET)public Object songOfSingerId(HttpServletRequest request){ String singerId request.getParameter(singerId); return songService.songOfSingerId(Integer.parseInt(singerId));}/** * 修改歌曲 */ApiOperation(value 修改歌曲)RequestMapping(value /update,method RequestMethod.POST)public Object updateSong(HttpServletRequest request){ JSONObject jsonObject new JSONObject(); String id request.getParameter(id).trim(); //主键 String name request.getParameter(name).trim(); //歌名 String introduction request.getParameter(introduction).trim();//专辑 String lyric request.getParameter(lyric).trim(); //歌词 //保存到歌手的对象中 Song song new Song(); song.setId(Integer.parseInt(id)); song.setName(name); song.setIntroduction(introduction); song.setLyric(lyric); boolean flag songService.update(song); if(flag){ //保存成功 jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,修改成功); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,修改失败); return jsonObject;}/** * 删除歌曲 */ApiOperation(value 删除歌曲)RequestMapping(value /delete,method RequestMethod.GET)public Object deleteSinger(HttpServletRequest request){ //-TODO 先查询到数据库中对应的文件地址删除掉它再进行下面的代码 String id request.getParameter(id).trim(); //主键 boolean flag songService.delete(Integer.parseInt(id)); return flag;}/** * 更新歌曲图片 */ApiOperation(value 更新歌曲图片)RequestMapping(value /updateSongPic,method RequestMethod.POST)public Object updateSongPic(RequestParam(file) MultipartFile avatorFile, RequestParam(id)int id){ JSONObject jsonObject new JSONObject(); if(avatorFile.isEmpty()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,文件上传失败); return jsonObject; } //文件名当前时间到毫秒原来的文件名 String fileName System.currentTimeMillis()avatorFile.getOriginalFilename(); //文件路径 String filePath System.getProperty(user.dir)System.getProperty(file.separator)img System.getProperty(file.separator)songPic; //如果文件路径不存在新增该路径 File file1 new File(filePath); if(!file1.exists()){ file1.mkdir(); } //实际的文件地址 File dest new File(filePathSystem.getProperty(file.separator)fileName); //存储到数据库里的相对文件地址 String storeAvatorPath /img/songPic/fileName; try { avatorFile.transferTo(dest); Song song new Song(); song.setId(id); song.setPic(storeAvatorPath); boolean flag songService.update(song); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,上传成功); jsonObject.put(pic,storeAvatorPath); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败); return jsonObject; } catch (IOException e) { jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败e.getMessage()); }finally { return jsonObject; }}/** * 更新歌曲 */ApiOperation(value 更新歌曲)RequestMapping(value /updateSongUrl,method RequestMethod.POST)public Object updateSongUrl(RequestParam(file) MultipartFile avatorFile, RequestParam(id)int id){ JSONObject jsonObject new JSONObject(); if(avatorFile.isEmpty()){ jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,文件上传失败); return jsonObject; } //文件名当前时间到毫秒原来的文件名 String fileName System.currentTimeMillis()avatorFile.getOriginalFilename(); //文件路径 String filePath System.getProperty(user.dir)System.getProperty(file.separator)song; //如果文件路径不存在新增该路径 File file1 new File(filePath); if(!file1.exists()){ file1.mkdir(); } //实际的文件地址 File dest new File(filePathSystem.getProperty(file.separator)fileName); //存储到数据库里的相对文件地址 String storeAvatorPath /song/fileName; try { avatorFile.transferTo(dest); Song song new Song(); song.setId(id); song.setUrl(storeAvatorPath); boolean flag songService.update(song); if(flag){ jsonObject.put(Consts.CODE,1); jsonObject.put(Consts.MSG,上传成功); jsonObject.put(avator,storeAvatorPath); return jsonObject; } jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败); return jsonObject; } catch (IOException e) { jsonObject.put(Consts.CODE,0); jsonObject.put(Consts.MSG,上传失败e.getMessage()); }finally { return jsonObject; }}/** * 根据歌曲id查询歌曲对象 */ApiOperation(value 根据歌曲id查询歌曲对象)RequestMapping(value /detail,method RequestMethod.GET)public Object detail(HttpServletRequest request){ String songId request.getParameter(songId); return songService.selectByPrimaryKey(Integer.parseInt(songId));}/** * 根据歌手名字精确查询歌曲 */ApiOperation(value 根据歌手名字精确查询歌曲)RequestMapping(value /songOfSongName,method RequestMethod.GET)public Object songOfSongName(HttpServletRequest request){ String songName request.getParameter(songName); return songService.songOfName(songName);}/** * 根据歌手名字模糊查询歌曲 */ApiOperation(value 根据歌手名字模糊查询歌曲)RequestMapping(value /likeSongOfName,method RequestMethod.GET)public Object likeSongOfName(HttpServletRequest request){ String songName request.getParameter(songName); return songService.likeSongOfName(songName);}/** * 查询所有歌曲 */ApiOperation(value 查询所有歌曲)RequestMapping(value /allSong,method RequestMethod.GET)public Object allSong(HttpServletRequest request){ return songService.allSong();} 5.3 数据库交互 select idverifyPassword resultTypejava.lang.Integer select count(*) from admin where name#{username} and password#{password}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Collect id columnid jdbcTypeINTEGER propertyid/ result columnuser_id jdbcTypeINTEGER propertyuserId/ result columntype jdbcTypeTINYINT propertytype/ result columnsong_id jdbcTypeINTEGER propertysongId/ result columnsong_list_id jdbcTypeINTEGER propertysongListId/ result columncreate_time jdbcTypeTIMESTAMP propertycreateTime//resultMapsql idBase_Column_List id,user_id,type,song_id,song_list_id,create_time/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.Collect insert into collect trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testuserId ! null user_id, /if if testtype ! null type, /if if testsongId ! null song_id, /if if testsongListId ! null song_list_id, /if create_time, /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testuserId ! null #{userId}, /if if testtype ! null #{type}, /if if testsongId ! null #{songId}, /if if testsongListId ! null #{songListId}, /if now(), /trim /insertdelete iddelete delete from collect where id#{id}/deletedelete iddeleteByUserIdSongId parameterTypejava.lang.Integer delete from collect where user_id #{userId} and song_id #{songId}/deleteselect idallCollect resultMapBaseResultMap select include refidBase_Column_List/ from collect/selectselect idcollectOfUserId resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from collect where user_id #{userId}/selectselect idexistSongId resultTypejava.lang.Integer select count(*) from collect where user_id #{userId} and song_id #{songId}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Comment id columnid jdbcTypeINTEGER propertyid/ result columnuser_id jdbcTypeINTEGER propertyuserId/ result columntype jdbcTypeTINYINT propertytype/ result columnsong_id jdbcTypeINTEGER propertysongId/ result columnsong_list_id jdbcTypeINTEGER propertysongListId/ result columncontent jdbcTypeVARCHAR propertycontent/ result columncreate_time jdbcTypeTIMESTAMP propertycreateTime/ result columnup jdbcTypeINTEGER propertyup//resultMapsql idBase_Column_List id,user_id,type,song_id,song_list_id,content,create_time,up/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.Comment insert into comment trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testuserId ! null user_id, /if if testtype ! null type, /if if testsongId ! null song_id, /if if testsongListId ! null song_list_id, /if if testcontent ! null content, /if create_time, if testup ! null up, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testuserId ! null #{userId}, /if if testtype ! null #{type}, /if if testsongId ! null #{songId}, /if if testsongListId ! null #{songListId}, /if if testcontent ! null #{content}, /if now(), if testup ! null #{up}, /if /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.Comment update comment set if testuserId ! null user_id #{userId}, /if if testtype ! null type #{type}, /if if testsongId ! null song_id #{songId}, /if if testsongListId ! null song_list_id #{songListId}, /if if testcontent ! null content #{content}, /if if testup ! null up #{up}, /if /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from comment where id#{id}/deleteselect idselectByPrimaryKey resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from comment where id#{id}/selectselect idallComment resultMapBaseResultMap select include refidBase_Column_List/ from comment/selectselect idcommentOfSongId resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from comment where song_id #{songId}/selectselect idcommentOfSongListId resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from comment where song_list_id #{songListId}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Consumer id columnid jdbcTypeINTEGER propertyid/ result columnusername jdbcTypeVARCHAR propertyusername/ result columnpassword jdbcTypeVARCHAR propertypassword/ result columnsex jdbcTypeTINYINT propertysex/ result columnphone_num jdbcTypeCHAR propertyphoneNum/ result columnemail jdbcTypeCHAR propertyemail/ result columnbirth jdbcTypeTIMESTAMP propertybirth/ result columnintroduction jdbcTypeVARCHAR propertyintroduction/ result columnlocation jdbcTypeVARCHAR propertylocation/ result columnavator jdbcTypeVARCHAR propertyavator/ result columncreate_time jdbcTypeTIMESTAMP propertycreateTime/ result columnupdate_time jdbcTypeTIMESTAMP propertyupdateTime//resultMapsql idBase_Column_List id,username,password,sex,phone_num,email,birth,introduction,location,avator,create_time,update_time/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.Consumer insert into consumer trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testusername ! null username, /if if testpassword ! null password, /if if testsex ! null sex, /if if testphoneNum ! null phone_num, /if if testemail ! null email, /if if testbirth ! null birth, /if if testintroduction ! null introduction, /if if testlocation ! null location, /if if testavator ! null avator, /if create_time,update_time, /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testusername ! null #{username}, /if if testpassword ! null #{password}, /if if testsex ! null #{sex}, /if if testphoneNum ! null #{phoneNum}, /if if testemail ! null #{email}, /if if testbirth ! null #{birth}, /if if testintroduction ! null #{introduction}, /if if testlocation ! null #{location}, /if if testavator ! null #{avator}, /if now(),now(), /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.Consumer update consumer set if testusername ! null username #{username}, /if if testpassword ! null password #{password}, /if if testsex ! null sex #{sex}, /if if testphoneNum ! null phone_num #{phoneNum}, /if if testemail ! null email #{email}, /if if testbirth ! null birth #{birth}, /if if testintroduction ! null introduction #{introduction}, /if if testlocation ! null location #{location}, /if if testavator ! null avator #{avator}, /if update_time now(), /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from consumer where id#{id}/deleteselect idselectByPrimaryKey resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from consumer where id#{id}/selectselect idallConsumer resultMapBaseResultMap select include refidBase_Column_List/ from consumer/selectselect idverifyPassword resultTypejava.lang.Integer parameterTypejava.util.HashMap select count(*) from consumer where username #{username} and password #{password}/selectselect idgetByUsername resultMapBaseResultMap parameterTypejava.lang.String select include refidBase_Column_List/ from consumer where username #{username}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.ListSong id columnid jdbcTypeINTEGER propertyid/ result columnsong_id jdbcTypeINTEGER propertysongId/ result columnsong_list_id jdbcTypeINTEGER propertysongListId//resultMapsql idBase_Column_List id,song_id,song_list_id/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.ListSong insert into list_song trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testsongId ! null song_id, /if if testsongListId ! null song_list_id, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testsongId ! null #{songId}, /if if testsongListId ! null #{songListId}, /if /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.ListSong update list_song set if testsongId ! null song_id #{songId}, /if if testsongListId ! null song_list_id #{songListId}, /if /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from list_song where id#{id}/deletedelete iddeleteBySongIdAndSongListId parameterTypejava.util.HashMap delete from list_song where song_id#{songId} and song_list_id#{songListId}/deleteselect idselectByPrimaryKey resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from list_song where id#{id}/selectselect idallListSong resultMapBaseResultMap select include refidBase_Column_List/ from list_song/selectselect idlistSongOfSongListId resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from list_song where song_list_id#{songListId}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Rank id columnid jdbcTypeINTEGER propertyid/ result columnsong_list_id jdbcTypeINTEGER propertysongListId/ result columnconsumer_id jdbcTypeINTEGER propertyconsumerId/ result columnscore jdbcTypeINTEGER propertyscore//resultMapinsert idinsert parameterTypecom.rabbiter.music.pojo.Rank insert into rank trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testsongListId ! null song_list_id, /if if testconsumerId ! null consumer_id, /if if testscore ! null score, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testsongListId ! null #{songListId}, /if if testconsumerId ! null #{consumerId}, /if if testscore ! null #{score}, /if /trim /insertselect idselectScoreSum resultTypejava.lang.Integer parameterTypejava.lang.Integer select COALESCE(sum(score),0) as score from rank where song_list_id #{songListId}/selectselect idselectRankNum resultTypejava.lang.Integer parameterTypejava.lang.Integer select COALESCE(count(id),0) as num from rank where song_list_id #{songListId}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Singer id columnid jdbcTypeINTEGER propertyid/ result columnname jdbcTypeVARCHAR propertyname/ result columnsex jdbcTypeTINYINT propertysex/ result columnpic jdbcTypeVARCHAR propertypic/ result columnbirth jdbcTypeTIMESTAMP propertybirth/ result columnlocation jdbcTypeVARCHAR propertylocation/ result columnintroduction jdbcTypeVARCHAR propertyintroduction//resultMapsql idBase_Column_List id,name,sex,pic,birth,location,introduction/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.Singer insert into singer trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testname ! null name, /if if testsex ! null sex, /if if testpic ! null pic, /if if testbirth ! null birth, /if if testlocation ! null location, /if if testintroduction ! null introduction, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testname ! null #{name}, /if if testsex ! null #{sex}, /if if testpic ! null #{pic}, /if if testbirth ! null #{birth}, /if if testlocation ! null #{location}, /if if testintroduction ! null #{introduction}, /if /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.Singer update singer set if testname ! null name #{name}, /if if testsex ! null sex #{sex}, /if if testpic ! null pic #{pic}, /if if testbirth ! null birth #{birth}, /if if testlocation ! null location #{location}, /if if testintroduction ! null introduction #{introduction}, /if /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from singer where id#{id}/deleteselect idselectByPrimaryKey resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from singer where id#{id}/selectselect idallSinger resultMapBaseResultMap select include refidBase_Column_List/ from singer/selectselect idsingerOfName resultMapBaseResultMap parameterTypejava.lang.String select include refidBase_Column_List/ from singer where name like #{name}/selectselect idsingerOfSex resultMapBaseResultMap parameterTypejava.lang.Integer select include refidBase_Column_List/ from singer where sex #{sex}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.SongList id columnid jdbcTypeINTEGER propertyid/ result columntitle jdbcTypeVARCHAR propertytitle/ result columnpic jdbcTypeVARCHAR propertypic/ result columnstyle jdbcTypeVARCHAR propertystyle//resultMapresultMap idResultMapWithBLOBs typecom.rabbiter.music.pojo.SongList extendsBaseResultMap result columnintroduction jdbcTypeLONGVARCHAR propertyintroduction//resultMapsql idBase_Column_List id,title,pic,style/sqlsql idBlob_Column_List id,title,pic,style,introduction/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.SongList insert into song_list trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testtitle ! null title, /if if testpic ! null pic, /if if testintroduction ! null introduction, /if if teststyle ! null style, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testtitle ! null #{title}, /if if testpic ! null #{pic}, /if if testintroduction ! null #{introduction}, /if if teststyle ! null #{style}, /if /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.SongList update song_list set if testtitle ! null title #{title}, /if if testpic ! null pic #{pic}, /if if testintroduction ! null introduction #{introduction}, /if if teststyle ! null style #{style}, /if /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from song_list where id#{id}/deleteselect idselectByPrimaryKey resultMapResultMapWithBLOBs parameterTypejava.lang.Integer select include refidBlob_Column_List/ from song_list where id#{id}/selectselect idallSongList resultMapResultMapWithBLOBs select include refidBlob_Column_List/ from song_list/selectselect idsongListOfTitle resultMapResultMapWithBLOBs parameterTypejava.lang.String select include refidBlob_Column_List/ from song_list where title #{title}/selectselect idlikeTitle resultMapResultMapWithBLOBs parameterTypejava.lang.String select include refidBlob_Column_List/ from song_list where title like #{title}/selectselect idlikeStyle resultMapResultMapWithBLOBs parameterTypejava.lang.String select include refidBlob_Column_List/ from song_list where style like #{style}/select resultMap idBaseResultMap typecom.rabbiter.music.pojo.Song id columnid jdbcTypeINTEGER propertyid/ result columnsinger_id jdbcTypeVARCHAR propertysingerId/ result columnname jdbcTypeVARCHAR propertyname/ result columnintroduction jdbcTypeVARCHAR propertyintroduction/ result columncreate_time jdbcTypeTIMESTAMP propertycreateTime/ result columnupdate_time jdbcTypeTIMESTAMP propertyupdateTime/ result columnpic jdbcTypeVARCHAR propertypic/ result columnurl jdbcTypeVARCHAR propertyurl//resultMapresultMap idResultMapWithBLOBs typecom.rabbiter.music.pojo.Song extendsBaseResultMap result columnlyric jdbcTypeLONGVARCHAR propertylyric//resultMapsql idBase_Column_List id,singer_id,name,introduction,create_time,update_time,pic,url/sqlsql idBlob_Column_List id,singer_id,name,introduction,create_time,update_time,pic,lyric,url/sqlinsert idinsert parameterTypecom.rabbiter.music.pojo.Song insert into song trim prefix( suffix) suffixOverrides, if testid ! null id, /if if testsingerId ! null singer_id, /if if testname ! null name, /if if testintroduction ! null introduction, /if create_time,update_time, if testpic ! null pic, /if if testlyric ! null lyric, /if if testurl ! null url, /if /trim trim prefix values ( suffix) suffixOverrides, if testid ! null #{id}, /if if testsingerId ! null #{singerId}, /if if testname ! null #{name}, /if if testintroduction ! null #{introduction}, /if now(),now(), if testpic ! null #{pic}, /if if testlyric ! null #{lyric}, /if if testurl ! null #{url}, /if /trim /insertupdate idupdate parameterTypecom.rabbiter.music.pojo.Song update song set if testsingerId ! null singer_id #{singerId}, /if if testname ! null name #{name}, /if if testintroduction ! null introduction #{introduction}, /if update_time now(), if testpic ! null pic #{pic}, /if if testlyric ! null lyric #{lyric}, /if if testurl ! null url #{url}, /if /set where id #{id}/updatedelete iddelete parameterTypejava.lang.Integer delete from song where id#{id}/deleteselect idselectByPrimaryKey resultMapResultMapWithBLOBs parameterTypejava.lang.Integer select include refidBlob_Column_List/ from song where id#{id}/selectselect idallSong resultMapResultMapWithBLOBs select include refidBlob_Column_List/ from song/selectselect idsongOfName resultMapResultMapWithBLOBs parameterTypejava.lang.String select include refidBlob_Column_List/ from song where name #{name}/selectselect idlikeSongOfName resultMapResultMapWithBLOBs parameterTypejava.lang.String select include refidBlob_Column_List/ from song where name like #{name}/selectselect idsongOfSingerId resultMapResultMapWithBLOBs parameterTypejava.lang.Integer select include refidBlob_Column_List/ from song where singer_id #{singerId}/select 6 界面展示与测试
6.1 前端界面展示
前端首页界面结构框图如图6.1-1所示 前端注册界面结构框图如图6.1-2所示 图6.1-2 前端注册界面结构框图
前端登录界面结构框图如图6.1-3所示 图6.1-3 前端登录界面结构框图
前端歌单界面结构框图如图6.1-4所示 图6.1-4 前端歌单界面结构框图
前端华语伤感女声歌单界面结构框图如图6.1-5所示 图6.1-5 前端华语伤感女声歌单界面结构框图
前端歌手界面结构框图如图6.1-6所示 图6.1-6前端歌手界面结构框图
前端歌手介绍界面结构框图如图6.1-7所示 图6.1-7 前端歌手介绍界面结构框图 前端我的音乐需要注册登录界面结构框图如图6.1-8所示 图6.1-8前端我的音乐界面结构框图
前端设置界面结构框图如图6.1-9所示 图6.1-9 前端设置界面结构框图 6.2 后端界面展示
后端登录界面结构框图如图6.2-1所示 图6.2-1 后端登录界面结构框图
后端系统首页结构框图如图6.2-2所示 图6.2-2 后端系统首页结构框图
后端用户管理界面结构框图如图6.2-3所示 图6.2-3 后端用户管理界面结构框图
后端歌手管理界面结构框图如图6.2-4所示 图6.2-4 后端歌手管理界面结构框图
后端歌单管理界面结构框图如图6.2-5所示 图6.2-5后端歌单管理界面结构框图
6.3 数据库界面展示
数据库构成界面结构框图如图6.3-1所示 图6.3-1 数据库构成界面结构框图
数据库管理员表结构框图如图6.3-2所示 图6.3-2 数据库管理员表结构框图
用户收藏喜爱的歌曲表结构框图如图6.3-3所示 图6.3-3 用户收藏喜爱的歌曲表结构框图
用户评论表结构框图如图6.3-4所示 图6.3-4 用户评论表结构框图
用户信息表结构框图如图6.3-5所示 图6.3-5用户信息表结构框图
歌曲与歌单关联表结构框图如图6.3-6所示 图6.3-6歌曲与歌单关联表结构框图
歌单评分表结构框图如图6.3-7所示 图6.3-7歌单评分表结构框图
歌手信息表结构框图如图6.3-8所示 图6.3-8歌手信息表结构框图
歌曲信息表结构框图如图6.3-9所示 图6.3-9歌曲信息表结构框图