那时给我们如是说两个在线视频网络平台,机能强大、介面迷人,同时实现了音乐创作网络平台须要的大部份机能。
同时实现控制技术
后端
Spring Boot MyBatis MySql
后端
Vue Vue-Router Vuex Axios ElementUI
机能如是说
音乐创作播映、使用者登入注册登记、使用者重要信息撰稿、肖像修正、曲目、选曲搜寻、选曲评分、选曲、曲目文章、选曲条目、女歌手条目巨集表明、原曲并行表明、音乐创作珍藏、浏览、拖曳掌控、排气扇、前台对使用者、曲目、女歌手、选曲重要信息的管理工作。
标识符展现
/**
* 女歌手掌控类
*/@RestController@RequestMapping(“/singer”)publicclassSingerController {@AutowiredprivateSingerService singerService;/**
* 加进女歌手
*/@RequestMapping(value =“/add”, method = RequestMethod.POST)publicObjectaddSinger(HttpServletRequest request) {
JSONObject jsonObject =newJSONObject();Stringname = request.getParameter(“name”).trim();//姓名Stringsex = request.getParameter(“sex”).trim();//性别Stringpic = request.getParameter(“pic”).trim();//肖像Stringbirth = request.getParameter(“birth”).trim();//生日Stringlocation = request.getParameter(“location”).trim();//地区Stringintroduction = request.getParameter(“introduction”).trim();//简介//把生日转换成Date格式DateFormat dateFormat =newSimpleDateFormat(“yyyy-MM-dd”);DatebirthDate =newDate();try{
birthDate = dateFormat.parse(birth);
}catch(ParseException e) {
e.printStackTrace();
}//保存到女歌手的对象中Singer singer =newSinger();
singer.setName(name);
singer.setSex(newByte(sex));
singer.setPic(pic);
singer.setBirth(birthDate);
singer.setLocation(location);
singer.setIntroduction(introduction);booleanflag = singerService.insert(singer);if(flag) {//保存成功jsonObject.put(Consts.CODE,1);
jsonObject.put(Consts.MSG,“加进成功”);returnjsonObject;
}
jsonObject.put(Consts.CODE,0);
jsonObject.put(Consts.MSG,“加进失败”);returnjsonObject;
}/**
* 修正女歌手
*/@RequestMapping(value =“/update”, method = RequestMethod.POST)publicObjectupdateSinger(HttpServletRequest request) {
JSONObject jsonObject =newJSONObject();Stringid = request.getParameter(“id”).trim();//主键Stringname = request.getParameter(“name”).trim();//姓名Stringsex = request.getParameter(“sex”).trim();//性别Stringbirth = request.getParameter(“birth”).trim();//生日Stringlocation = request.getParameter(“location”).trim();//地区Stringintroduction = request.getParameter(“introduction”).trim();//简介//把生日转换成Date格式DateFormat dateFormat =newSimpleDateFormat(“yyyy-MM-dd”);DatebirthDate =newDate();try{
birthDate = dateFormat.parse(birth);
}catch(ParseException e) {
e.printStackTrace();
}//保存到女歌手的对象中Singer singer =newSinger();
singer.setId(Integer.parseInt(id));
singer.setName(name);
singer.setSex(newByte(sex));
singer.setBirth(birthDate);
singer.setLocation(location);
singer.setIntroduction(introduction);booleanflag = singerService.update(singer);if(flag) {//保存成功jsonObject.put(Consts.CODE,1);
jsonObject.put(Consts.MSG,“修正成功”);returnjsonObject;
}
jsonObject.put(Consts.CODE,0);
jsonObject.put(Consts.MSG,“修正失败”);returnjsonObject;
}/**
* 删除女歌手
*/@RequestMapping(value =“/delete”, method = RequestMethod.GET)publicObjectdeleteSinger(HttpServletRequest request) {Stringid = request.getParameter(“id”).trim();//主键booleanflag = singerService.delete(Integer.parseInt(id));returnflag;
}/**
* 根据主键查询整个对象
*/@RequestMapping(value =“/selectByPrimaryKey”, method = RequestMethod.GET)publicObjectselectByPrimaryKey(HttpServletRequest request) {Stringid = request.getParameter(“id”).trim();//主键returnsingerService.selectByPrimaryKey(Integer.parseInt(id));
}/**
* 查询大部份女歌手
*/@RequestMapping(value =“/allSinger”, method = RequestMethod.GET)publicObjectallSinger(HttpServletRequest request) {returnsingerService.allSinger();
}/**
* 根据女歌手名字模糊查询条目
*/@RequestMapping(value =“/singerOfName”, method = RequestMethod.GET)publicObjectsingerOfName(HttpServletRequest request) {Stringname = request.getParameter(“name”).trim();//女歌手名字returnsingerService.singerOfName(“%” name “%”);
}/**
* 根据性别查询
*/@RequestMapping(value =“/singerOfSex”, method = RequestMethod.GET)publicObjectsingerOfSex(HttpServletRequest request) {Stringsex = request.getParameter(“sex”).trim();//性别returnsingerService.singerOfSex(Integer.parseInt(sex));
}/**
* 更新女歌手图片
*/@RequestMapping(value =“/updateSingerPic”, method = RequestMethod.POST)publicObjectupdateSingerPic(@RequestParam(“file”) MultipartFile avatorFile,@RequestParam(“id”) int id) {
JSONObject jsonObject =newJSONObject();if(avatorFile.isEmpty()) {
jsonObject.put(Consts.CODE,0);
jsonObject.put(Consts.MSG,“文件上传失败”);returnjsonObject;
}//文件名=当前时间到毫秒 原来的文件名StringfileName = System.currentTimeMillis() avatorFile.getOriginalFilename();//文件路径StringfilePath = System.getProperty(“user.dir”) System.getProperty(“file.separator”) “img” System.getProperty(“file.separator”) “singerPic”;//如果文件路径不存在,新增该路径File file1 =newFile(filePath);if(!file1.exists()) {
file1.mkdir();
}//实际的文件地址File dest =newFile(filePath System.getProperty(“file.separator”) fileName);//存储到数据库里的相对文件地址StringstoreAvatorPath =“/img/singerPic/” fileName;try{
avatorFile.transferTo(dest);
Singer singer =newSinger();
singer.setId(id);
singer.setPic(storeAvatorPath);booleanflag = singerService.update(singer);if(flag) {
jsonObject.put(Consts.CODE,1);
jsonObject.put(Consts.MSG,“上传成功”);
jsonObject.put(“pic”, storeAvatorPath);returnjsonObject;
}
jsonObject.put(Consts.CODE,0);
jsonObject.put(Consts.MSG,“上传失败”);returnjsonObject;
}catch(IOException e) {
jsonObject.put(Consts.CODE,0);
jsonObject.put(Consts.MSG,“上传失败” e.getMessage());
}finally{returnjsonObject;
}
}
}
2.分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3.不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4.本站提供的源码、模板、插件等其他资源,都不包含技术服务请大家谅解!
5.如有链接无法下载或失效,请联系管理员处理!
6.本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!