项目编号:BS-GX-032
开发技术:
后台:Springboot+springmvc+mybatis-plus
前台:VUE
运行环境:
数据库:mysql5.7+Redis
JDK: 1.8
Maven: 3.9
开发工具:IDEA /Eclipse
本系统基于springboot+vue采用前后端分离的方式实现了一个宿舍管理系统,功能完整,界面美观大方,交互简洁方便,比较适合做毕业设计使用。
系统有完整的权限管理系统:用户可以自定义角色、权限和功能菜单,给不同的用户角色分配不同的功能,从而实现灵活的管理功能。
业务功能实现主要包括:
学生管理、宿舍管理、班级管理、宿舍报修管理、请假管理、晚归管理
系统管理主要包括:
用户管理、权限管理、菜单管理、日志管理等
下面展示一下系统的主要功能:
用户登陆
宿舍管理
班级管理
学生管理
班级管理
查看班级学生
维修管理
晚归记录
请假管理
用户管理
角色管理
菜单管理
日志管理
个人中心
部分核心代码如下:
package com.hzvtc.myproject.controller; import com.github.pagehelper.PageInfo; import com.hzvtc.myproject.annotation.Log; import com.hzvtc.myproject.annotation.RequirePermission; import com.hzvtc.myproject.config.Constant; import com.hzvtc.myproject.dto.ListQuery; import com.hzvtc.myproject.entity.BackLate; import com.hzvtc.myproject.entity.SystemUser; import com.hzvtc.myproject.service.BackLateService; import com.hzvtc.myproject.utils.RedisUtil; import com.hzvtc.myproject.vo.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * @author znz * @date 2021-12-17 */ @RestController @RequestMapping("/backlate") public class BackLateController { @Autowired private BackLateService backLateService; @Autowired private RedisUtil redisUtil; @PostMapping("/saveOrUpdate") @RequirePermission(permissions = {"back:save","back:update"}) @Log public Result<?> saveOrUpdate(@RequestBody @Validated BackLate backLate) { backLateService.saveOrUpdate(backLate); return Result.ok("操作成功"); } @GetMapping("delete/{id}") @RequirePermission(permissions = {"back:delete"}) @Log public Result<?> delete(@PathVariable Long id) { backLateService.delete(id); return Result.ok("删除成功"); } @PostMapping("/list") @RequirePermission(permissions = {"back:list"}) public Result<PageInfo<BackLate>> list(@RequestBody ListQuery<BackLate> listQuery, @RequestHeader(Constant.HEADER_TOKEN) String token) { SystemUser systemUser = redisUtil.exchange(token).get(); PageInfo<BackLate> pageInfo = backLateService.list(listQuery, systemUser.getBuildingId()); return Result.<PageInfo<BackLate>>ok().add(pageInfo); } @GetMapping("/query/{id}") @RequirePermission(permissions = {"back:query"}) public Result<BackLate> query(@PathVariable Long id) { BackLate backLate = backLateService.query(id); return Result.<BackLate>ok().add(backLate); } }
package com.hzvtc.myproject.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hzvtc.myproject.annotation.Log; import com.hzvtc.myproject.annotation.RequirePermission; import com.hzvtc.myproject.dto.ListQuery; import com.hzvtc.myproject.entity.Building; import com.hzvtc.myproject.entity.Room; import com.hzvtc.myproject.exception.HttpException; import com.hzvtc.myproject.service.BuildingService; import com.hzvtc.myproject.service.RoomService; import com.hzvtc.myproject.utils.HttpCode; import com.hzvtc.myproject.vo.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author znz * @date 2021-12-19 */ @RestController @RequestMapping("/building") public class BuildingController { @Autowired private BuildingService buildingService; @Autowired private RoomService roomService; @GetMapping("/listAll") @RequirePermission(permissions = {"manage:building:list"}) public Result<List<Building>> listAll() { List<Building> list = buildingService.listAll(); return Result.<List<Building>>ok().add(list); } @GetMapping("/list") @RequirePermission(permissions = {"manage:building:list"}) public Result<List<Building>> list() { List<Building> list = buildingService.list(); return Result.<List<Building>>ok().add(list); } @GetMapping("delete") @RequirePermission(permissions = {"manage:building:delete"}) @Log("删除building") public Result<?> delete(@RequestParam("id") Long id) { List<Room> list = roomService.listByBuildingId(id); if (list.size() > 0) { throw new HttpException(HttpCode.FAILED, "该节点下或子节点还有寝室,无法删除"); } buildingService.delete(id); return Result.ok("删除成功"); } @GetMapping("/query") @RequirePermission(permissions = {"manage:building:query"}) public Result<Building> query(@RequestParam("id") Long id) { Building building = buildingService.query(id).orElseThrow(() -> new HttpException(HttpCode.FAILED, "该数据不存在")); return Result.<Building>ok().add(building); } @PostMapping("/saveOrUpdate") @RequirePermission(permissions = {"manage:building:save","manage:building:update"}) @Log public Result<?> saveOrUpdate(@RequestBody @Validated Building building) { if (building.getId() == null) { buildingService.save(building); } else { if (building.getId().equals(building.getParentId())) { throw new HttpException(HttpCode.FAILED, "父节点不能为自己"); } buildingService.update(building); } return Result.ok("操作成功"); } }
package com.hzvtc.myproject.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hzvtc.myproject.config.Constant; import com.hzvtc.myproject.dto.ListQuery; import com.hzvtc.myproject.dto.Message; import com.hzvtc.myproject.entity.DepartApplication; import com.hzvtc.myproject.entity.DepartApplicationUser; import com.hzvtc.myproject.entity.SystemUser; import com.hzvtc.myproject.exception.HttpException; import com.hzvtc.myproject.service.DepartApplicationService; import com.hzvtc.myproject.service.StudentService; import com.hzvtc.myproject.service.SystemUserService; import com.hzvtc.myproject.socket.WebSocket; import com.hzvtc.myproject.utils.HttpCode; import com.hzvtc.myproject.utils.RedisUtil; import com.hzvtc.myproject.vo.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author znz * @date 2021-12-09 */ @RestController @RequestMapping("/depart") public class DepartApplicationController { @Autowired private DepartApplicationService departApplicationService; @Autowired private StudentService studentService; @Autowired private RedisUtil redisUtil; @Autowired private SystemUserService systemUserService; @PostMapping("/listMy") public Result<PageInfo<DepartApplication>> listMyApplication(@RequestBody ListQuery<DepartApplication> listQuery, @RequestHeader(Constant.HEADER_TOKEN) String token) { Long id = redisUtil.get(token); PageHelper.startPage(listQuery.getPage(), listQuery.getRows()); List<DepartApplication> list = departApplicationService.listMyApplication(id); PageInfo<DepartApplication> pageInfo = new PageInfo<>(list); return Result.<PageInfo<DepartApplication>>ok().add(pageInfo); } @PostMapping("/listMyFlow") public Result<PageInfo<DepartApplicationUser>> listMyFlow(@RequestBody ListQuery<DepartApplication> listQuery, @RequestHeader(Constant.HEADER_TOKEN) String token) { Long id = redisUtil.get(token); PageHelper.startPage(listQuery.getPage(), listQuery.getRows()); List<DepartApplicationUser> list = departApplicationService.listMyFlow(id); PageInfo<DepartApplicationUser> pageInfo = new PageInfo<>(list); return Result.<PageInfo<DepartApplicationUser>>ok().add(pageInfo); } @GetMapping("/listFlow/{id}") public Result<List<DepartApplicationUser>> listApplicationFlow(@PathVariable("id") Long id) { List<DepartApplicationUser> list = departApplicationService.listApplicationFlow(id); return Result.<List<DepartApplicationUser>>ok().add(list); } @PostMapping("/update") public Result<?> update(@RequestBody DepartApplicationUser departApplicationUser, @RequestHeader(Constant.HEADER_TOKEN) String token) { String msg = "成功,"; SystemUser user = redisUtil.exchange(token).get(); DepartApplicationUser applicationUser = departApplicationService .getApplicationUser(departApplicationUser.getId()); if (!user.getId().equals(applicationUser.getOperateUserId())) { throw new HttpException(HttpCode.FAILED, "无法审核"); } if (applicationUser.getIsAgree() != null) { throw new HttpException(HttpCode.FAILED, "已审核过,无法修改"); } departApplicationService.update(departApplicationUser); DepartApplication application = departApplicationService .getByDepartApplicationUserId(departApplicationUser.getId()); if (departApplicationUser.getIsAgree()) { if (user.getLeaderId() == null) { studentService.delete(application.getStudentId()); msg += "该学生已成功退宿"; } else { departApplicationService.saveApplication(user.getLeaderId(), application.getId()); WebSocket.sendMessage(user.getLeaderId(), new Message().setTitle("新的退宿申请").setType(2).setMessageBody(application.getReason()), systemUserService); msg += "等待上一级审核"; } } else { msg += "审核未通过"; } return Result.ok(msg); } @GetMapping("delete/{id}") public Result<?> delete(@PathVariable Long id) { departApplicationService.deleteApplication(id); return Result.ok("撤销成功"); } @GetMapping("/query/{id}") public Result<DepartApplication> query(@PathVariable Long id) { DepartApplication data = departApplicationService.getApplication(id); return Result.<DepartApplication>ok().add(data); } }
package com.hzvtc.myproject.controller; import com.hzvtc.myproject.annotation.Log; import com.hzvtc.myproject.annotation.RequirePermission; import com.hzvtc.myproject.entity.Faculty; import com.hzvtc.myproject.entity.Student; import com.hzvtc.myproject.exception.HttpException; import com.hzvtc.myproject.service.FacultyService; import com.hzvtc.myproject.service.StudentService; import com.hzvtc.myproject.utils.HttpCode; import com.hzvtc.myproject.vo.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author znz * @date 2021-12-19 */ @RestController @RequestMapping("/faculty") public class FacultyController { @Autowired private FacultyService facultyService; @GetMapping("/list") @RequirePermission(permissions = {"faculty:list"}) public Result<List<Faculty>> list() { List<Faculty> list = facultyService.list(); return Result.<List<Faculty>>ok().add(list); } @GetMapping("/listAll") @RequirePermission(permissions = {"faculty:list"}) public Result<List<Faculty>> listAll() { List<Faculty> list = facultyService.listAll(); return Result.<List<Faculty>>ok().add(list); } @PostMapping("/saveOrUpdate") @RequirePermission(permissions = {"faculty:save", "faculty:update"}) @Log("添加或更新学院") public Result<?> saveOrUpdate(@RequestBody @Validated Faculty faculty) { if (faculty.getId() == null) { facultyService.insert(faculty); } else { if (faculty.getId().equals(faculty.getParentId())) { throw new HttpException(HttpCode.FAILED, "父节点不能为自己"); } facultyService.update(faculty); } return Result.ok("操作成功"); } @GetMapping("/delete") @RequirePermission(permissions = {"faculty:delete"}) @Log("删除学院") public Result<?> delete(@RequestParam("id") Long id) { facultyService.delete(id); return Result.ok("删除成功"); } @GetMapping("/query") @RequirePermission(permissions = {"faculty:query"}) public Result<Faculty> query(@RequestParam("id") Long id) { Faculty faculty = facultyService.query(id).orElseThrow(() -> new HttpException(HttpCode.FAILED, "没有该数据")); return Result.<Faculty>ok().add(faculty); } }