码迷,mamicode.com
首页 > 其他好文 > 详细

毕业设计第四次任务书

时间:2018-04-30 13:26:49      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:row   登录模块   http   move   参考资料   turn   mod   角色   ora   

1.这2周毕设完成内容

1.1 模块名称

(1)登录模块;                                                                                      
(2)角色管理模块:共有超级管理员、学生宿舍管理员、办公房管理员、周转房管理员、实验室管理员五种管理员,每个管理员所拥有的权限不同,超级管理员可增加、修改、删除各管理人员以及权限;                               
(3)管理员ID模块:记录管理员信息,拥有该权限的管理员可进行增加、修改、删除各管理员信息;  
(4)学生宿舍ID模块:记录学生宿舍信息,拥有该权限的管理员可进行增加、修改、删除各学生宿舍信息;  
(5)办公室ID模块:记录办公室信息,拥有该权限的管理员可进行增加、修改、删除各办公室信息;  
(6)实验室ID模块:记录实验室信息,拥有该权限的管理员可进行增加、修改、删除实验室信息;  
(7)教师周转房ID模块:记录教师周转房信息,拥有该权限的管理员可进行增加、修改、删除各教师周转房信息;
(8)申请房产模块:用户可查询各房产信息并进行申请;
(9)房产分配模块:管理员对用户申请的房产进行分配;
(10)个人信息模块:管理员可修改个人信息;
(11)修改密码模块;

1.2 模块截图展示

角色管理
技术分享图片技术分享图片

管理员ID
技术分享图片技术分享图片技术分享图片

学生宿舍ID
技术分享图片技术分享图片

办公室ID
技术分享图片技术分享图片

实验室ID
技术分享图片技术分享图片

教师周转房ID
技术分享图片技术分享图片

个人信息
技术分享图片

修改密码
技术分享图片

1.3模块代码介绍

(1)角色管理

@RequestMapping("/findAdmin.do")
    public String find(AdminPage page, Model model) {
        //-----------------------
        page.setRows(adminDao.findRows(page));
        model.addAttribute("adminPage", page);

        List<Admin> admins = adminDao.findByPage(page);
        model.addAttribute("admins", admins);

        List<Module> modules = roleDao.findAllModules();
        model.addAttribute("modules", modules);
        return "admin/adminList";
    }

    @RequestMapping("/resetPassword.do")
    @ResponseBody
    public Map<String, Object> resetPassword(@RequestParam("ids") String ids) {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("ids", buildIdList(ids));
        param.put("password", "123456");
        adminDao.updatePassword(param);

        Map<String, Object> info = new HashMap<String, Object>();
        info.put("success", true);
        info.put("message", "重置密码成功!");
        return info;
    }

    private List<Integer> buildIdList(String ids) {
        if (ids == null || ids.length() == 0)
            return null;
        List<Integer> list = new ArrayList<Integer>();
        String[] idsArray = ids.split(",");
        for (String id : idsArray) {
            list.add(Integer.valueOf(id));
        }
        return list;
    }

    @RequestMapping("/toAddAdmin.do")
    public String toAdd(Model model) {
        RolePage page = new RolePage();
        page.setPageSize(100000);
        List<Role> roles = roleDao.findByPage(page);
        model.addAttribute("roles", roles);
        return "admin/addAdmin";
    }

    @RequestMapping("/addAdmin.do")
    public String add(Admin admin, Model model) {
        admin.setEnrollDate(new Timestamp(System.currentTimeMillis()));
        adminDao.saveAdmin(admin);

        List<Integer> roleIds = admin.getRoleIds();
        for (Integer roleId : roleIds) {
            Map<String, Object> adminRoles = new HashMap<String, Object>();
            adminRoles.put("adminId", admin.getAdminId());
            adminRoles.put("roleId", roleId);
            adminDao.saveAdminRoles(adminRoles);
        }
        return "redirect:findAdmin.do";
    }

    @RequestMapping("/toUpdateAdmin.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        RolePage page = new RolePage();
        page.setPageSize(100000);
        List<Role> roles = roleDao.findByPage(page);
        model.addAttribute("roles", roles);

        Admin admin = adminDao.findById(id);
        model.addAttribute("admin", admin);
        return "admin/updateAdmin";
    }

    @RequestMapping("/updateAdmin.do")
    public String update(Admin admin, Model model) {
        adminDao.updateAdmin(admin);

        adminDao.deleteAdminRoles(admin.getAdminId());

        List<Integer> roleIds = admin.getRoleIds();
        for (Integer roleId : roleIds) {
            Map<String, Object> adminRoles = new HashMap<String, Object>();
            adminRoles.put("adminId", admin.getAdminId());
            adminRoles.put("roleId", roleId);
            adminDao.saveAdminRoles(adminRoles);
        }

        return "redirect:findAdmin.do";
    }

    @RequestMapping("/deleteAdmin.do")
    public String delete(@RequestParam("adminId") int id) {
        adminDao.deleteAdminRoles(id);
        adminDao.deleteAdmin(id);
        return "redirect:findAdmin.do";
    }
}

