资源简介
基于现如今流行的SSM(spring springMVC mybatis mysql)框架的hrm人事管理系统后台实例 sql代码与详解:http://blog.csdn.net/csdn___lyy/article/details/72887390
代码片段和文件信息
package top.dreamyy.hrm.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import top.dreamyy.hrm.domain.Dept;
import top.dreamyy.hrm.service.HrmService;
import top.dreamyy.hrm.util.tag.PageModel;
@Controller
public class DeptController {
/**
* 自动注入UserService
* */
@Autowired
@Qualifier(“hrmService“)
private HrmService hrmService;
/**
* 处理/login请求
* */
@RequestMapping(value=“/dept/selectDept“)
public String selectDept(Model modelInteger pageIndex
@ModelAttribute Dept dept){
System.out.println(“selectDept -->>“);
System.out.println(“pageIndex = “ + pageIndex);
System.out.println(“dept = “ + dept);
PageModel pageModel = new PageModel();
System.out.println(“getPageIndex = “ + pageModel.getPageIndex());
System.out.println(“getPageSize = “ + pageModel.getPageSize());
System.out.println(“getRecordCount = “ + pageModel.getRecordCount());
if(pageIndex != null){
pageModel.setPageIndex(pageIndex);
}
/** 查询用户信息 */
List depts = hrmService.findDept(dept pageModel);
model.addAttribute(“depts“ depts);
model.addAttribute(“pageModel“ pageModel);
return “dept/dept“;
}
/**
* 处理删除部门请求
* @param String ids 需要删除的id字符串
* @param ModelAndView mv
* */
@RequestMapping(value=“/dept/removeDept“)
public ModelAndView removeDept(String idsModelAndView mv){
// 分解id字符串
String[] idArray = ids.split(““);
for(String id : idArray){
// 根据id删除部门
hrmService.removeDeptById(Integer.parseInt(id));
}
// 设置客户端跳转到查询请求
mv.setViewName(“redirect:/dept/selectDept“);
// 返回ModelAndView
return mv;
}
/**
* 处理添加请求
* @param String flag 标记, 1表示跳转到添加页面,2表示执行添加操作
* @param Dept dept 要添加的部门对象
* @param ModelAndView mv
* */
@RequestMapping(value=“/dept/addDept“)
public ModelAndView addDept(
String flag
@ModelAttribute Dept dept
ModelAndView mv){
if(flag.equals(“1“)){
// 设置跳转到添加页面
mv.setViewName(“dept/showAddDept“);
}else{
// 执行添加操作
hrmService.addDept(dept);
// 设置客户端跳转到查询请求
mv.setViewName(“redirect:/dept/selectDept“);
}
// 返回
return mv;
}
/**
* 处理修改部门请求
* @param String flag 标记, 1表示跳转到修改页面,2表示执行修改操作
* @param Dept dept 要修改部门的对象
* @param ModelAndView mv
* */
@RequestMapping(value=“/dept/updateDept“)
public ModelAndView updateDpet(
String flag
@ModelAttribute Dept dept
ModelAndView mv){
if(flag.equals(“1“)){
// 根据id查询部门
Dept target = hrmService.findDeptById(dept.getId());
// 设置Model数据
mv.addobject(“dept“ target);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-05-30 17:33 hrmapp\
文件 834 2017-05-30 17:33 hrmapp\.classpath
文件 906 2017-05-30 17:33 hrmapp\.project
目录 0 2017-05-30 17:33 hrmapp\.settings\
文件 567 2017-05-30 17:33 hrmapp\.settings\.jsdtscope
文件 364 2017-05-30 17:33 hrmapp\.settings\org.eclipse.jdt.core.prefs
文件 470 2017-05-30 17:33 hrmapp\.settings\org.eclipse.wst.common.component
文件 345 2017-05-30 17:33 hrmapp\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2017-05-30 17:33 hrmapp\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2017-05-30 17:33 hrmapp\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2017-05-30 17:33 hrmapp\build\
目录 0 2017-07-09 21:27 hrmapp\build\classes\
文件 314 2017-07-09 21:27 hrmapp\build\classes\db.properties
文件 640 2017-06-06 10:41 hrmapp\build\classes\log4j.properties
目录 0 2017-06-19 09:16 hrmapp\build\classes\top\
目录 0 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\
目录 0 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\
目录 0 2017-07-06 13:42 hrmapp\build\classes\top\dreamyy\hrm\controller\
文件 4452 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\controller\DeptController.class
文件 6912 2017-06-22 08:10 hrmapp\build\classes\top\dreamyy\hrm\controller\DocumentController.class
文件 5575 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\controller\EmployeeController.class
文件 910 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\controller\FormController.class
文件 4076 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\controller\JobController.class
文件 4544 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\controller\NoticeController.class
文件 4975 2017-07-06 13:43 hrmapp\build\classes\top\dreamyy\hrm\controller\UserController.class
目录 0 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\dao\
文件 1251 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\dao\DeptDao.class
文件 1564 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\dao\DocumentDao.class
文件 1999 2017-06-27 10:39 hrmapp\build\classes\top\dreamyy\hrm\dao\EmployeeDao.class
文件 1238 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\dao\JobDao.class
文件 1544 2017-06-19 09:16 hrmapp\build\classes\top\dreamyy\hrm\dao\NoticeDao.class
............此处省略1475个文件信息
评论
共有 条评论