Java项目:在线宿舍管理系统(java+SSM+JSP+bootstrap+jquery+mysql)

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

本项目包含管理员、宿舍管理员、学生三种角色;

管理员角色包含以下功能:
管理员登录,院系管理,专业管理,年级管理,班级管理,学生设置,宿舍管理员管理,宿舍楼管理,宿舍管理,床位管理,学生入住登记,学生退房管理等功能。

宿舍管理员角色包含以下功能:
宿舍管理员管理,宿舍楼管理,宿舍管理,床位管理,入住登记,退房管理,个人信息修改等功能。

学生角色包含以下功能:
学生角色登录,我入住的床位,个人信息修改等功能。

环境需要

1.运行环境:java jdk 1.7,注:该项目仅支持jdk1.7,不支持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 5.7版本;
6.是否Maven项目:否;


技术栈

1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+CSS+JavaScript+bootstrap+jquery


使用说明

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

注意事项
该项目仅支持jdk1.7,不支持1.8及以上版本;
 

 

 

 

 

 

学生信息管理控制层:

@Controller
@RequestMapping("/stu")
public class StuController {

    @Autowired
    private StuServiceI stuServiceI;

    /**
     * 跳转到学生信息管理页面
     * @return
     */
    @GetMapping("/view")
    public String getDormView() {
        return "stu/stu";
    }

    /**
     *
     * @param session
     * @param response
     */
    @PostMapping("/exportInfo")
    public void exportInfo(HttpSession session, HttpServletResponse response) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        List<Stuinfo> list = stuServiceI.findAll(user);
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("学生信息", "学生信息表1"), Stuinfo.class, list);
        ExportExcelUtil.downLoadExcel(response, "学生信息表", workbook);
    }

    /**
     * 跳转学生个人主页
     * @param session
     * @param model
     * @return
     * @throws Exception
     */
    @GetMapping("/infoView")
    public String getInfoView(HttpSession session, Model model) throws Exception {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Stuinfo stuinfo = stuServiceI.findById(user.getUsername());
        model.addAttribute("stuinfo", new ObjectMapper().writeValueAsString(stuinfo));
        return "stu/infoView";
    }

    /**
     * 学生更新密码
     * @param session
     * @param model
     * @return
     */
    @GetMapping("/updatePwd")
    public String updatePwd(HttpSession session, Model model) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Stuinfo stuinfo = stuServiceI.findById(user.getUsername());
        model.addAttribute("id", stuinfo.getId());
        return "stu/updatePwd";
    }

    /**
     * 学生更新电话
     * @param stuinfo
     * @return
     */
    @PostMapping("/updatePhone")
    @ResponseBody
    public Boolean updatePhone(Stuinfo stuinfo) {
        return stuServiceI.updatePhone(stuinfo);
    }
    /**
     * 学生更新密码
     * @return
     */
    @PostMapping("/updatePwd")
    @ResponseBody
    public Boolean updatePwd(String id, String oldPwd, String newPwd) {
        return stuServiceI.updatePwd(id, oldPwd, newPwd);
    }

    /**
     * 带分页信息-学生列表
     * @param pageable
     * @param session
     * @param searchId
     * @param searchDormName
     * @return
     */
    @GetMapping("/list")
    @ResponseBody
    public Page<Stuinfo> getStuInfo(@PageableDefault Pageable pageable, HttpSession session, String searchId, String searchDormName) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return stuServiceI.findStus(pageable, user, searchId, searchDormName);
    }

    /**
     * 导入文件-学生信息
     * @param file
     * @return
     */
    @PostMapping("/importExcel")
    @ResponseBody
    public Boolean importExcel(@RequestParam("file") MultipartFile file) {
        return stuServiceI.importExcel(file);
    }

    /**
     * 编辑学生离校
     * @param ids
     * @return
     */
    @PostMapping("/leaveSchool")
    @ResponseBody
    public Boolean leaveSchool(@RequestBody(required = true) List<String> ids) {
        return stuServiceI.leaveSchool(ids);
    }

    /**
     * 重置密码 123456
     * @param stuId
     * @return
     */
    @GetMapping("/resetPwd")
    @ResponseBody
    public Boolean resetPwd(String stuId) {
        return stuServiceI.resetPwd(stuId);
    }

    /**
     * 删除学习信息
     * @param stuId
     * @return
     */
    @GetMapping("/del")
    @ResponseBody
    public Boolean del(String stuId) {
        return stuServiceI.del(stuId);
    }

    /**
     * 修改学生信息
     * @param stuinfo
     * @return
     */
    @PostMapping("/update")
    @ResponseBody
    public Boolean del(Stuinfo stuinfo) {
        return stuServiceI.update(stuinfo);
    }

    /**
     * 跳转申请报修页面
     * @return
     */
    @GetMapping("/repairView")
    public String repairView() {
        return "stu/repairView";
    }

    /**
     * 查询学生报修列表
     * @param pageable
     * @param session
     * @return
     */
    @GetMapping("/repairInfo")
    @ResponseBody
    public Page<Repair> getRepairInfo(@PageableDefault Pageable pageable, HttpSession session) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return stuServiceI.findRepair(pageable, user.getStuinfo().getId());
    }

    /**
     * 添加报修
     * @param repair
     * @param session
     * @return
     */
    @PostMapping("/createRepair")
    @ResponseBody
    public Boolean createRepair(Repair repair, HttpSession session) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Stuinfo stuinfo = stuServiceI.findById(user.getUsername());
        return stuServiceI.createRepair(repair, stuinfo);
    }

    @GetMapping("/delRepairInfo")
    @ResponseBody
    public Boolean delRepairInfo(String repairId) {
        return stuServiceI.delRepairInfo(repairId);
    }

    /**
     * 跳转历史报修记录页面
     * @return
     */
    @GetMapping("/repairHistoryView")
    public String repairHistoryView() {
        return "stu/repairHistory";
    }

    /**
     * 查询历史报修记录列表
     * @param pageable
     * @param session
     * @return
     */
    @GetMapping("/repairHistory")
    @ResponseBody
    public Page<Repair> getRepairHistory(@PageableDefault Pageable pageable, HttpSession session) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return stuServiceI.findRepairHistory(pageable, user.getStuinfo().getId());
    }


    /**
     * 获取学生信息
     * @param dormid
     * @return
     */
    @GetMapping("/getStus")
    @ResponseBody
    public List<Stuinfo> getStus(String dormid) {
        return stuServiceI.getStus(dormid);
    }
}