(2)管理员角色

@RequestMapping("/findRole.do")
    public String find(RolePage page, Model model) {
        //------------------------
        page.setRows(roleDao.findRows(page));
        model.addAttribute("rolePage", page);
        List<Role> roles = roleDao.findByPage(page);
        model.addAttribute("roles", roles);
        
        return "role/roleList";
    }

    @RequestMapping("/toAddRole.do")
    public String toAdd(Model model) {
        //-----------------------------
        List<Module> modules = roleDao.findAllModules();
        model.addAttribute("modules", modules);
        return "role/addRole";
    }
    
    @RequestMapping("/addRole.do")
    public String add(Role role, Model model) {
        roleDao.saveRole(role);//将角色的名称添加角色表中
        //-----------------------
        List<Integer> moduleIds = role.getModuleIds();
        for (Integer moduleId : moduleIds) {
            Map<String,Object> roleModules = 
                    new HashMap<String, Object>();
            roleModules.put("roleId", role.getRoleId());
            roleModules.put("moduleId", moduleId);
            roleDao.saveRoleModules(roleModules);
        }
        return "redirect:findRole.do";
    }
    
    @RequestMapping("/toUpdateRole.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        //---------------------------
        List<Module> modules = roleDao.findAllModules();
        model.addAttribute("modules", modules);
        Role role = roleDao.findById(id);
        model.addAttribute("role", role);
        return "role/updateRole";
    }
    
    @RequestMapping("/updateRole.do")
    public String update(Role role, Model model) {
        roleDao.updateRole(role);
        //---------------------------
        roleDao.deleteRoleModules(role.getRoleId());
        
        List<Integer> moduleIds = role.getModuleIds();
        for (Integer moduleId : moduleIds) {
            Map<String,Object> roleModules = 
                    new HashMap<String, Object>();
            roleModules.put("roleId", role.getRoleId());
            roleModules.put("moduleId", moduleId);
            roleDao.saveRoleModules(roleModules);
        }
        
        return "redirect:findRole.do";
    }
    
    @RequestMapping("/deleteRole.do")
    public String delete(@RequestParam("id") int id) {
        //-------------------------
        roleDao.deleteRoleModules(id);
        roleDao.deleteRole(id);
        return "redirect:findRole.do";
    }
    
    @RequestMapping("/checkRoleName.do")
    @ResponseBody
    public boolean checkName(String name) {
        //--------------------------------
        Role role = roleDao.findByName(name);
        if(role == null)
            return true;
        else
            return false;
    }

}

(3)实验室

@RequestMapping("/findLaboratory.do")
    public String find(LaboratoryPage page,Model model)
    {
        page.setRows(laboratoryDao.findRows(page));
        model.addAttribute("laboratoryPage", page);
        
        List<Laboratory> laboratorys = laboratoryDao.findByPage(page);
        model.addAttribute("laboratorys", laboratorys);
        
        return "laboratory/laboratoryList";
    }
    
    @RequestMapping("/deleteLaboratory.do")
    public String delete(@RequestParam("id") int id) {
        laboratoryDao.delete(id);
        return "redirect:findLaboratory.do";
    }
    
    @RequestMapping("/toUpdateLaboratory.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        Laboratory laboratory=laboratoryDao.findById(id);
        model.addAttribute("laboratory", laboratory);
        return "laboratory/updateLaboratory";
    }
    
    @RequestMapping("/checkAddress.do")
    @ResponseBody
    public boolean checkAddress(String address) {
        List<Laboratory> laboratorys = laboratoryDao.findByAddress(address);
        if(laboratorys.size()==0)
            return true;
        else
            return false;
    }
    
    @RequestMapping("/updateLaboratory.do")
    public String update(Laboratory laboratory)
    {
        laboratoryDao.update(laboratory);
        return "redirect:findLaboratory.do";
        
    }
    @RequestMapping("/toAddLaboratory.do")
    public String toAdd()
    {
        return "laboratory/addLaboratory";
        
    }
    @RequestMapping("addLaboratory.do")
    public String add(Laboratory laboratory) {
        laboratoryDao.save(laboratory);
        return "redirect:findLaboratory.do";
    }

