package com.live800.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.live800.pojo.Department;
import com.live800.pojo.Role;
import com.live800.pojo.User;
import com.live800.service.DepartmentService;
import com.live800.service.RoleService;
import com.live800.service.UserService;
@Controller
public class UserController{
private List<User> users;
private int currentPage = 1;
private int maxPage;
private List<Integer> pages;
private List<Department> departments;
private User user;
private List<Role> roles;
private int lastUid;
private int lastDid;
private int uid;
private int did;
private Department department;
@Autowired
private UserService userService;
@Autowired
private DepartmentService departmentService;
@Autowired
private RoleService roleService;
/**
* 分页查询所有用户跳转至职员管理界面
* @return
* @throws Exception
*/
@RequestMapping("/findByPage.do")
public ModelAndView findByPage(HttpServletRequest request) throws Exception{
if(request.getParameter("currentPage")!=null&&!"".equals(request.getParameter("currentPage"))){
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
Map<String,Object> map = new HashMap<String, Object>();
users = userService.findByPage(currentPage, 3);
maxPage = userService.getMaxPage();
pages = new ArrayList<Integer>();
for(int i=1;i<=maxPage;i++){
pages.add(i);
}
departments = departmentService.findAll();
map.put("users", users);
map.put("maxPage", maxPage);
map.put("currentPage", currentPage);
map.put("pages", pages);
map.put("departments", departments);
return new ModelAndView("systemmanage/employerManager", "map", map);
}
/**
* 分页查询所有用户跳转至角色管理页面
* @return
* @throws Exception
*/
@RequestMapping("/findRoleByPage.do")
public ModelAndView findRoleByPage(HttpServletRequest request) throws Exception{
if(request.getParameter("currentPage")!=null&&!"".equals(request.getParameter("currentPage"))){
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
Map<String,Object> map = new HashMap<String, Object>();
users = userService.findByPage(currentPage, 3);
maxPage = userService.getMaxPage();
pages = new ArrayList<Integer>();
for(int i=1;i<=maxPage;i++){
pages.add(i);
}
departments = departmentService.findAll();
map.put("users", users);
map.put("maxPage", maxPage);
map.put("currentPage", currentPage);
map.put("pages", pages);
map.put("departments", departments);
return new ModelAndView("systemmanage/userManager", "map", map);
}
/**
* @return 部门管理界面
*/
@RequestMapping("/findDepartment.do")
public ModelAndView findDepartment(){
departments = departmentService.findAll();
return new ModelAndView("systemmanage/departmentManager", "departments", departments);
}
/**
*
* @return跳转到添加新部门的页面
*/
@RequestMapping("/toAddDepartment.do")
public ModelAndView toAddDepartment(){
lastDid = departmentService.findLastDid();
return new ModelAndView("systemmanage/addDepartment", "lastDid", lastDid);
}
//增加新部门
@RequestMapping(method=RequestMethod.POST,value="/addDepartment.do")
public ModelAndView addDepartment(Department department){
departmentService.add(department);
return findDepartment();
}
////删除部门
@RequestMapping("/deleteDepartment.do")
public ModelAndView deleteDepartment(HttpServletRequest request){
did = Integer.parseInt(request.getParameter("did"));
departmentService.delete(did);
return findDepartment();
}
/**
*
* @return跳转修改部门信息的页面
*/
@RequestMapping("/toUpdateDepartment.do")
public ModelAndView toUpdateDepartment(HttpServletRequest request){
did = Integer.parseInt(request.getParameter("did"));
department = departmentService.findDepartmentById(did);
return new ModelAndView("systemmanage/modifyDepartment", "department", department);
}
//修改部门信息
@RequestMapping(method=RequestMethod.POST,value="/modifyDepartment.do")
public ModelAndView modifyDepartment(Department department){
departmentService.modifyDepartment(department);
return findDepartment();
}
//多条件查询 跳转至角色管理页面
@RequestMapping(method=RequestMethod.POST,value="/findRoleByConditions.do")
public ModelAndView findRoleByConditions(HttpServletRequest request){
user = new User();
if(request.getParameter("did")!=null&&!"".equals(request.getParameter("did"))){
did = Integer.parseInt(request.getParameter("did"));
user.setDid(did);
}
String name = request.getParameter("name");
user.setName(name);
departments = departmentService.findAll();
users = userService.findByConditions(user);
Map<String,Object> map = new HashMap<String, Object>();
map.put("users", users);
map.put("maxPage", maxPage);
map.put("currentPage", currentPage);
map.put("pages", pages);
map.put("departments", departments);
return new ModelAndView("systemmanage/userManager", "map", map);
}
//修改角色
@RequestMapping("/toUpdateRole.do")
public ModelAndView toUpdateRole(HttpServletRequest request){
uid = Integer.parseInt(request.getParameter("uid"));
currentPage = Integer.parseInt(request.getParameter("currentPage"));
user = userService.findById(uid);
Map<String,Object> map = new HashMap<String, Object>();
map.put("user", user);
map.put("currentPage", currentPage);
return new ModelAndView("systemmanage/assignUser", "map", map);
}
/*
* 跳转到添加员工
* int 接收年龄
* String 返回结果
*/
@RequestMapping("/toAdd.do")
public ModelAndView toAdd(){
roles = roleService.findAll();
departments = departmentService.findAll();
lastUid = userService.findLastUid();
Map<String,Object> map = new HashMap<String, Object>();
map.put("roles", roles);
map.put("departments", departments);
map.put("lastUid", lastUid);
return new ModelAndView("systemmanage/addEmployer", "map", map);
}
@RequestMapping(method=RequestMethod.POST,value="/updateRole.do")
public ModelAndView updateRole(HttpServletRequest request,User user) throws Exception{
userService.updateRole(user);
return findRoleByPage(request);
}
//添加职员信息
@RequestMapping(method=RequestMethod.POST,value="/add.do")
public ModelAndView add(HttpServletRequest request,User user) throws Exception{
userService.add(user);
return findByPage(request);
}
//多条件查询 跳转至职员管理界面
@RequestMapping(method=RequestMethod.POST,value="/findByConditions.do")
public ModelAndView findByConditions(HttpServletRequest request){
if(request.getParameter("currentPage")!=null&&!"".equals(request.getParameter("currentPage"))){
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
user = new User();
if(request.getParameter("did")!=null&&!"".equals(request.getParameter("did"))){
did = Integer.parseInt(request.getParameter("did"));
user.setDid(did);
}
String name = request.getParameter("name");
user.setName(name);
departments = departmentService.findAll();
users = userService.findByConditions(user);
Map<String,Object> map = new HashMap<String, Object>();
map.put("departments", departments);
map.put("users", users);
map.put("currentPage", currentPage);
return new ModelAndView("systemmanage/employerMan
没有合适的资源?快使用搜索试试~ 我知道了~
需求管理系统
共235个文件
gif:45个
java:44个
class:44个
3星 · 超过75%的资源 需积分: 42 45 下载量 151 浏览量
2015-03-20
09:56:08
上传
评论 2
收藏 8.26MB ZIP 举报
温馨提示
使用springMvc+mybatis实现的需求管理系统,主要分为用户管理和需求管理两个大部分。用户管理分为部门管理,角色管理和职员管理;需求管理分为个人信息和需求管理;权限设定,ui设计等,是入门学习springMvc最好的项目,全项目采用注解,达到0配置的要求,供大家分享学习,提出宝贵的意见。
资源推荐
资源详情
资源评论
收起资源包目录
需求管理系统 (235个子文件)
UserController.class 10KB
UserDaoImpl.class 8KB
ApprovalController.class 8KB
DamandController.class 8KB
DamandDaoImpl.class 7KB
InfoController.class 6KB
UserServiceImpl.class 4KB
User.class 4KB
Damand.class 4KB
DamandServiceImpl.class 3KB
DepartmentDaoImpl.class 3KB
DBUtil.class 3KB
LoginController.class 3KB
DepartmentServiceImple.class 2KB
Approval.class 2KB
RoleDaoImpl.class 2KB
ApprovalDaoImpl.class 2KB
Log4j_Properties.class 2KB
SpringContextUtil.class 2KB
MyHandlerInterceptor.class 2KB
MyBatisUtil.class 1KB
Department.class 1KB
SpringDBUtil.class 1KB
TestGetBean.class 1KB
UserMapper.class 1KB
DamandService.class 1KB
DamandMapper.class 1009B
UserDao.class 1008B
ApprovalServiceImpl.class 990B
DamandDao.class 985B
RoleServiceImpl.class 970B
Role.class 944B
UserService.class 907B
DateUtil.class 861B
TestSpringDBUtil.class 673B
DepartmentMapper.class 632B
DepartmentService.class 438B
DepartmentDao.class 426B
RoleMapper.class 273B
RoleDao.class 264B
ApprovalService.class 253B
ApprovalMapper.class 242B
ApprovalDao.class 241B
RoleService.class 228B
.classpath 849B
org.eclipse.wst.common.component 466B
org.eclipse.wst.jsdt.ui.superType.container 49B
top.css 2KB
style.css 1KB
dtree.css 795B
皋牢_7.gif 89KB
www6Lucn0028.gif 39KB
皋牢_8.gif 17KB
menu3.gif 2KB
globe.gif 1KB
globe.gif 1KB
trash.gif 1KB
trash.gif 1KB
question.gif 1KB
question.gif 1KB
base.gif 1KB
base.gif 1KB
nolines_plus.gif 870B
nolines_plus.gif 870B
nolines_minus.gif 861B
nolines_minus.gif 861B
musicfolder.gif 633B
musicfolder.gif 633B
imgfolder.gif 622B
imgfolder.gif 622B
folderopen.gif 376B
folderopen.gif 376B
folder.gif 372B
page.gif 372B
page.gif 372B
folder.gif 372B
cd.gif 239B
cd.gif 239B
Circle.gif 173B
plus.gif 89B
plus.gif 89B
plusbottom.gif 88B
plusbottom.gif 88B
minus.gif 86B
minus.gif 86B
minusbottom.gif 85B
minusbottom.gif 85B
join.gif 69B
join.gif 69B
line.gif 66B
joinbottom.gif 66B
line.gif 66B
joinbottom.gif 66B
empty.gif 62B
empty.gif 62B
left_staff.htm 2KB
left_leader.htm 2KB
bottom.htm 2KB
left_admin.htm 2KB
top_index.htm 1KB
共 235 条
- 1
- 2
- 3
资源评论
- 小珊珊2016-07-26挺好的,谢谢分享
- wszwin82015-12-28系统可以跑起来。还是比较简谱的一个系统
- happy0wang2016-08-18springmvc默认单实例也没看到你处理为多示例,action层居然还使用全局变量。不要模仿struts2.浪费了我的10分。
xiongzhenxing00
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功