一、项目简述
功能: 用户管理模块:用户登录、用户注册、修改密码 榜单列表模块:动态地从数据库中获取歌曲的链接和数据 在榜单中显示 歌曲搜索模块:在首页的搜索框中可以输入关键字进行歌 曲的模糊搜索 歌曲收藏模块:在榜单列表中或搜索页面中可以点击歌曲 进行收藏 我的音乐模块:收藏的歌曲会被添加到我的音乐列表中, 在我的音乐列表中也可以对歌曲进行删除操作 音乐播放器模块:在榜单、搜索页面和我的音乐列表等地 方点击歌曲可以炼专到播放页面进行播放。播放页面显示 播放进度条,删除歌曲,暂停等操作。播放页面背景为模 糊背景,根据歌手的专辑图片自动变化。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + Bootstrap+ maven 等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@RequestParam(required = false) String keyword,
@RequestParam(defaultValue = "ml_id", required = false) String order,
@RequestParam(defaultValue = "desc", required = false) String desc) {
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"); }
*/
if (keyword != null && keyword.length() > 0) {
StringBuffer buf = new StringBuffer();
listFont.add(voFont);
voFont = new MusicLink();
}
map.put("list", listFont);
// data是一个map对象
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);
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) {
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);
listFont.add(voFont);
voFont = new User();
}
map.put("list", listFont);
data = map;
statusMsg = "根据条件获取分页数据成功!!!";
} else {
map.put("list", list);
data = map;
}
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
int num = this.userService.update(user);
if (num > 0) {
statusMsg = "成功修改!!!";
} else {
statusCode = 202;
statusMsg = "update false";
}
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
@RequestMapping(value = "/getUserById", produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse getUserById(String user_id) {
Object data = user_id;
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();
MusicLink musicLink = new MusicLink();
User user = new User();
System.out.println("歌曲id:" + song_id + " 用户名:" + user_name + " 户用密码:" + user_password);
Object data = null;
String statusMsg = "";
int statusCode = 200;
String user_Id = null;
try {
user_Id = musicLinkService2.getUserId(user_name, user_password);
} catch (Exception e) {
@RequestParam(defaultValue = "desc", required = false) String desc) {
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"); }
*/
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("%'");
buf.append(" or ");
buf.append("other like '%").append(keyword).append("%'");
buf.append(")");
statusMsg = "no record!!!";
}
return webResponse.getWebResponse(statusMsg, data);
}
@RequestMapping(value = "/getUserList", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse getTestList(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;
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 ");
public class UserController {
@Autowired
protected WebResponse webResponse;
@Resource
protected IUserService userService;
@Resource
protected IMyMusicService MyMusicService;
@Autowired
UserService userService2;
String newName = null;
// 登录功能
@RequestMapping(value = "/loginPage", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse loginCon(HttpServletRequest request, HttpSession session) {
// 取参数的方法,对应登录表单中的用户名name="user_name"
String user_name = request.getParameter("user_name");
String user_password = request.getParameter("user_password");
// 调用mapper层的登录的方法,从数据库中匹配用户名和密码,并放回用户名
String tname = userService2.login(user_name, user_password);
String user_Id = userService2.getUserById(user_name, user_password);
@RequestMapping(value = "/addOrEditUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse addOrEditTest(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 = 201;
String rearchName = null;
try {
rearchName = this.userService.rearchUserName(user_name);
if (!(rearchName.equals("null"))) {
return webResponse.getWebResponse(statusCode, statusMsg, data);
}
} catch (Exception e) {
}
System.out.println("判断用户是否重复:" + rearchName);
if (user_id == null || user_id.length() == 0) {
return this.addUser(request, response, session, user_name, user_password);
} else {
return this.editUser(request, response, session, user_id, user_name, user_password);
}
}
// 添加用户
@RequestMapping(value = "/addUser", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public WebResponse addUser(HttpServletRequest request, HttpServletResponse response, HttpSession session,
} else {
statusMsg = "no record!!!";
}
return webResponse.getWebResponse(statusMsg, data);
}
}
我的音乐控制层:
/**
* 我的音乐控制层
*/
@Controller
@RequestMapping("/myMusic")
public class MyMusicController {
@Autowired
protected WebResponse webResponse;
@Resource
protected IMyMusicService myMusicService;
// @Autowired
// MyMusicService myMusicService2;
// 歌曲收藏