(4)办公室

@RequestMapping("/findOffice.do")
    public String find(OfficePage page,Model model)
    {
        page.setRows(officeDao.findRows(page));
        model.addAttribute("officePage", page);
        
        List<Office> offices = officeDao.findByPage(page);
        model.addAttribute("offices", offices);
        
        return "office/officeList";
    }
    
    @RequestMapping("/deleteOffice.do")
    public String delete(@RequestParam("id") int id) {
        officeDao.delete(id);
        return "redirect:findOffice.do";
    }
    
    @RequestMapping("/toUpdateOffice.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        Office office=officeDao.findById(id);
        model.addAttribute("office", office);
        return "office/updateOffice";
    }
    
    @RequestMapping("/checkAddress.do")
    @ResponseBody
    public boolean checkAddress(String address) {
        List<Office> offices = officeDao.findByAddress(address);
        if(offices.size()==0)
            return true;
        else
            return false;
    }
    
    @RequestMapping("/updateOffice.do")
    public String update(Office office)
    {
        officeDao.update(office);
        return "redirect:findOffice.do";
        
    }
    @RequestMapping("/toAddOffice.do")
    public String toAdd()
    {
        return "office/addOffice";
        
    }
    @RequestMapping("addOffice.do")
    public String add(Office office) {
        officeDao.save(office);
        return "redirect:findOffice.do";
    } 
    
}

(5)学生宿舍

@RequestMapping("/findStuDormitory.do")
    public String find(StuDormitoryPage page,Model model)
    {
        page.setRows(stuDormitoryDao.findRows(page));
        model.addAttribute("stuDormitoryPage", page);
        
        List<StuDormitory> stuDormitorys = stuDormitoryDao.findByPage(page);
        model.addAttribute("stuDormitorys", stuDormitorys);
        
        return "stuDormitory/stuDormitoryList";
    }
    
    @RequestMapping("/deleteStuDormitory.do")
    public String delete(@RequestParam("id") int id) {
        stuDormitoryDao.delete(id);
        return "redirect:findStuDormitory.do";
    }
    
    @RequestMapping("/toUpdateStuDormitory.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        StuDormitory stuDormitory=stuDormitoryDao.findById(id);
        model.addAttribute("stuDormitory", stuDormitory);
        return "stuDormitory/updateStuDormitory";
    }
    
    @RequestMapping("/checkAddress.do")
    @ResponseBody
    public boolean checkAddress(String address) {
        List<StuDormitory> stuDormitorys = stuDormitoryDao.findByAddress(address);
        if(stuDormitorys.size()==0)
            return true;
        else
            return false;
    }
    
    @RequestMapping("/updateStuDormitory.do")
    public String update(StuDormitory stuDormitory)
    {
        stuDormitoryDao.update(stuDormitory);
        return "redirect:findStuDormitory.do";
        
    }
    @RequestMapping("/toAddStuDormitory.do")
    public String toAdd()
    {
        return "stuDormitory/addStuDormitory";
        
    }
    @RequestMapping("addStuDormitory.do")
    public String add(StuDormitory stuDormitory) {
        stuDormitoryDao.save(stuDormitory);
        return "redirect:findStuDormitory.do";
    } 
    
}

(6)教师周转房

@RequestMapping("/findTeahouseturnover.do")
    public String find(TeahouseturnoverPage page,Model model)
    {
        page.setRows(teahouseturnoverDao.findRows(page));
        model.addAttribute("teahouseturnoverPage", page);
        
        List<Teahouseturnover> teahouseturnovers = teahouseturnoverDao.findByPage(page);
        model.addAttribute("teahouseturnovers", teahouseturnovers);
        
        return "teahouseturnover/teahouseturnoverList";
    }
    
    @RequestMapping("/deleteTeahouseturnover.do")
    public String delete(@RequestParam("id") int id) {
        teahouseturnoverDao.delete(id);
        return "redirect:findTeahouseturnover.do";
    }
    
    @RequestMapping("/toUpdateTeahouseturnover.do")
    public String toUpdate(@RequestParam("id") int id, Model model) {
        Teahouseturnover teahouseturnover=teahouseturnoverDao.findById(id);
        model.addAttribute("teahouseturnover", teahouseturnover);
        return "teahouseturnover/updateTeahouseturnover";
    }
    
    @RequestMapping("/checkAddress.do")
    @ResponseBody
    public boolean checkAddress(String address) {
        List<Teahouseturnover> teahouseturnovers = teahouseturnoverDao.findByAddress(address);
        if(teahouseturnovers.size()==0)
            return true;
        else
            return false;
    }
    
    @RequestMapping("/updateTeahouseturnover.do")
    public String update(Teahouseturnover teahouseturnover)
    {
        teahouseturnoverDao.update(teahouseturnover);
        return "redirect:findTeahouseturnover.do";
        
    }
    @RequestMapping("/toAddTeahouseturnover.do")
    public String toAdd()
    {
        return "teahouseturnover/addTeahouseturnover";
        
    }
    @RequestMapping("addTeahouseturnover.do")
    public String add(Teahouseturnover teahouseturnover) {
        teahouseturnoverDao.save(teahouseturnover);
        return "redirect:findTeahouseturnover.do";
    } 
    
}