员工管理控制层:

@Controller
@RequestMapping("/staff")
public class StaffController {

    @Autowired
    private StaffServiceI staffServiceI;

    @Autowired
    private RepairServiceI repairServiceI;

    /**
     * 跳转员工管理页面
     * @return
     */
    @GetMapping("/view")
    public String getStaffView() {
        return "staff/staff";
    }

    /**
     * 跳转到员工详情页面
     * @param session
     * @param model
     * @return
     * @throws Exception
     */
    @GetMapping("/infoView")
    public String getInfoView(HttpSession session, Model model) throws Exception {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Staffinfo staffinfo = staffServiceI.findById(user.getUsername());
        model.addAttribute("staffinfo", new ObjectMapper().writeValueAsString(staffinfo));
        return "staff/infoView";
    }

    /**
     * 跳转学生信息查询页面
     * @return
     */
    @GetMapping("/stu")
    public String getStuView() {
        return "staff/stu";
    }

    /**
     * 修改密码
     * @param session
     * @param model
     * @return
     */
    @GetMapping("/updatePwd")
    public String updatePwd(HttpSession session, Model model) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Staffinfo staffinfo = staffServiceI.findById(user.getUsername());
        model.addAttribute("id", staffinfo.getId());
        return "staff/updatePwd";
    }

    /**
     * 修改手机号
     * @param staffinfo
     * @return
     */
    @PostMapping("/updatePhone")
    @ResponseBody
    public Boolean updatePhone(Staffinfo staffinfo) {
        return staffServiceI.updatePhone(staffinfo);
    }

    /**
     * 修改密码
     * @return
     */
    @PostMapping("/updatePwd")
    @ResponseBody
    public Boolean updatePwd(String id, String oldPwd, String newPwd) {
        return staffServiceI.updatePwd(id, oldPwd, newPwd);
    }

    /**
     * 员工管理列表-分页
     * @param pageable
     * @param searchName
     * @param searchDorm
     * @return
     */
    @GetMapping("/list")
    @ResponseBody
    public Page<Staffinfo> getStuInfo(@PageableDefault Pageable pageable, String searchName, String searchDorm) {
        return staffServiceI.findStaffs(pageable, searchName, searchDorm);
    }

    /**
     * 导入员工信息文件
     * @param file
     * @return
     */
    @PostMapping("/importExcel")
    @ResponseBody
    public Boolean importExcel(@RequestParam("file") MultipartFile file) {
        return staffServiceI.importExcel(file);
    }

    /**
     * 重置密码
     * @param staffId
     * @return
     */
    @GetMapping("/resetPwd")
    @ResponseBody
    public Boolean resetPwd(String staffId) {
        return staffServiceI.resetPwd(staffId);
    }

    /**
     * 删除员工信息
     * @param staffId
     * @return
     */
    @GetMapping("/del")
    @ResponseBody
    public Boolean del(String staffId) {
        return staffServiceI.del(staffId);
    }

    /**
     * 更新员工信息
     * @param staffinfo
     * @return
     */
    @PostMapping("/update")
    @ResponseBody
    public Boolean update(Staffinfo staffinfo) {
        return staffServiceI.update(staffinfo);
    }

    /**
     * 跳转未处理报修单页面
     * @return
     */
    @GetMapping("/repairUntreatedView")
    public String getRepairView() {
        return "staff/repairUntreatedView";
    }

    /**
     * 未处理报修单列表
     * @param pageable
     * @param session
     * @param reason
     * @return
     */
    @GetMapping("/repairUntreatedInfo")
    @ResponseBody
    public Page<Repair> getRepairUntreatedInfo(@PageableDefault Pageable pageable, HttpSession session, String reason) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return staffServiceI.findRepairUntreated(pageable, user.getStaffinfo(), reason);
    }

    /**
     * 批量处理报修单
     * @param ids
     * @return
     */
    @PostMapping("/batchDeal")
    @ResponseBody
    public Boolean batchDeal(@RequestBody List<String> ids) {
        return staffServiceI.batchDeal(ids);
    }

    /**
     * 处理未处理报修单
     * @param repairId
     * @return
     */
    @GetMapping("/dealRepairUntreated")
    @ResponseBody
    public Boolean dealRepairUntreated(String repairId) {
        return staffServiceI.dealRepairUntreated(repairId);
    }

    /**
     * 跳转处理中报修单页面
     * @return
     */
    @GetMapping("/repairProcessView")
    public String getRepairProcessView() {
        return "staff/repairProcessView";
    }

    /**
     * 处理中报修单列表
     * @param pageable
     * @param session
     * @return
     */
    @GetMapping("/repairProcessInfo")
    @ResponseBody
    public Page<Repair> getRepairProcessInfo(@PageableDefault Pageable pageable, HttpSession session) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return staffServiceI.findRepairProcessInfo(pageable, user.getStaffinfo());
    }

    /**
     * 导出文件
     * @param session
     * @param response
     */
    @GetMapping("/exportExcel")
    public void exportExcel(HttpSession session, HttpServletResponse response) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        Staffinfo staffinfo = user.getStaffinfo();
        String s = staffinfo.getDormname() + staffinfo.getDormno();
        List<Repair> list = repairServiceI.findRepairLikeDormNameEqualStatus(s, 2);
        if (list.size() > 0 ){
            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("历史保修单", "历史保修单表1"), Repair.class, list);
            ExportExcelUtil.downLoadExcel(response, "历史保修单", workbook);
        }
    }

    /**
     * 处理报修
     * @param repairId
     * @return
     */
    @GetMapping("/dealRepairProcess")
    @ResponseBody
    public Boolean dealRepairProcess(String repairId) {
        return staffServiceI.dealRepairProcess(repairId);
    }

    /**
     * 跳转历史报修单页面
     * @return
     */
    @GetMapping("/repairHistoryView")
    public String getRepairHistoryView() {
        return "staff/repairHistory";
    }

    /**
     * 查询历史报修单列表
     * @param pageable
     * @param session
     * @param reason
     * @return
     */
    @GetMapping("/repairHistory")
    @ResponseBody
    public Page<Repair> getRepairHistory(@PageableDefault Pageable pageable, HttpSession session, String reason) {
        UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
        return staffServiceI.findRepairHistory(pageable, reason, user.getStaffinfo());
    }
}

