当前位置:   article > 正文

springboot+vue前后端分离实现宿舍管理系统_spring boot+vue宿舍管理项目

spring boot+vue宿舍管理项目

 作者主页:编程指南针

作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-GX-032

开发技术:

   后台:Springboot+springmvc+mybatis-plus

   前台:VUE

运行环境:

   数据库:mysql5.7+Redis

   JDK: 1.8

   Maven: 3.9

  开发工具:IDEA /Eclipse

本系统基于springboot+vue采用前后端分离的方式实现了一个宿舍管理系统,功能完整,界面美观大方,交互简洁方便,比较适合做毕业设计使用。

系统有完整的权限管理系统:用户可以自定义角色、权限和功能菜单,给不同的用户角色分配不同的功能,从而实现灵活的管理功能。

业务功能实现主要包括:

学生管理、宿舍管理、班级管理、宿舍报修管理、请假管理、晚归管理

系统管理主要包括:

用户管理、权限管理、菜单管理、日志管理等

下面展示一下系统的主要功能:

用户登陆

宿舍管理

班级管理

学生管理

班级管理

查看班级学生

维修管理

晚归记录

请假管理

用户管理

角色管理

菜单管理

日志管理

个人中心

部分核心代码如下:

  1. package com.hzvtc.myproject.controller;
  2. import com.github.pagehelper.PageInfo;
  3. import com.hzvtc.myproject.annotation.Log;
  4. import com.hzvtc.myproject.annotation.RequirePermission;
  5. import com.hzvtc.myproject.config.Constant;
  6. import com.hzvtc.myproject.dto.ListQuery;
  7. import com.hzvtc.myproject.entity.BackLate;
  8. import com.hzvtc.myproject.entity.SystemUser;
  9. import com.hzvtc.myproject.service.BackLateService;
  10. import com.hzvtc.myproject.utils.RedisUtil;
  11. import com.hzvtc.myproject.vo.Result;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.validation.annotation.Validated;
  14. import org.springframework.web.bind.annotation.*;
  15. /**
  16. * @author znz
  17. * @date 2021-12-17
  18. */
  19. @RestController
  20. @RequestMapping("/backlate")
  21. public class BackLateController {
  22. @Autowired
  23. private BackLateService backLateService;
  24. @Autowired
  25. private RedisUtil redisUtil;
  26. @PostMapping("/saveOrUpdate")
  27. @RequirePermission(permissions = {"back:save","back:update"})
  28. @Log
  29. public Result<?> saveOrUpdate(@RequestBody @Validated BackLate backLate) {
  30. backLateService.saveOrUpdate(backLate);
  31. return Result.ok("操作成功");
  32. }
  33. @GetMapping("delete/{id}")
  34. @RequirePermission(permissions = {"back:delete"})
  35. @Log
  36. public Result<?> delete(@PathVariable Long id) {
  37. backLateService.delete(id);
  38. return Result.ok("删除成功");
  39. }
  40. @PostMapping("/list")
  41. @RequirePermission(permissions = {"back:list"})
  42. public Result<PageInfo<BackLate>> list(@RequestBody ListQuery<BackLate> listQuery,
  43. @RequestHeader(Constant.HEADER_TOKEN) String token) {
  44. SystemUser systemUser = redisUtil.exchange(token).get();
  45. PageInfo<BackLate> pageInfo = backLateService.list(listQuery, systemUser.getBuildingId());
  46. return Result.<PageInfo<BackLate>>ok().add(pageInfo);
  47. }
  48. @GetMapping("/query/{id}")
  49. @RequirePermission(permissions = {"back:query"})
  50. public Result<BackLate> query(@PathVariable Long id) {
  51. BackLate backLate = backLateService.query(id);
  52. return Result.<BackLate>ok().add(backLate);
  53. }
  54. }

  1. package com.hzvtc.myproject.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hzvtc.myproject.annotation.Log;
  5. import com.hzvtc.myproject.annotation.RequirePermission;
  6. import com.hzvtc.myproject.dto.ListQuery;
  7. import com.hzvtc.myproject.entity.Building;
  8. import com.hzvtc.myproject.entity.Room;
  9. import com.hzvtc.myproject.exception.HttpException;
  10. import com.hzvtc.myproject.service.BuildingService;
  11. import com.hzvtc.myproject.service.RoomService;
  12. import com.hzvtc.myproject.utils.HttpCode;
  13. import com.hzvtc.myproject.vo.Result;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.validation.annotation.Validated;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.util.List;
  18. /**
  19. * @author znz
  20. * @date 2021-12-19
  21. */
  22. @RestController
  23. @RequestMapping("/building")
  24. public class BuildingController {
  25. @Autowired
  26. private BuildingService buildingService;
  27. @Autowired
  28. private RoomService roomService;
  29. @GetMapping("/listAll")
  30. @RequirePermission(permissions = {"manage:building:list"})
  31. public Result<List<Building>> listAll() {
  32. List<Building> list = buildingService.listAll();
  33. return Result.<List<Building>>ok().add(list);
  34. }
  35. @GetMapping("/list")
  36. @RequirePermission(permissions = {"manage:building:list"})
  37. public Result<List<Building>> list() {
  38. List<Building> list = buildingService.list();
  39. return Result.<List<Building>>ok().add(list);
  40. }
  41. @GetMapping("delete")
  42. @RequirePermission(permissions = {"manage:building:delete"})
  43. @Log("删除building")
  44. public Result<?> delete(@RequestParam("id") Long id) {
  45. List<Room> list = roomService.listByBuildingId(id);
  46. if (list.size() > 0) {
  47. throw new HttpException(HttpCode.FAILED, "该节点下或子节点还有寝室,无法删除");
  48. }
  49. buildingService.delete(id);
  50. return Result.ok("删除成功");
  51. }
  52. @GetMapping("/query")
  53. @RequirePermission(permissions = {"manage:building:query"})
  54. public Result<Building> query(@RequestParam("id") Long id) {
  55. Building building = buildingService.query(id).orElseThrow(() -> new HttpException(HttpCode.FAILED, "该数据不存在"));
  56. return Result.<Building>ok().add(building);
  57. }
  58. @PostMapping("/saveOrUpdate")
  59. @RequirePermission(permissions = {"manage:building:save","manage:building:update"})
  60. @Log
  61. public Result<?> saveOrUpdate(@RequestBody @Validated Building building) {
  62. if (building.getId() == null) {
  63. buildingService.save(building);
  64. } else {
  65. if (building.getId().equals(building.getParentId())) {
  66. throw new HttpException(HttpCode.FAILED, "父节点不能为自己");
  67. }
  68. buildingService.update(building);
  69. }
  70. return Result.ok("操作成功");
  71. }
  72. }

  1. package com.hzvtc.myproject.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hzvtc.myproject.config.Constant;
  5. import com.hzvtc.myproject.dto.ListQuery;
  6. import com.hzvtc.myproject.dto.Message;
  7. import com.hzvtc.myproject.entity.DepartApplication;
  8. import com.hzvtc.myproject.entity.DepartApplicationUser;
  9. import com.hzvtc.myproject.entity.SystemUser;
  10. import com.hzvtc.myproject.exception.HttpException;
  11. import com.hzvtc.myproject.service.DepartApplicationService;
  12. import com.hzvtc.myproject.service.StudentService;
  13. import com.hzvtc.myproject.service.SystemUserService;
  14. import com.hzvtc.myproject.socket.WebSocket;
  15. import com.hzvtc.myproject.utils.HttpCode;
  16. import com.hzvtc.myproject.utils.RedisUtil;
  17. import com.hzvtc.myproject.vo.Result;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.util.List;
  21. /**
  22. * @author znz
  23. * @date 2021-12-09
  24. */
  25. @RestController
  26. @RequestMapping("/depart")
  27. public class DepartApplicationController {
  28. @Autowired
  29. private DepartApplicationService departApplicationService;
  30. @Autowired
  31. private StudentService studentService;
  32. @Autowired
  33. private RedisUtil redisUtil;
  34. @Autowired
  35. private SystemUserService systemUserService;
  36. @PostMapping("/listMy")
  37. public Result<PageInfo<DepartApplication>> listMyApplication(@RequestBody ListQuery<DepartApplication> listQuery,
  38. @RequestHeader(Constant.HEADER_TOKEN) String token) {
  39. Long id = redisUtil.get(token);
  40. PageHelper.startPage(listQuery.getPage(), listQuery.getRows());
  41. List<DepartApplication> list = departApplicationService.listMyApplication(id);
  42. PageInfo<DepartApplication> pageInfo = new PageInfo<>(list);
  43. return Result.<PageInfo<DepartApplication>>ok().add(pageInfo);
  44. }
  45. @PostMapping("/listMyFlow")
  46. public Result<PageInfo<DepartApplicationUser>> listMyFlow(@RequestBody ListQuery<DepartApplication> listQuery,
  47. @RequestHeader(Constant.HEADER_TOKEN) String token) {
  48. Long id = redisUtil.get(token);
  49. PageHelper.startPage(listQuery.getPage(), listQuery.getRows());
  50. List<DepartApplicationUser> list = departApplicationService.listMyFlow(id);
  51. PageInfo<DepartApplicationUser> pageInfo = new PageInfo<>(list);
  52. return Result.<PageInfo<DepartApplicationUser>>ok().add(pageInfo);
  53. }
  54. @GetMapping("/listFlow/{id}")
  55. public Result<List<DepartApplicationUser>> listApplicationFlow(@PathVariable("id") Long id) {
  56. List<DepartApplicationUser> list = departApplicationService.listApplicationFlow(id);
  57. return Result.<List<DepartApplicationUser>>ok().add(list);
  58. }
  59. @PostMapping("/update")
  60. public Result<?> update(@RequestBody DepartApplicationUser departApplicationUser,
  61. @RequestHeader(Constant.HEADER_TOKEN) String token) {
  62. String msg = "成功,";
  63. SystemUser user = redisUtil.exchange(token).get();
  64. DepartApplicationUser applicationUser =
  65. departApplicationService
  66. .getApplicationUser(departApplicationUser.getId());
  67. if (!user.getId().equals(applicationUser.getOperateUserId())) {
  68. throw new HttpException(HttpCode.FAILED, "无法审核");
  69. }
  70. if (applicationUser.getIsAgree() != null) {
  71. throw new HttpException(HttpCode.FAILED, "已审核过,无法修改");
  72. }
  73. departApplicationService.update(departApplicationUser);
  74. DepartApplication application =
  75. departApplicationService
  76. .getByDepartApplicationUserId(departApplicationUser.getId());
  77. if (departApplicationUser.getIsAgree()) {
  78. if (user.getLeaderId() == null) {
  79. studentService.delete(application.getStudentId());
  80. msg += "该学生已成功退宿";
  81. } else {
  82. departApplicationService.saveApplication(user.getLeaderId(), application.getId());
  83. WebSocket.sendMessage(user.getLeaderId(),
  84. new Message().setTitle("新的退宿申请").setType(2).setMessageBody(application.getReason()),
  85. systemUserService);
  86. msg += "等待上一级审核";
  87. }
  88. } else {
  89. msg += "审核未通过";
  90. }
  91. return Result.ok(msg);
  92. }
  93. @GetMapping("delete/{id}")
  94. public Result<?> delete(@PathVariable Long id) {
  95. departApplicationService.deleteApplication(id);
  96. return Result.ok("撤销成功");
  97. }
  98. @GetMapping("/query/{id}")
  99. public Result<DepartApplication> query(@PathVariable Long id) {
  100. DepartApplication data = departApplicationService.getApplication(id);
  101. return Result.<DepartApplication>ok().add(data);
  102. }
  103. }

  1. package com.hzvtc.myproject.controller;
  2. import com.hzvtc.myproject.annotation.Log;
  3. import com.hzvtc.myproject.annotation.RequirePermission;
  4. import com.hzvtc.myproject.entity.Faculty;
  5. import com.hzvtc.myproject.entity.Student;
  6. import com.hzvtc.myproject.exception.HttpException;
  7. import com.hzvtc.myproject.service.FacultyService;
  8. import com.hzvtc.myproject.service.StudentService;
  9. import com.hzvtc.myproject.utils.HttpCode;
  10. import com.hzvtc.myproject.vo.Result;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.validation.annotation.Validated;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.util.List;
  15. /**
  16. * @author znz
  17. * @date 2021-12-19
  18. */
  19. @RestController
  20. @RequestMapping("/faculty")
  21. public class FacultyController {
  22. @Autowired
  23. private FacultyService facultyService;
  24. @GetMapping("/list")
  25. @RequirePermission(permissions = {"faculty:list"})
  26. public Result<List<Faculty>> list() {
  27. List<Faculty> list = facultyService.list();
  28. return Result.<List<Faculty>>ok().add(list);
  29. }
  30. @GetMapping("/listAll")
  31. @RequirePermission(permissions = {"faculty:list"})
  32. public Result<List<Faculty>> listAll() {
  33. List<Faculty> list = facultyService.listAll();
  34. return Result.<List<Faculty>>ok().add(list);
  35. }
  36. @PostMapping("/saveOrUpdate")
  37. @RequirePermission(permissions = {"faculty:save", "faculty:update"})
  38. @Log("添加或更新学院")
  39. public Result<?> saveOrUpdate(@RequestBody @Validated Faculty faculty) {
  40. if (faculty.getId() == null) {
  41. facultyService.insert(faculty);
  42. } else {
  43. if (faculty.getId().equals(faculty.getParentId())) {
  44. throw new HttpException(HttpCode.FAILED, "父节点不能为自己");
  45. }
  46. facultyService.update(faculty);
  47. }
  48. return Result.ok("操作成功");
  49. }
  50. @GetMapping("/delete")
  51. @RequirePermission(permissions = {"faculty:delete"})
  52. @Log("删除学院")
  53. public Result<?> delete(@RequestParam("id") Long id) {
  54. facultyService.delete(id);
  55. return Result.ok("删除成功");
  56. }
  57. @GetMapping("/query")
  58. @RequirePermission(permissions = {"faculty:query"})
  59. public Result<Faculty> query(@RequestParam("id") Long id) {
  60. Faculty faculty = facultyService.query(id).orElseThrow(() -> new HttpException(HttpCode.FAILED, "没有该数据"));
  61. return Result.<Faculty>ok().add(faculty);
  62. }
  63. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/858090
推荐阅读
相关标签
  

闽ICP备14008679号