• SpringBoot高校宿舍管理系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    本项目有学生、教师、宿管员三种角色;
    系统代码质量高,功能强大,带论文。

    系统的功能主要有:
    (1)基本信息管理
    基本信息分为学生信息和宿舍信息两部分,其功能是负责维护这些信息,对它们进行增删查改等操作。

    (2)宿舍分配管理
    根据给定的宿舍信息与学生信息,按照一定的规则自动地给还未分配宿舍的学生分配宿舍,学生可在该宿舍内自选床位,最终的宿舍分配信息可以以文件形式(如 Excel 表格)导出。

    (3)宿舍日常管理
    主要包括卫生管理、报修管理、留言管理等。
    卫生管理:记录并维护卫生检查信息。
    报修管理:添加、查看、修改报修单信息。
    留言管理:包括发布公告、失物招领、普通留言以及对这些信息的维护。

    (4)离返校管理
    对节假日学生的去向、寒暑假学生的留校以及返校登记信息进行统计及管理,并以图表形式呈现统计信息。

    (5)综合查询管理

    包括查找学生信息、各楼栋/专业的学生宿舍分配情况、卫生检查情况、学生离返校及留校信息、指定类型的留言、查看宿舍成员等。

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
    5.数据库:MySql 8.0/5.7版本;

    6.是否Maven项目:是;

    技术栈

    HTML+CSS+JavaScript+mysql+SpringBoot+LayUI

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中application.properties配置文件中的数据库配置改为自己的配置;

    4. 运行项目,在浏览器中输入http://localhost:xxx 访问

    运行截图

     

     

     

     

     

     

     

     

     

     

    相关代码

    首页控制器

    1. @Controller
    2. @RequestMapping("/")
    3. public class IndexController {
    4. @Resource
    5. private IndexService indexService;
    6. @Resource
    7. private MenuService menuService;
    8. public String index() {
    9. return "index";
    10. }
    11. @RequestMapping(value = "/login.html")
    12. public String toLogin() {
    13. return "/login";
    14. }
    15. @RequestMapping(value = "/home.html")
    16. public String home() {
    17. return "/home";
    18. }
    19. /**
    20. * 验证登录
    21. *
    22. * @param re 前端返回的参数
    23. * @param session 将用户信息添加到session中
    24. * @return
    25. */
    26. @ResponseBody
    27. @RequestMapping(value = "/login.action")
    28. public String loginAction(@RequestBody Map<String, String> re, HttpSession session) {
    29. String uid = re.get("username");
    30. String upwd = re.get("password");
    31. Integer utype = Integer.parseInt(re.get("type"));
    32. System.out.println(utype);
    33. Users user = indexService.findUserByuId(uid, upwd, utype);
    34. Map<String, Object> map = new HashMap<>();
    35. if (user != null) {
    36. session.setAttribute("uid", uid);
    37. session.setAttribute("uname", user.getUname());
    38. session.setAttribute("utype", utype);
    39. // 如果是教师或宿管员,还要把他们负责的部门(专业年级/宿舍楼)记下
    40. if (utype == 1) {
    41. session.setAttribute("dept", user.getDept());
    42. session.setAttribute("grade", user.getGrade());
    43. } else if (utype == 2) {
    44. session.setAttribute("brarea", user.getBrarea());
    45. session.setAttribute("brbid", user.getBrbid());
    46. }
    47. map.put("type", "success");
    48. } else {
    49. map.put("type", "error");
    50. }
    51. return JSON.toJSONString(map);
    52. }
    53. /**
    54. * 退出登录
    55. *
    56. * @param session
    57. * @return 返回到登录界面
    58. */
    59. @RequestMapping(value = "/logout.action")
    60. public String logout(HttpSession session) {
    61. // 清空session中的属性
    62. session.removeAttribute("uid");
    63. session.removeAttribute("uname");
    64. session.removeAttribute("utype");
    65. //让session无效
    66. session.invalidate();
    67. return "redirect:/login";
    68. }
    69. @ResponseBody
    70. @RequestMapping(value = "/api/loadMenuList")
    71. public String loadMenuList(HttpSession session) {
    72. Integer utype = (Integer) session.getAttribute("utype");
    73. String initJson = menuService.loadMenuList(utype);
    74. System.out.println(initJson);
    75. return initJson;
    76. }
    77. /**
    78. * 基本资料
    79. *
    80. * @param session
    81. * @return
    82. */
    83. @RequestMapping(value = "/basic-info.html")
    84. public String setBasicInfo(HttpSession session) {
    85. Integer utype = (Integer) session.getAttribute("utype");
    86. // 是学生则返回学生的界面
    87. if (utype == 0) {
    88. return "/student/basic-info";
    89. } else {
    90. // return "/basic-info";
    91. return "user-setting";
    92. }
    93. }
    94. /**
    95. * 修改密码
    96. *
    97. * @return
    98. */
    99. @RequestMapping(value = "/password-setting.html")
    100. public String setPassword() {
    101. return "/password-setting";
    102. }
    103. @ResponseBody
    104. @RequestMapping(value = "/updatePassword.action")
    105. public String updatePassword(HttpServletRequest request) {
    106. HashMap<String, Object> map = new HashMap<>();
    107. String uid = (String) request.getSession().getAttribute("uid");
    108. Integer utype = (Integer) request.getSession().getAttribute("utype");
    109. String param = request.getParameter("param");
    110. System.out.println(param);
    111. try {
    112. if (StringUtils.isNotBlank(param)) {
    113. JSONObject obj = JSONObject.parseObject(param);
    114. String old_password = (String) obj.get("old_password");
    115. String new_password = (String) obj.get("new_password");
    116. int result = indexService.updatePassword(uid, utype, old_password, new_password);
    117. switch (result) {
    118. case -1:
    119. map.put("success", false);
    120. map.put("msg", "系统出错,修改失败!");
    121. break;
    122. case 0:
    123. map.put("success", false);
    124. map.put("msg", "旧密码不正确!");
    125. break;
    126. case 1:
    127. map.put("success", true);
    128. map.put("msg", "修改成功!");
    129. }
    130. return JSON.toJSONString(map);
    131. }
    132. } catch (Exception e) {
    133. e.printStackTrace();
    134. map.put("success", false);
    135. map.put("msg", "系统出错,修改失败!");
    136. }
    137. return JSON.toJSONString(map);
    138. }
    139. }

    教师控制器

    1. /**
    2. * 教师对应的控制器
    3. */
    4. @Controller
    5. @RequestMapping("/teacher")
    6. public class TeacherController {
    7. @Resource
    8. private TeacherService teacherService;
    9. @RequestMapping(value = "/viewAllocationInfo")
    10. public String allocationList() {
    11. return "/teacher/allocation-list";
    12. }
    13. /**
    14. * 查询宿舍分配信息
    15. * 查询条件:专业/年级
    16. *
    17. * @param aiVo
    18. * @return
    19. */
    20. @ResponseBody
    21. @RequestMapping(value = "/allocation/list")
    22. public DataGridViewResult findAllocationInfoList(AllocationInfoVo aiVo, HttpServletRequest request) {
    23. // 获取session中的专业和年级
    24. String dept = (String) request.getSession().getAttribute("dept");
    25. String grade = (String) request.getSession().getAttribute("grade");
    26. if (StringUtils.isNotBlank(dept)) {
    27. aiVo.setStudept(dept);
    28. }
    29. if (StringUtils.isNotBlank(grade)) {
    30. aiVo.setStugrade(grade);
    31. }
    32. System.out.println(aiVo);
    33. // 设置分页信息
    34. PageHelper.startPage(aiVo.getPage(), aiVo.getLimit());
    35. // 查询
    36. List<AllocationInfo> list = teacherService.findAllocationInfoListByPage(aiVo);
    37. // 创建分页对象
    38. PageInfo<AllocationInfo> pageInfo = new PageInfo<AllocationInfo>(list);
    39. // 按接口要求返回数据
    40. DataGridViewResult data = new DataGridViewResult(pageInfo.getTotal(), pageInfo.getList());
    41. return data;
    42. }
    43. /**
    44. * 添加宿舍分配信息
    45. *
    46. * @param ai
    47. * @return
    48. */
    49. @ResponseBody
    50. @RequestMapping(value = "/allocation/add")
    51. public String addAllocationInfo(AllocationInfo ai) {
    52. HashMap<String, Object> map = new HashMap<>();
    53. int result = teacherService.addAllocationInfo(ai);
    54. if (result > 0) {
    55. map.put("success", true);
    56. map.put("msg", "添加成功!");
    57. } else {
    58. map.put("success", false);
    59. map.put("msg", "添加失败!");
    60. }
    61. return JSON.toJSONString(map);
    62. }
    63. /**
    64. * 更改宿舍分配信息
    65. *
    66. * @param ai
    67. * @return
    68. */
    69. @ResponseBody
    70. @RequestMapping(value = "/allocation/update")
    71. public String updateAllocationInfo(AllocationInfo ai) {
    72. HashMap<String, Object> map = new HashMap<>();
    73. int result = teacherService.updateAllocationInfo(ai);
    74. if (result > 0) {
    75. map.put("success", true);
    76. map.put("msg", "更改成功!");
    77. } else {
    78. map.put("success", false);
    79. map.put("msg", "更改失败!");
    80. }
    81. return JSON.toJSONString(map);
    82. }

    如果也想学习本系统,下面领取。回复:095springboot   

  • 相关阅读:
    在自己的服务器上部署个人博客和开源项目:实现数字存在感
    Kali下Cobalt Strike4.4的安装
    详细介绍遗传算法的原理以及最值问题代码实现(MATLAB/Python)
    4-k8s-部署springboot项目简单实践
    微信小程序登录以及获取微信用户信息
    AcWing 1137. 选择最佳线路 题解(最短路)
    创建线程并启动-创建线程的前三种方式
    linux上部署python环境
    Linux之简介、shell命令、用户、用户组、环境变量
    痞子衡嵌入式:IAR内部C-SPY调试组件配套宏文件(.mac)用法介绍
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/125533558