毕业设计第四次任务书

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 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.数据库设计
<center>
<b>管理员信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>管理员ID</td>
<td>adminId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>管理员账号</td>
<td>adminCode</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>30</td>
</tr>
<tr>
<td>密码</td>
<td>password</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>30</td>
</tr>
<tr>
<td>姓名</td>
<td>name</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>30</td>
</tr>
<tr>
<td>电话</td>
<td>telephone</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>15</td>
</tr>
<tr>
<td>电子邮箱</td>
<td>email</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>授权日期</td>
<td>enrollDate</td>
<td>datetime</td>
<td>NOT NULL</td>
<td>0</td>
</tr>
</table>
<br><b>管理员信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>管理员ID</td>
<td>adminId</td>
<td>int</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>角色ID</td>
<td>roleId</td>
<td>int</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>ID</td>
<td>id</td>
<td>int</td>
<td>PK</td>
<td>11</td>
</tr>
</table>
<br><b>申请人信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>申请人ID</td>
<td>applicatId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>申请人</td>
<td>applicat</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>地址</td>
<td>address</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
<br><b>实验室信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>实验室ID</td>
<td>laboratoryId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>地址</td>
<td>address</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>状态</td>
<td>status</td>
<td>char</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>使用者</td>
<td>user</td>
<td>char</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
</table>
<br><b>模块</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>模块ID</td>
<td>moduleId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>名字</td>
<td>name</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
<br><b>办公室信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>办公室ID</td>
<td>officeId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>地址</td>
<td>address</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>状态</td>
<td>status</td>
<td>char</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>使用者</td>
<td>user</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
<br><b>角色</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<br><td>角色ID</td>
<td>roleId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>名字</td>
<td>name</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
<br><b>角色</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>角色ID</td>
<td>moduleId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>模块ID</td>
<td>moduleId</td>
<td>int</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>ID</td>
<td>id</td>
<td>int</td>
<td>NOT NULL</td>
<td>11</td>
</tr>
</table>
<br><b>学生宿舍信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>学生宿舍ID</td>
<td>studentDormitoryId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>地址</td>
<td>address</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>状态</td>
<td>status</td>
<td>char</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>学院</td>
<td>academy</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>居住者</td>
<td>dweller</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
<br><b>教师周转房信息</b><br>
<table width="800">
<tr>
<td>中文</td>
<td>列名</td>
<td>数据类型</td>
<td>主外键</td>
<td>长度</td>
</tr>
<tr>
<td>教师周转房ID</td>
<td>teacherHouseTurnoverId</td>
<td>int</td>
<td>PK</td>
<td>10</td>
</tr>
<tr>
<td>地址</td>
<td>address</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
<tr>
<td>状态</td>
<td>status</td>
<td>char</td>
<td>NOT NULL</td>
<td>10</td>
</tr>
<tr>
<td>使用者</td>
<td>user</td>
<td>varchar</td>
<td>NOT NULL</td>
<td>50</td>
</tr>
</table>
</center>
##4.这2周参考资料
```《锋利的jQuery》、MyBatis从入门到精通》...```
posted on 2018-04-30 10:58  柯yi123  阅读(251)  评论(2编辑  收藏  举报