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










基于javaweb的SpringBoot学生读书笔记共享(java+springboot+maven+mybaits+vue+elementui+mysql)
项目介绍
基于基于Springboot + vue实现的学生读书笔记共享
本系统包含管理员、用户两个主要角色。
管理员角色:首页、个人中心、用户管理、笔记分享管理、个人笔记管理、管理员管理、交流互动、系统管理。
用户角色:首页、个人中心、笔记分享管理、个人笔记管理、我的收藏管理。
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
后端启动类:StartApplication
前端启动命令: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 41 42 43 44
|
@RestController @RequestMapping("/gerenbiji") public class GerenbijiController { @Autowired private GerenbijiService gerenbijiService;
@RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,GerenbijiEntity gerenbiji, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString(); if(tableName.equals("yonghu")) { gerenbiji.setYonghuming((String)request.getSession().getAttribute("username")); } EntityWrapper<GerenbijiEntity> ew = new EntityWrapper<GerenbijiEntity>(); PageUtils page = gerenbijiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, gerenbiji), params), params));
return R.ok().put("data", page); }
@IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,GerenbijiEntity gerenbiji, HttpServletRequest request){ EntityWrapper<GerenbijiEntity> ew = new EntityWrapper<GerenbijiEntity>(); PageUtils page = gerenbijiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, gerenbiji), params), params)); return R.ok().put("data", page); }
@RequestMapping("/lists")
|
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
| * @return */ @RequestMapping("/matchFace") @IgnoreAuth public R matchFace(String face1, String face2,HttpServletRequest request) { if(client==null) { String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue(); String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue(); String token = BaiduUtil.getAuth(APIKey, SecretKey); if(token==null) { return R.error("请在配置管理中正确配置APIKey和SecretKey"); } client = new AipFace(null, APIKey, SecretKey); client.setConnectionTimeoutInMillis(2000); client.setSocketTimeoutInMillis(60000); } JSONObject res = null; try { File path = new File(ResourceUtils.getURL("classpath:static").getPath()); if(!path.exists()) { path = new File(""); } File upload = new File(path.getAbsolutePath(),"/upload/"); File file1 = new File(upload.getAbsolutePath()+"/"+face1); File file2 = new File(upload.getAbsolutePath()+"/"+face2); String img1 = Base64Util.encode(FileUtil.FileToByte(file1)); String img2 = Base64Util.encode(FileUtil.FileToByte(file2)); MatchRequest req1 = new MatchRequest(img1, "BASE64"); MatchRequest req2 = new MatchRequest(img2, "BASE64"); ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>(); requests.add(req1); requests.add(req2); res = client.match(requests); System.out.println(res.get("result")); } catch (FileNotFoundException e) { e.printStackTrace(); return R.error("文件不存在"); } catch (IOException e) { e.printStackTrace(); } return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString())); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
@RequestMapping("users") @RestController public class UserController{ @Autowired private UserService userService; @Autowired private TokenService tokenService;
@IgnoreAuth @PostMapping(value = "/login")
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
@RestController @RequestMapping("/storeup") public class StoreupController { @Autowired private StoreupService storeupService;
|
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
|
@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("账号或密码不正确"); } String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); return R.ok().put("token", token); }
@IgnoreAuth @PostMapping(value = "/register") public R register(@RequestBody UserEntity user){
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) { return R.error("用户已存在"); } userService.insert(user); return R.ok(); }
@GetMapping(value = "logout")
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=461524512608201nq
https://javayms.pages.dev?id=461524512608201nq