基于javaweb+mysql的ssm音乐管理系统(java+ssm+jsp+jquery+h-ui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM音乐管理系统(java+ssm+jsp+jquery+h-ui+mysql)
项目介绍
本在线音乐网站采用JSP动态网页开发技术,JAVA编程语言,基于B/S架构,使用SSM框架技术,使用MySQL数据库,充分保证了系统的稳定性和安全性。
该系统主要分为前台和后台两大功能模块,共包含两个角色:用户、管理员。 具体的系统功能如下: 1.前台功能 前台首页、音乐浏览、音乐搜索、音乐分类查找、音乐详情、音乐播放、音乐下载、添加收藏、新闻公告、留言交流、用户注册、用户登陆、个人中心、用户信息修改、我的收藏、意见反馈、修改密码等功能。 2.后台功能 后台系统登陆、管理员管理、用户信息管理、音乐管理、音乐类型管理、新闻公告管理、用户评价管理、意见反馈管理、留言交流管理、消息回复管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、MyBatis UI界面:JSP、jQuery 、H-ui 数据库:MySQL
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
buf.append(")");
condition.put(buf.toString(), "and");
String field = null;
if (condition.size() > 0) {
condition.put(condition.entrySet().iterator().next().getKey(), "");
int count = this.userService.getCount(condition, field);
if (order != null && order.length() > 0 & "desc".equals(desc)) {
order = order + " desc";
List<User> list = this.userService.getList(condition, pageNo, pageSize, order, field);
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("total", count);
int size = list.size();
if (size > 0) {
* 我的音乐控制层
*/
@Controller
@RequestMapping("/myMusic")
public class MyMusicController {
@Autowired
protected WebResponse webResponse;
@Resource
protected IMyMusicService myMusicService;
// @Autowired
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("user_name", user_name);
paramMap.put("user_password", user_password);
data = paramMap;
User user = new User();
user.setUser_id(userId);
System.out.println("登录的id:" + user.getUser_id());
System.out.println("登录的用户名:" + session.getAttribute(tname));
System.out.println("前端,用户名:" + user_name + " 密码:" + user_password);
System.out.println("根据前端在数据库中查找到的用户名:" + tname + " 用户的id:" + userId);
// 用户名和密码匹配不成功,则返回的用户名为空
if (tname == null) {
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("total", count);
int size = list.size();
if (size > 0) {
List<User> listFont = new ArrayList<User>();
User vo;
User voFont = new User();
for (int i = 0; i < size; i++) {
vo = list.get(i);
BeanUtils.copyProperties(vo, voFont);
public String getAdminTestList(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@RequestParam(defaultValue = "1", required = false) Integer pageNo,
@RequestParam(defaultValue = "10", required = false) Integer pageSize,
@RequestParam(defaultValue = "正常", required = false) String tbStatus,
@RequestParam(required = false) String keyword,
@RequestParam(defaultValue = "test_id", required = false) String order,
@RequestParam(defaultValue = "desc", required = false) String desc) {
Object data = null;
String statusMsg = "";
int statusCode = 200;
condition.put(buf.toString(), "and");
String field = null;
if (condition.size() > 0) {
condition.put(condition.entrySet().iterator().next().getKey(), "");
int count = this.musicLinkService.getCount(condition, field);
if (order != null && order.length() > 0 & "desc".equals(desc)) {
order = order + " desc";
// 从数据库中获取数据,并把对象的结果集存到list列表中
List<MusicLink> list = this.musicLinkService.getList(condition, pageNo, pageSize, order, field);
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("total", count);
// 如果数据库有15条音乐,则list中有15个对象,则size的大小为15
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
protected WebResponse webResponse;
@Resource
protected IUserService userService;
@Resource
protected IMyMusicService MyMusicService;
@Autowired
UserService userService2;
String newName = null;
String tname = userService2.login(user_name, user_password);
String user_Id = userService2.getUserById(user_name, user_password);
// newUserId = user_Id; //修改密码用的
int userId = 0;
try {
// 判断字符串是否是数字,并且抛出异常
// boolean NotisNum
// =(user_Id.equals(null)||user_Id.equals("")||user_Id.equals("null"));
boolean NotisNum = (user_Id.equals("null"));
// System.out.println(NotisNum);
int size = list.size();
if (size > 0) {
List<MusicLink> listFont = new ArrayList<MusicLink>();
MusicLink vo;
MusicLink voFont = new MusicLink();
// 循环将获取到的对象及结构属性克隆到一个新的voFont对象中,并保存到动态数组中
for (int i = 0; i < size; i++) {
vo = list.get(i);
// 通过java反射将类中当前属性字段对应的内容复制到另外一个类中
BeanUtils.copyProperties(vo, voFont);
listFont.add(voFont);
} catch (Exception e) {
System.out.println("我的音乐显示列表前用户id:" + userId);
Object data = null;
String statusMsg = "";
int statusCode = 200;
LinkedHashMap<String, String> condition = new LinkedHashMap<String, String>();
/*
* if (tbStatus != null && tbStatus.length() > 0) { condition.put("tb_status='"
* + tbStatus + "'", "and"); }
*/
statusMsg = "no record!!!";
return webResponse.getWebResponse(statusCode, statusMsg, data);
return webResponse.getWebResponse(statusCode, statusMsg, data);
// 歌曲收藏
@RequestMapping(value = "/addMusicCollect", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse addMusicCollect(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@RequestParam(required = false) int song_id, @RequestParam(required = false) String user_name,
@RequestParam(required = false) String user_password, @RequestParam(required = false) String songName) {
WebResponse webResponse = new WebResponse();
/*
*/
private WebResponse addOrEditUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
Object data, User user, String user_name, String user_password, boolean isAdd) {
String statusMsg = "";
Integer statusCode = 200;
if (user_name != null && !("".equals(user_name.trim()))) {
if (user_name.length() > 255) {
statusMsg = " 参数长度过长错误,testName";
statusCode = 201;
for (int i = 0; i < size; i++) {
vo = list.get(i);
// 通过java反射将类中当前属性字段对应的内容复制到另外一个类中
BeanUtils.copyProperties(vo, voFont);
listFont.add(voFont);
voFont = new MyMusic();
map.put("list", listFont);
data = map;
statusMsg = "根据条件获取分页数据成功!!!";
} else {
map.put("list", list);
data = map;
statusCode = 202;
int statusCode = 200;
LinkedHashMap<String, String> condition = new LinkedHashMap<String, String>();
if (tbStatus != null && tbStatus.length() > 0) {
condition.put("tb_status='" + tbStatus + "'", "and");
if (keyword != null && keyword.length() > 0) {
StringBuffer buf = new StringBuffer();
buf.append("(");
buf.append("test_name like '%").append(keyword).append("%'");
buf.append(" or ");
buf.append("info like '%").append(keyword).append("%'");
data = paramMap;
User user = new User();
user.setUser_id(userId);
System.out.println("登录的id:" + user.getUser_id());
System.out.println("登录的用户名:" + session.getAttribute(tname));
System.out.println("前端,用户名:" + user_name + " 密码:" + user_password);
System.out.println("根据前端在数据库中查找到的用户名:" + tname + " 用户的id:" + userId);
// 用户名和密码匹配不成功,则返回的用户名为空
if (tname == null) {
System.out.println("用户不存在");
System.out.println();
statusMsg = "用户或密码错误!";
statusCode = 201;
@ResponseBody
public WebResponse editUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
String user_id, @RequestParam(required = false) String user_name,
@RequestParam(required = false) String user_password) {
Object data = null;
String statusMsg = "";
Integer statusCode = 200;
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("user_id", user_id);
paramMap.put("user_name", user_name);
boolean NotisNum = (user_Id.equals("null"));
// System.out.println(NotisNum);
if (!NotisNum) {
userId = Integer.parseInt(user_Id);
} catch (Exception e) {
System.out.println("我的音乐显示列表前用户id:" + userId);
Object data = null;
String statusMsg = "";
int statusCode = 200;
LinkedHashMap<String, String> condition = new LinkedHashMap<String, String>();
/*
* if (tbStatus != null && tbStatus.length() > 0) { condition.put("tb_status='"
* + tbStatus + "'", "and"); }
voFont = new User();
map.put("list", listFont);
data = map;
statusMsg = "根据条件获取分页数据成功!!!";
} else {
map.put("list", list);
data = map;
statusCode = 202;
statusMsg = "no record!!!";
return webResponse.getWebResponse(statusCode, statusMsg, data);
return webResponse.getWebResponse(statusCode, statusMsg, data);
@RequestMapping(value = "/getAdminUserList", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")