——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明








基于javaweb的SpringBoot新闻视频发布推荐评论系统(java+springboot+maven+vue+mysql)
管理员
admin 123456
用户:
用户1 123456
用户2 123456
用户3 123456
用户4 123456
用户5 123456
用户6 123456
front-end-admin前端如果要单独运行,启动命令为:npm run serve
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| public R add(@RequestBody DiscusspaixingbangEntity discusspaixingbang, HttpServletRequest request){ discusspaixingbang.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); discusspaixingbangService.insert(discusspaixingbang); return R.ok(); }
@RequestMapping("/update") public R update(@RequestBody DiscusspaixingbangEntity discusspaixingbang, HttpServletRequest request){ discusspaixingbangService.updateById(discusspaixingbang); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ discusspaixingbangService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }
@RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type); if(type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); Date remindStartDate = null;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
@RestController @RequestMapping("/xinwen") public class XinwenController { @Autowired private XinwenService xinwenService;
@RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,XinwenEntity xinwen, HttpServletRequest request){ EntityWrapper<XinwenEntity> ew = new EntityWrapper<XinwenEntity>(); PageUtils page = xinwenService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwen), params), params));
return R.ok().put("data", page); }
@IgnoreAuth
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| return R.ok(); }
@RequestMapping("/update") public R update(@RequestBody UserEntity user){
UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())); if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { return R.error("用户名已存在。"); } userService.updateById(user); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ userService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
@RestController @RequestMapping("/xinwen") public class XinwenController { @Autowired private XinwenService xinwenService;
@RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,XinwenEntity xinwen, HttpServletRequest request){ EntityWrapper<XinwenEntity> ew = new EntityWrapper<XinwenEntity>(); PageUtils page = xinwenService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwen), params), params));
return R.ok().put("data", page); }
@IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,XinwenEntity xinwen, HttpServletRequest request){ EntityWrapper<XinwenEntity> ew = new EntityWrapper<XinwenEntity>(); PageUtils page = xinwenService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwen), params), params)); return R.ok().put("data", page); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
@RequestMapping("users") @RestController public class UserController{ @Autowired private UserService userService; @Autowired private TokenService tokenService;
@IgnoreAuth @PostMapping(value = "/login") public R login(String username, String password, String captcha, HttpServletRequest request) { UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username)); if(user==null || !user.getPassword().equals(password)) { return R.error("账号或密码不正确");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| } xinwenService.updateById(xinwen); return R.ok("投票成功"); }
@RequestMapping("/save") public R save(@RequestBody XinwenEntity xinwen, HttpServletRequest request){ xinwen.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); xinwenService.insert(xinwen); return R.ok(); }
@RequestMapping("/add") public R add(@RequestBody XinwenEntity xinwen, HttpServletRequest request){ xinwen.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); xinwenService.insert(xinwen); return R.ok(); }
@RequestMapping("/update") public R update(@RequestBody XinwenEntity xinwen, HttpServletRequest request){ xinwenService.updateById(xinwen); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ xinwenService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=502023041010201gg
https://javayms.pages.dev?id=502023041010201gg