SpringBoot高校宿舍管理系统

110 篇文章 2 订阅

作者主页:源码空间站2022

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

文末获取源码

作者主页:夜未央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 访问

运行截图

相关代码

首页控制器

@Controller
@RequestMapping("/")
public class IndexController {
    @Resource
    private IndexService indexService;
    @Resource
    private MenuService menuService;

    public String index() {
        return "index";
    }

    @RequestMapping(value = "/login.html")
    public String toLogin() {
        return "/login";
    }

    @RequestMapping(value = "/home.html")
    public String home() {
        return "/home";
    }


    /**
     * 验证登录
     *
     * @param re      前端返回的参数
     * @param session 将用户信息添加到session中
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/login.action")
    public String loginAction(@RequestBody Map<String, String> re, HttpSession session) {
        String uid = re.get("username");
        String upwd = re.get("password");
        Integer utype = Integer.parseInt(re.get("type"));
        System.out.println(utype);
        Users user = indexService.findUserByuId(uid, upwd, utype);
        Map<String, Object> map = new HashMap<>();
        if (user != null) {
            session.setAttribute("uid", uid);
            session.setAttribute("uname", user.getUname());
            session.setAttribute("utype", utype);
            // 如果是教师或宿管员,还要把他们负责的部门(专业年级/宿舍楼)记下
            if (utype == 1) {
                session.setAttribute("dept", user.getDept());
                session.setAttribute("grade", user.getGrade());
            } else if (utype == 2) {
                session.setAttribute("brarea", user.getBrarea());
                session.setAttribute("brbid", user.getBrbid());
            }
            map.put("type", "success");
        } else {
            map.put("type", "error");
        }
        return JSON.toJSONString(map);
    }

    /**
     * 退出登录
     *
     * @param session
     * @return 返回到登录界面
     */
    @RequestMapping(value = "/logout.action")
    public String logout(HttpSession session) {
        // 清空session中的属性
        session.removeAttribute("uid");
        session.removeAttribute("uname");
        session.removeAttribute("utype");
        //让session无效
        session.invalidate();
        return "redirect:/login";
    }

    @ResponseBody
    @RequestMapping(value = "/api/loadMenuList")
    public String loadMenuList(HttpSession session) {
        Integer utype = (Integer) session.getAttribute("utype");
        String initJson = menuService.loadMenuList(utype);
        System.out.println(initJson);
        return initJson;
    }

    /**
     * 基本资料
     *
     * @param session
     * @return
     */
    @RequestMapping(value = "/basic-info.html")
    public String setBasicInfo(HttpSession session) {
        Integer utype = (Integer) session.getAttribute("utype");
        // 是学生则返回学生的界面
        if (utype == 0) {
            return "/student/basic-info";
        } else {
//            return "/basic-info";
            return  "user-setting";
        }
    }


    /**
     * 修改密码
     *
     * @return
     */
    @RequestMapping(value = "/password-setting.html")
    public String setPassword() {
        return "/password-setting";
    }

    @ResponseBody
    @RequestMapping(value = "/updatePassword.action")
    public String updatePassword(HttpServletRequest request) {
        HashMap<String, Object> map = new HashMap<>();

        String uid = (String) request.getSession().getAttribute("uid");
        Integer utype = (Integer) request.getSession().getAttribute("utype");
        String param = request.getParameter("param");
        System.out.println(param);
        try {
            if (StringUtils.isNotBlank(param)) {
                JSONObject obj = JSONObject.parseObject(param);
                String old_password = (String) obj.get("old_password");
                String new_password = (String) obj.get("new_password");
                int result = indexService.updatePassword(uid, utype, old_password, new_password);
                switch (result) {
                    case -1:
                        map.put("success", false);
                        map.put("msg", "系统出错,修改失败!");
                        break;
                    case 0:
                        map.put("success", false);
                        map.put("msg", "旧密码不正确!");
                        break;
                    case 1:
                        map.put("success", true);
                        map.put("msg", "修改成功!");
                }
                return JSON.toJSONString(map);
            }
        } catch (Exception e) {
            e.printStackTrace();
            map.put("success", false);
            map.put("msg", "系统出错,修改失败!");
        }
        return JSON.toJSONString(map);
    }
}

教师控制器

/**
 * 教师对应的控制器
 */
@Controller
@RequestMapping("/teacher")
public class TeacherController {
    @Resource
    private TeacherService teacherService;

    @RequestMapping(value = "/viewAllocationInfo")
    public String allocationList() {
        return "/teacher/allocation-list";
    }

    /**
     * 查询宿舍分配信息
     * 查询条件:专业/年级
     *
     * @param aiVo
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/allocation/list")
    public DataGridViewResult findAllocationInfoList(AllocationInfoVo aiVo, HttpServletRequest request) {
        // 获取session中的专业和年级
        String dept = (String) request.getSession().getAttribute("dept");
        String grade = (String) request.getSession().getAttribute("grade");
        if (StringUtils.isNotBlank(dept)) {
            aiVo.setStudept(dept);
        }
        if (StringUtils.isNotBlank(grade)) {
            aiVo.setStugrade(grade);
        }
        System.out.println(aiVo);
        // 设置分页信息
        PageHelper.startPage(aiVo.getPage(), aiVo.getLimit());
        // 查询
        List<AllocationInfo> list = teacherService.findAllocationInfoListByPage(aiVo);
        // 创建分页对象
        PageInfo<AllocationInfo> pageInfo = new PageInfo<AllocationInfo>(list);
        // 按接口要求返回数据
        DataGridViewResult data = new DataGridViewResult(pageInfo.getTotal(), pageInfo.getList());
        return data;
    }

    /**
     * 添加宿舍分配信息
     *
     * @param ai
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/allocation/add")
    public String addAllocationInfo(AllocationInfo ai) {
        HashMap<String, Object> map = new HashMap<>();
        int result = teacherService.addAllocationInfo(ai);
        if (result > 0) {
            map.put("success", true);
            map.put("msg", "添加成功!");
        } else {
            map.put("success", false);
            map.put("msg", "添加失败!");
        }
        return JSON.toJSONString(map);
    }

    /**
     * 更改宿舍分配信息
     *
     * @param ai
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/allocation/update")
    public String updateAllocationInfo(AllocationInfo ai) {
        HashMap<String, Object> map = new HashMap<>();
        int result = teacherService.updateAllocationInfo(ai);
        if (result > 0) {
            map.put("success", true);
            map.put("msg", "更改成功!");
        } else {
            map.put("success", false);
            map.put("msg", "更改失败!");
        }
        return JSON.toJSONString(map);
    }

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值