功能介绍:
登录、新增、修改、离职
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@RequestMapping("/Department")
@RestController
public class DepartmentController {
@Autowired
IDepartmentService departmentService;
@Autowired
private HttpServletRequest request;
@PostMapping("/addDepartment")
public Result addDepartment(@RequestParam("departmentNumber") String departmentNumber, @RequestParam("departmentName") String departmentName,
@RequestParam("departmentHead") String departmentHead, @RequestParam("departmentAddress") String departmentAddress,
@RequestParam("departmentTel") String departmentTel, @RequestParam("departmentFax") String departmentFax)throws ParseException {
SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Department department = new Department();
department.setDepartmentName(departmentName);
department.setDepartmentNumber(departmentNumber);
department.setDepartmentAddress(departmentAddress);
department.setDepartmentHead(departmentHead);
department.setDepartmentTel(departmentTel);
department.setDepartmentFax(departmentFax);
return departmentService.addDepartment(department);
}
@GetMapping("/getAllDepartments")
public Result modifyPwd(@RequestParam("oldPwd") String oldPwd,@RequestParam("newPwd") String newPwd){
return employeeService.modifyPwd(oldPwd,newPwd);
}
@GetMapping("/loginYesOrNo")
@ResponseBody
public Result loginYesOrNo(){
employeeServiceImpl.getEmployeeLoginInfo();
return new Result(0,"已登录",null);
}
@GetMapping("/getEmployeeByEmployeeNumber")
@ResponseBody
public Result getEmployeeByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber)throws ParseException {
Employee employee = new Employee();
employee.setEmployeeNumber(employeeNumber);
return employeeService.getEmployeeByEmployeeNumber(employee);
}
@PostMapping("/getEmployeeByName")
@ResponseBody
}
@GetMapping("/getDepartmentByDepartmentNumber")
public ModelAndView getDepartmentByDepartmentNumber(@RequestParam("departmentNumber") String departmentNumber)throws ParseException{
departmentService.getDepartmentByDepartmentNumber(departmentNumber);
return new ModelAndView("department");
}
@PostMapping("/getDepartmentNumberByDepartmentName")
public Result getDepartmentNumberByDepartmentName(@RequestParam("departmentName") String departmentName)throws ParseException{
return departmentService.getDepartmentNumberByDepartmentName(departmentName);
}
}
员工管理控制层:
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private IEmployeeService employeeService;
@Autowired
private EmployeeServiceImpl employeeServiceImpl;
@PostMapping("/login")
public ModelAndView login(Employee employee, HttpServletRequest request){
Result result = employeeService.login(employee);
if (result.getCode()==0){
return new ModelAndView("redirect:/page/index");
}
return employeeService.updateEmployeeByNumber(employee);
}
@PostMapping("/uploadMyImage")
@ResponseBody
public Result upLoadMyImage(){
return employeeService.upLoadMyImage();
}
@GetMapping("/clearLogin")
@ResponseBody
public Result clearLogin(){
return employeeServiceImpl.clearLogin();
}
@PostMapping("/modifyPwd")
@ResponseBody
public Result modifyPwd(@RequestParam("oldPwd") String oldPwd,@RequestParam("newPwd") String newPwd){
return employeeService.modifyPwd(oldPwd,newPwd);
}
@GetMapping("/loginYesOrNo")
@ResponseBody
public Result loginYesOrNo(){
employeeServiceImpl.getEmployeeLoginInfo();
return new Result(0,"已登录",null);
}
@GetMapping("/getEmployeeByEmployeeNumber")
@ResponseBody
public Result loginYesOrNo(){
employeeServiceImpl.getEmployeeLoginInfo();
return new Result(0,"已登录",null);
}
@GetMapping("/getEmployeeByEmployeeNumber")
@ResponseBody
public Result getEmployeeByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber)throws ParseException {
Employee employee = new Employee();
employee.setEmployeeNumber(employeeNumber);
return employeeService.getEmployeeByEmployeeNumber(employee);
}
@PostMapping("/getEmployeeByName")
@ResponseBody
public Result getEmployeeByName(Employee employee)throws ParseException{
return employeeService.getEmployeeByName(employee.getEmployeeName());
}
@GetMapping("/getPersonByEmployeeNumber")
@ResponseBody
public ModelAndView getPersonByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber){
return departmentService.deleteDepartment(ids);
}
@PostMapping("/modifyDepartment")
public Result modifyDepartment(@RequestParam("departmentNumber") String departmentNumber, @RequestParam("departmentName") String departmentName,
@RequestParam("departmentHead") String departmentHead, @RequestParam("departmentAddress") String departmentAddress,
@RequestParam("departmentTel") String departmentTel, @RequestParam("departmentFax") String departmentFax,
@RequestParam("id") long id)throws ParseException{
Department department = new Department();
department.setDepartmentName(departmentName);
department.setDepartmentNumber(departmentNumber);
department.setDepartmentAddress(departmentAddress);
department.setDepartmentHead(departmentHead);
department.setDepartmentTel(departmentTel);
department.setDepartmentFax(departmentFax);
department.setId(id);
@ResponseBody
public ModelAndView getPersonByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber){
Employee employee = new Employee();
employee.setEmployeeNumber(employeeNumber);
employeeServiceImpl.getPersonByEmployeeNumber(employee);
return new ModelAndView("employeeInfo");
}
}
部门管理控制层:
@RequestMapping("/Department")
@RestController
public class DepartmentController {
@Autowired
IDepartmentService departmentService;
@Autowired
private HttpServletRequest request;
@PostMapping("/addDepartment")
public Result addDepartment(@RequestParam("departmentNumber") String departmentNumber, @RequestParam("departmentName") String departmentName,
@RequestParam("departmentHead") String departmentHead, @RequestParam("departmentAddress") String departmentAddress,
@RequestParam("departmentTel") String departmentTel, @RequestParam("departmentFax") String departmentFax)throws ParseException {
SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
@GetMapping("/getDepartmentByDepartmentNumber")
public ModelAndView getDepartmentByDepartmentNumber(@RequestParam("departmentNumber") String departmentNumber)throws ParseException{
departmentService.getDepartmentByDepartmentNumber(departmentNumber);
return new ModelAndView("department");
}
@PostMapping("/getDepartmentNumberByDepartmentName")
public Result getDepartmentNumberByDepartmentName(@RequestParam("departmentName") String departmentName)throws ParseException{
return departmentService.getDepartmentNumberByDepartmentName(departmentName);
}
}
员工管理控制层:
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private IEmployeeService employeeService;
@Autowired
private EmployeeServiceImpl employeeServiceImpl;
return departmentService.getDepartmentById(id);
}
@GetMapping("/getDepartmentByDepartmentNumber")
public ModelAndView getDepartmentByDepartmentNumber(@RequestParam("departmentNumber") String departmentNumber)throws ParseException{
departmentService.getDepartmentByDepartmentNumber(departmentNumber);
return new ModelAndView("department");
}
@PostMapping("/getDepartmentNumberByDepartmentName")
public Result getDepartmentNumberByDepartmentName(@RequestParam("departmentName") String departmentName)throws ParseException{
return departmentService.getDepartmentNumberByDepartmentName(departmentName);
}
}
员工管理控制层:
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private IEmployeeService employeeService;
@Autowired
private EmployeeServiceImpl employeeServiceImpl;
@PostMapping("/login")
public ModelAndView login(Employee employee, HttpServletRequest request){
Result result = employeeService.login(employee);
@Autowired
private IEmployeeService employeeService;
@Autowired
private EmployeeServiceImpl employeeServiceImpl;
@PostMapping("/login")
public ModelAndView login(Employee employee, HttpServletRequest request){
Result result = employeeService.login(employee);
if (result.getCode()==0){
return new ModelAndView("redirect:/page/index");
}
request.setAttribute("pageMsg",result.getMsg());
return new ModelAndView("forward:/page/login");
}
@PostMapping("/del_employees")
@ResponseBody
public ModelAndView deleteEmployees(@RequestParam("ids") String ids){
employeeService.deleteEmployees(ids);
return new ModelAndView("employeeInfo");
}
@GetMapping("/getPage")