宿舍楼信息管理控制层:

@Controller
@RequestMapping("/dorm")
public class DormController {

	@Autowired
	private DormServiceI dormServiceI;

	/**
	 * 跳转宿舍楼信息管理页面
	 * @return
	 */
	@GetMapping("/view")
	public String getDormView() {
		return "dorm/dorm";
	}

	/**
	 * 宿舍楼信息列表-带分页
	 * @param pageable
	 * @return
	 */
	@GetMapping("/list")
	@ResponseBody
	public Page<Dorm> getDormInfo(@PageableDefault Pageable pageable) {
		return dormServiceI.findDorms(pageable);
	}

	/**
	 * 获取宿舍列表
	 * @param session
	 * @return
	 */
	@GetMapping("/getDorms")
	@ResponseBody
	public List<Dorm> getDorms(HttpSession session) {
		UserExpand user = (UserExpand) session.getAttribute("LOGIN_USER");
		return dormServiceI.getDorms(user.getStaffinfo());
	}

	/**
	 * 导入-宿舍楼信息文件
	 * @param file
	 * @return
	 */
	@PostMapping("/importExcel")
	@ResponseBody
	public Boolean importExcel(@RequestParam("file") MultipartFile file) {
		return dormServiceI.importExcel(file);
	}
}

源码获取:俺的博客首页 "资源" 里下载! 

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq1334611189

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值