赞
踩
一、项目简述
功能:宿舍管理员,最高管理员,学生三个身份,包括学 生管理,宿舍管理员管理,考勤管理,宿舍楼管理,缺勤 记录管理,个人信息修改等等功能。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术: JSP + Entity+ Servlet + html+ css + JavaScript + JQuery + Ajax 等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
// TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ret.put("code",0); ret.put("filename",newFileName); return ret; } } 角色控制层: @Controller public class RoleController { @Autowired private IRoleService roleService; @Autowired private IPermissionService permissionService; @PreAuthorize("hasRole('管理员')") @ResponseBody @RequestMapping("/role/doAdd")
return new AjaxResult("修改失败");
}
//添加角色
@RequestMapping("/role/deleteRole")
@ResponseBody
public AjaxResult deleteRole(Long id){
System.out.println("删除角色...."+id);
AjaxResult ajaxResult = new AjaxResult();
try {
roleService.deleteRole(id);
} catch (Exception e) {
e.printStackTrace();
return new AjaxResult("删除失败");
}
return ajaxResult;
return Message.error("修改用户信息失败"); } } //添加用户 @GetMapping("/deleteUser") @ApiOperation("删除用户接口") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "如:88",required = true) }) @PreAuthorize("hasRole('管理员')") @ResponseBody public AjaxResult deleteUser(@RequestParam(required = true) Long id){ AjaxResult ajaxResult = new AjaxResult(); try { userService.deleteUser(id); } catch (Exception e) { e.printStackTrace(); return new AjaxResult("删除失败"); } return ajaxResult; } @PostMapping(value="/deleteBatchUser") @ApiOperation("批量删除用户接口") @PreAuthorize("hasRole('管理员')") @ResponseBody
//保存老师组 userService.saveRel(is, userInfo, tGroup); } if(user.getType() == 3) { //保存学生组 userService.saveRel(is, userInfo, stuGroup); } Long userId = user.getId(); return userId; } /** * 修改密码页面 * @return */ @RequestMapping(value="/update_pwd",method=RequestMethod.GET) public String updatePwd(){ return "views/user/update_pwd"; } /**
* 清除缓存 * @param request * @param response * @return */ @ResponseBody @PostMapping("/clear_cache") public Message clearCache(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("Cache-Control","no-store"); response.setHeader("Pragrma","no-cache"); response.setDateHeader("Expires",0); return Message.success(); } } 公用的上传类: /** * 公用的上传类
if(StringUtils.isEmpty(user.getTel())){ ret.put("msg","请填写手机号"); return ret; } if(StringUtils.isEmpty(user.getHeadImg())){ ret.put("msg","请上传头像"); return ret; } if(userService.addUser(user)<=0) { ret.put("msg", "添加用户失败"); return ret; } ret.put("code",0); ret.put("msg","添加用户成功"); return ret; } /** * 修改用户信息操作 * @param user * @return */ @PostMapping("/editSaveUser") @ApiOperation("修改用户接口") @PreAuthorize("hasRole('管理员')") @ResponseBody
* 修改用户信息操作
* @param user
* @return
*/
@PostMapping("/editSaveUser")
@ApiOperation("修改用户接口")
@PreAuthorize("hasRole('管理员')")
@ResponseBody
public Message editSaveUser(User user){
if(StringUtils.isEmpty(user.getUsername())){
return Message.error("请填写用户名");
}
if(StringUtils.isEmpty(user.getEmail())){
return Message.error("请填写邮箱");
}
} /** * 清除缓存 * @param request * @param response * @return */ @ResponseBody @PostMapping("/clear_cache") public Message clearCache(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("Cache-Control","no-store"); response.setHeader("Pragrma","no-cache"); response.setDateHeader("Expires",0); return Message.success(); } } 公用的上传类: /** * 公用的上传类
ret.put("msg","请填写手机号");
return ret;
}
if(StringUtils.isEmpty(user.getHeadImg())){
ret.put("msg","请上传头像");
return ret;
}
if(userService.addUser(user)<=0) {
ret.put("msg", "添加用户失败");
return ret;
}
ret.put("code",0);
ret.put("msg","添加用户成功");
return ret;
}
AjaxResult ajaxResult = new AjaxResult(); String userId = (String)paramMap.get("userId"); List roleIds = (List) paramMap.get("roleIds"); try { //添加用户对应的角色 roleService.addUserRole(userId,roleIds); return ajaxResult; }catch (Exception e){ e.printStackTrace(); return new AjaxResult("保存角色失败"); } } //添加用户 @RequestMapping("/regSaveUser") @ResponseBody public Long addTeacher(User user){ System.out.println("保存用户...."+user);
@PostMapping("/addUser") @ApiOperation("添加用户接口") @ResponseBody public Map<String,Object> addUser(User user){ Map<String, Object> ret = new HashMap<>(); ret.put("code",-1); if(StringUtils.isEmpty(user.getUsername())){ ret.put("msg","请填写用户名"); return ret; } if(StringUtils.isEmpty(user.getPassword())){ ret.put("msg","请填写密码"); return ret; } if(StringUtils.isEmpty(user.getEmail())){ ret.put("msg","请填写邮箱"); return ret; } if(StringUtils.isEmpty(user.getTel())){ ret.put("msg","请填写手机号"); return ret; } if(StringUtils.isEmpty(user.getHeadImg())){
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。