(7)修改密码

@RequestMapping("/toModifyPwd.do")
    public String toModifyPwd() {
        return "admin/modifyPwd";
    }
    
    @RequestMapping("/ModifyPwd.do")
    public String modifyPwd(String adminCode,String oldPassword,String newPassword, HttpSession session){
        Admin admin = adminDao.findByCode(adminCode);
        if(admin.getPassword().equals(oldPassword)){
            admin.setPassword(newPassword);
            adminDao.updateByPassword(admin);
            session.removeAttribute("admin");
            return "redirect:/login/toLogin.do";
        }else{
            return "main/error";
        }
    }
}

(8)修改个人信息

@RequestMapping("/touserInfo.do")
    public String toadminInfo() {
        return "admin/adminInfo";
    }
    
    @RequestMapping("/update.do")
    public String update(Admin admin,Model model,HttpSession session){
        adminDao.updateAdmin(admin);
        session.setAttribute("admin", adminDao.findById(admin.getAdminId()));
        model.addAttribute("flag", true);
        return "admin/adminInfo";
    }
}

1.4 模块设计还存在问题

申请房产、房产分配模块还未实现以及前端页面不够完善。

2.后面2周的规划

实现申请房产、房产分配模块,完善前端页面,并开始准备论文初稿。

3.数据库设计

管理员信息
中文列名数据类型主外键长度
管理员IDadminIdintPK10
管理员账号adminCodevarcharNOT NULL30
密码passwordvarcharNOT NULL30
姓名namevarcharNOT NULL30
电话telephonevarcharNOT NULL15
电子邮箱emailvarcharNOT NULL50
授权日期enrollDatedatetimeNOT NULL0

管理员信息
中文列名数据类型主外键长度
管理员IDadminIdintNOT NULL10
角色IDroleIdintNOT NULL10
IDidintPK11

申请人信息
中文列名数据类型主外键长度
申请人IDapplicatIdintPK10
申请人applicatvarcharNOT NULL10
地址addressvarcharNOT NULL50

实验室信息
中文列名数据类型主外键长度
实验室IDlaboratoryIdintPK10
地址addressvarcharNOT NULL50
状态statuscharNOT NULL10
使用者usercharNOT NULL10

模块
中文列名数据类型主外键长度
模块IDmoduleIdintPK10
名字namevarcharNOT NULL50

办公室信息
中文列名数据类型主外键长度
办公室IDofficeIdintPK10
地址addressvarcharNOT NULL50
状态statuscharNOT NULL10
使用者uservarcharNOT NULL50

角色

中文列名数据类型主外键长度
角色IDroleIdintPK10
名字namevarcharNOT NULL50

角色
中文列名数据类型主外键长度
角色IDmoduleIdintPK10
模块IDmoduleIdintNOT NULL10
IDidintNOT NULL11

学生宿舍信息
中文列名数据类型主外键长度
学生宿舍IDstudentDormitoryIdintPK10
地址addressvarcharNOT NULL50
状态statuscharNOT NULL10
学院academyvarcharNOT NULL50
居住者dwellervarcharNOT NULL50

教师周转房信息
中文列名数据类型主外键长度
教师周转房IDteacherHouseTurnoverIdintPK10
地址addressvarcharNOT NULL50
状态statuscharNOT NULL10
使用者uservarcharNOT NULL50

4.这2周参考资料

《锋利的jQuery》、MyBatis从入门到精通》...

毕业设计第四次任务书

标签:row   登录模块   http   move   参考资料   turn   mod   角色   ora   

原文地址:https://www.cnblogs.com/keyi123/p/8971455.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!