基于javaweb+mysql的ssm医院人事管理系统员工考勤管理系统(java+jsp+ssm+mysql+bootstrap)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
人事员工考勤管理,登录用户分为:
人事部主任(超级管理员)
人事部员工(管理员)
部门主任(部门管理)
部门员工(普通员工)
个人信息维护、员工管理、请假、签到打卡、审批、部门管理、职位管理等……
技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) MySQL Bootstrap……
基于javaweb+mysql的SSM医院人事管理系统员工考勤管理系统(java+jsp+ssm+mysql+bootstrap)
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Overtime> page = overtimeService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/overtime_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@RequestMapping("/add.do")
public String add(Overtime overtime, String date){
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.insert(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
//查询出要修改的记录信息
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
model.addAttribute("page", page);
return "admin/search_result";
}
@RequestMapping("/logout.do")
public String logout(HttpSession session){
session.removeAttribute("loged");
return "login";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Overtime> page = overtimeService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/overtime_list";
}
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@RequestMapping("/list.do")
public String selectList(Model model){
List<Attendance> list = attendanceService.selectList();
model.addAttribute("aList",list);
return "admin/attendance_list";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber){
List<Attendance> list = attendanceService.selectByEmployee(employeeNumber);
model.addAttribute("aList",list);
return "admin/oneself_attendance";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/move")
public class MoveController {
@Autowired
private MoveService moveService;
@RequestMapping("/list.do")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Department> page = departmentService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/department_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>()
.orderBy("department_number", false));
model.addAttribute("departmentNumber", dList.get(0).getDepartmentNumber()+1);
return "admin/department_add";
}
@RequestMapping("/add.do")
public String add(Department department){
departmentService.insert(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Department department = departmentService.selectById(id);
model.addAttribute("department", department);
return "admin/department_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Department department){
department.setId(id);
departmentService.updateById(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
departmentService.deleteById(id);
return "forward:/department/listPage.do?pageNo=1";
}
}
package com.demo.controller;
@RequestMapping("/oneself.do")
public String seletByEmployee(HttpSession session, int pageNo, Model model){
Employee employee = (Employee)session.getAttribute("loged");
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")
public String selectNotList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "未批准");
model.addAttribute("list", list);
return "admin/leave_notlist";
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/history")
public class HistoryController {
@Autowired
private HistoryService historyService;
@Autowired
private EmployeeService employeeService;
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>()
.orderBy("department_number", false));
model.addAttribute("departmentNumber", dList.get(0).getDepartmentNumber()+1);
return "admin/department_add";
}
@RequestMapping("/add.do")
public String add(Department department){
departmentService.insert(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Department department = departmentService.selectById(id);
model.addAttribute("department", department);
return "admin/department_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Department department){
department.setId(id);
departmentService.updateById(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
departmentService.deleteById(id);
return "forward:/department/listPage.do?pageNo=1";
}
}
package com.demo.controller;
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, String date, Overtime overtime){
overtime.setId(id);
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.updateById(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
overtimeService.deleteById(id);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber, int pageNo){
Page<Overtime> page = overtimeService.selectByEmployee(pageNo, employeeNumber);
model.addAttribute("page",page);
return "admin/oneself_overtime";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@RequestMapping("/list.do")
public String selectList(Model model){
List<Attendance> list = attendanceService.selectList();
model.addAttribute("aList",list);
return "admin/attendance_list";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber){
List<Attendance> list = attendanceService.selectByEmployee(employeeNumber);
model.addAttribute("aList",list);
return "admin/oneself_attendance";
}
}
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")
public String selectNotList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "未批准");
model.addAttribute("list", list);
return "admin/leave_notlist";
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/history")
@RequestMapping("/login.do")
public String toLogin(){
return "login";
}
@RequestMapping("/checkLogin.do")
public String checkLogin(HttpSession session, Employee employee){
Employee employee2 = employeeService.checkLogin(employee.getEmployeeNumber(),
employee.getPassword());
if (employee2 != null) {
session.setAttribute("loged", employee2);
String level = employee2.getPosition().getLevel();
if (level.equals("人事部主任")) {
return "admin/index1";
}else if (level.equals("人事部员工")) {
return "admin/index2";
}else if (level.equals("部门主任")) {
return "admin/index3";
}else {
return "admin/index4";
}
}else{
return "login";
}
}
@RequestMapping("/welcome.do")
public String toWelcome(){
return "welcome";
}
@RequestMapping("/listPage.do")
public String selectList(Model model, int pageNo){
Page<Employee> page = employeeService.selectListByPage(pageNo);
model.addAttribute("page", page);
return "admin/employee_list";
}
@RequestMapping("/{id}/detial.do")
public String selectEmployee(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
model.addAttribute("employee", employee);
return "admin/employee_detail";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@Autowired
private PositionService positionService;
@Autowired
private HistoryService historyService;
@RequestMapping("/login.do")
public String toLogin(){
return "login";
}
@RequestMapping("/checkLogin.do")
public String checkLogin(HttpSession session, Employee employee){
Employee employee2 = employeeService.checkLogin(employee.getEmployeeNumber(),
employee.getPassword());
if (employee2 != null) {
session.setAttribute("loged", employee2);
String level = employee2.getPosition().getLevel();
if (level.equals("人事部主任")) {
return "admin/index1";
}else if (level.equals("人事部员工")) {
return "admin/index2";
}else if (level.equals("部门主任")) {
return "admin/index3";
}else {
return "admin/index4";
}
}else{
return "login";
}
}
@RequestMapping("/welcome.do")
public String toWelcome(){
return "welcome";
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, String date, Overtime overtime){
overtime.setId(id);
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.updateById(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
overtimeService.deleteById(id);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber, int pageNo){
Page<Overtime> page = overtimeService.selectByEmployee(pageNo, employeeNumber);
model.addAttribute("page",page);
return "admin/oneself_overtime";
}
}
package com.demo.controller;
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber, int pageNo){
Page<Overtime> page = overtimeService.selectByEmployee(pageNo, employeeNumber);
model.addAttribute("page",page);
return "admin/oneself_overtime";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/leave")
public class LeaveController {
@Autowired
private LeaveService leaveService;
@RequestMapping("/list.do")
public String selectList(Model model){
List<Leave> list = leaveService.selectList();
model.addAttribute("list", list);
return "admin/leave_list";
}
@RequestMapping("/{id}/detail.do")
public String selectLeave(@PathVariable Integer id, Model model){
Leave leave = leaveService.selectLeave(id);
model.addAttribute("leave", leave);
return "admin/leave_detail";
}
@RequestMapping("/{id}/update.do")
public String updateStatus(@PathVariable Integer id){
leaveService.updateStatus(id);
public String selectRetireByPage(Model model, int pageNo){
Page<History> page = historyService.selectRetireByPage(pageNo);
model.addAttribute("page", page);
return "admin/retire_list";
}
@RequestMapping("/{id}/detail.do")
public String selectHistory(@PathVariable Integer id, Model model){
History history = historyService.selectHistory(id);
model.addAttribute("history", history);
return "admin/history_detail";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
History history = historyService.selectHistory(id);
if (history.getStatus().equals("在职")) {
Employee employee = employeeService.selectByNumber(history.getEmployeeNumber());
return "forward:/employee/"+ employee.getId() +"/toUpdate.do";
}else{
model.addAttribute("history", history);
return "admin/history_update";
}
}
@RequestMapping("/{id}/updateRetire.do")
public String updateRetire(@PathVariable Integer id, History history, String date){
history.setId(id);
history.setBirthday(MTimeUtil.stringParse(date));
historyService.updateById(history);
return "forward:/history/retireListPage.do?pageNo=1";
}
@RequestMapping("/listPage.do")
public String selectListByPage(Model model, int pageNo){
Page<History> page = historyService.selectLisByPage(pageNo);
model.addAttribute("page", page);
return "admin/history_list";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, History history, String date){
history.setId(id);
history.setBirthday(MTimeUtil.stringParse(date));
employeeService.addEmployee(employee);
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
Employee employee = employeeService.selectById(id);
model.addAttribute("employee", employee);
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
List<Position> pList = positionService.selectList(new EntityWrapper<Position>());
model.addAttribute("pList", pList);
return "admin/employee_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Employee employee, String date, String status,
HttpSession session){
employee.setId(id);
employee.setBirthday(MTimeUtil.stringParse(date));
//得到操作人员的名字
Employee employee2 = (Employee) session.getAttribute("loged");
if(employee.getDepartmentNumber() == null){
employee.setDepartment(employee2.getDepartment());
employee.setDepartmentNumber(employee2.getDepartmentNumber());
}
if(employee.getPositionNumber() == null){
employee.setPosition(employee2.getPosition());
employee.setPositionNumber(employee2.getPositionNumber());
}
if(status == null){
status = "在职";
}
employeeService.updateEmployee(employee, status, employee2.getName());
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
employeeService.deleteEmployee(id);
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/oneself/{id}/detial.do")
public String selectEmployee2(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
employeeService.updateEmployee(employee, status, employee2.getName());
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
employeeService.deleteEmployee(id);
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/oneself/{id}/detial.do")
public String selectEmployee2(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
model.addAttribute("employee", employee);
return "admin/oneself_detail";
}
@RequestMapping("/oneself/{id}/toUpdate.do")
public String toUpdate2(Model model, @PathVariable Integer id){
Employee employee = employeeService.selectById(id);
model.addAttribute("employee", employee);
return "admin/oneself_update";
}
@RequestMapping("/search")
public String search(Model model, String input, int pageNo){
Page<Employee> page = employeeService.search(input, pageNo);
model.addAttribute("page", page);
return "admin/search_result";
}
@RequestMapping("/logout.do")
public String logout(HttpSession session){
session.removeAttribute("loged");
return "login";
}
}
package com.demo.controller;
return "forward:/position/listPage.do?pageNo=1";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@RequestMapping("/list.do")
public String selectList(Model model){
List<Attendance> list = attendanceService.selectList();
model.addAttribute("aList",list);
return "admin/attendance_list";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber){
List<Attendance> list = attendanceService.selectByEmployee(employeeNumber);
model.addAttribute("aList",list);
return "admin/oneself_attendance";
}
}
package com.demo.controller;
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Department department = departmentService.selectById(id);
model.addAttribute("department", department);
return "admin/department_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Department department){
department.setId(id);
departmentService.updateById(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
departmentService.deleteById(id);
return "forward:/department/listPage.do?pageNo=1";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/position")
public class PositionController {
@Autowired
private PositionService positionService;
@RequestMapping("/listPage.do")
public String selecListByPage(int pageNo, Model model){
Page<Position> page = positionService.selectListByPage(pageNo);
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
positionService.deleteById(id);
return "forward:/position/listPage.do?pageNo=1";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@RequestMapping("/list.do")
public String selectList(Model model){
List<Attendance> list = attendanceService.selectList();
model.addAttribute("aList",list);
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Overtime> page = overtimeService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/overtime_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@RequestMapping("/add.do")
public String add(Overtime overtime, String date){
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.insert(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
//查询出要修改的记录信息
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
positionService.deleteById(id);
return "forward:/position/listPage.do?pageNo=1";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@RequestMapping("/list.do")
public String selectList(Model model){
List<Attendance> list = attendanceService.selectList();
model.addAttribute("aList",list);
return "admin/attendance_list";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber){
if(status == null){
status = "在职";
}
employeeService.updateEmployee(employee, status, employee2.getName());
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
employeeService.deleteEmployee(id);
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/oneself/{id}/detial.do")
public String selectEmployee2(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
model.addAttribute("employee", employee);
return "admin/oneself_detail";
}
@RequestMapping("/oneself/{id}/toUpdate.do")
public String toUpdate2(Model model, @PathVariable Integer id){
Employee employee = employeeService.selectById(id);
model.addAttribute("employee", employee);
return "admin/oneself_update";
}
@RequestMapping("/search")
public String search(Model model, String input, int pageNo){
Page<Employee> page = employeeService.search(input, pageNo);
model.addAttribute("page", page);
return "admin/search_result";
}
@RequestMapping("/logout.do")
public String logout(HttpSession session){
session.removeAttribute("loged");
return "login";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/history")
public class HistoryController {
@Autowired
private HistoryService historyService;
@Autowired
private EmployeeService employeeService;
@RequestMapping("/retireListPage.do")
public String selectRetireByPage(Model model, int pageNo){
Page<History> page = historyService.selectRetireByPage(pageNo);
model.addAttribute("page", page);
return "admin/retire_list";
}
@RequestMapping("/{id}/detail.do")
public String selectHistory(@PathVariable Integer id, Model model){
History history = historyService.selectHistory(id);
model.addAttribute("history", history);
return "admin/history_detail";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
History history = historyService.selectHistory(id);
if (history.getStatus().equals("在职")) {
Employee employee = employeeService.selectByNumber(history.getEmployeeNumber());
return "forward:/employee/"+ employee.getId() +"/toUpdate.do";
}else{
model.addAttribute("history", history);
return "admin/history_update";
}
}
@RequestMapping("/{id}/updateRetire.do")
public String updateRetire(@PathVariable Integer id, History history, String date){
history.setId(id);
history.setBirthday(MTimeUtil.stringParse(date));
historyService.updateById(history);
return "forward:/history/retireListPage.do?pageNo=1";
}
@RequestMapping("/listPage.do")
if (employee2 != null) {
session.setAttribute("loged", employee2);
String level = employee2.getPosition().getLevel();
if (level.equals("人事部主任")) {
return "admin/index1";
}else if (level.equals("人事部员工")) {
return "admin/index2";
}else if (level.equals("部门主任")) {
return "admin/index3";
}else {
return "admin/index4";
}
}else{
return "login";
}
}
@RequestMapping("/welcome.do")
public String toWelcome(){
return "welcome";
}
@RequestMapping("/listPage.do")
public String selectList(Model model, int pageNo){
Page<Employee> page = employeeService.selectListByPage(pageNo);
model.addAttribute("page", page);
return "admin/employee_list";
}
@RequestMapping("/{id}/detial.do")
public String selectEmployee(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
model.addAttribute("employee", employee);
return "admin/employee_detail";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<History> eList = historyService.selectList(new EntityWrapper<History>()
.orderBy("employee_number", false));
model.addAttribute("employeeNumber",eList.get(0).getEmployeeNumber()+1);
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
List<Position> pList = positionService.selectList(new EntityWrapper<Position>());
model.addAttribute("pList", pList);
return "admin/employee_add";
}
@RequestMapping("/add.do")
public String add(Employee employee, String date) {
employee.setBirthday(MTimeUtil.stringParse(date));
employeeService.addEmployee(employee);
return "forward:/employee/listPage.do?pageNo=1";
return "forward:/employee/welcome.do";
}
@RequestMapping("/oneself.do")
public String seletByEmployee(HttpSession session, int pageNo, Model model){
Employee employee = (Employee)session.getAttribute("loged");
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")
public String selectNotList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "未批准");
model.addAttribute("list", list);
return "admin/leave_notlist";
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
package com.demo.controller;
@Controller
@RequestMapping("/history")
public class HistoryController {
return "admin/overtime_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@RequestMapping("/add.do")
public String add(Overtime overtime, String date){
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.insert(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
//查询出要修改的记录信息
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, String date, Overtime overtime){
overtime.setId(id);
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.updateById(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
overtimeService.deleteById(id);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber, int pageNo){