基于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)
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);
model.addAttribute("employee", employee);
return "admin/oneself_detail";
}
@RequestMapping("/oneself/{id}/toUpdate.do")
public String toUpdate2(Model model, @PathVariable Integer 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";
}
}
@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";
}
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";
}
}
@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);
@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);
model.addAttribute("page", page);
return "admin/position_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Position> dList = positionService.selectList(new EntityWrapper<Position>()
.orderBy("position_number", false));
model.addAttribute("positionNumber", dList.get(0).getPositionNumber()+1);
return "admin/position_add";
}
@RequestMapping("/add.do")
public String add(Position position){
positionService.insert(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Position position = positionService.selectById(id);
model.addAttribute("position", position);
return "admin/position_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Position position){
position.setId(id);
positionService.updateById(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
}
}
@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);
model.addAttribute("page", page);
return "admin/position_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Position> dList = positionService.selectList(new EntityWrapper<Position>()
.orderBy("position_number", false));
model.addAttribute("positionNumber", dList.get(0).getPositionNumber()+1);
return "admin/position_add";
}
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
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";
}
}
@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";
}
@RequestMapping("/listPage.do")
public String selectList(Model model, int pageNo){
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";
}
}
@Controller
@RequestMapping("/position")
public class PositionController {
@Autowired
private PositionService positionService;
@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);
@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);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
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(), "未批准");
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";
}
}
@Controller
@RequestMapping("/leave")
public class LeaveController {
@Controller
@RequestMapping("/department")
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";
}
@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);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
@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);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
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";
}
@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("/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";
}
}
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
leaveService.updateStatus(id);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
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";
}
}
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";
}
}
@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);
model.addAttribute("page", page);
return "admin/position_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Position> dList = positionService.selectList(new EntityWrapper<Position>()
.orderBy("position_number", false));