——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明




基于javaweb的SpringBoot人事管理系统(java+springboot+mysql+thymeleaf+html+mysql+maven)
登录:
admin 123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| public class EmpController { @Autowired IEmpService empService;
@Autowired IDeptService deptService;
@Autowired INationService nationService;
@Autowired IPositionService positionService;
@GetMapping("/emps") public String list(Model model,@RequestParam(value="pageNum",defaultValue="1") Integer pageNum) {
if(ObjectUtils.isEmpty(pageNum)){ pageNum= PaginationConstant.CURRENT_NUM; } PageHelper.startPage(pageNum, PaginationConstant.PAGE_SIZE);
List<Emp> emps = empService.getEmpAndDept(); PageInfo<Emp> pageInfo=new PageInfo<>(emps); model.addAttribute("pageInfo",pageInfo); return "emp/list"; }
@GetMapping("/emp") public String toAddPage(Model model) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
@PostMapping("/contract") public String addContract(Contract contract) { contractService.addContract(contract); return "redirect:/contracts"; }
@GetMapping("/contract/{id}") public String toUpdatePage(@PathVariable("id") Integer id,Model model) { Contract contract = contractService.getContractById(id); model.addAttribute("contract",contract);
List<Emp> emps = empService.getAllEmps(); model.addAttribute("emps",emps); return "contract/add"; }
@PutMapping("/contract") public String updateContract(Contract contract) { contractService.updateContract(contract); return "redirect:/contracts"; }
@DeleteMapping("/contract/{id}") public String deleteContractById(@PathVariable("id") Integer id){ contractService.deleteContractById(id); return "redirect:/contracts"; }
@PostMapping("/consearch") public String queryContract(@RequestParam String name, Model model,@RequestParam(value="pageNum",defaultValue="1")Integer pageNum){ PageHelper.startPage(pageNum, PaginationConstant.PAGE_SIZE); List<Contract> contracts = contractService.query(name);
PageInfo<Contract> pageInfo=new PageInfo<>(contracts);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| @GetMapping("/train/{id}") public String toUpdatePage(@PathVariable("id") Integer id, Model model) { Emptrain emptrain = emptrainService.getEmptrainById(id); model.addAttribute("train",emptrain);
List<Emp> emps = empService.getAllEmps(); model.addAttribute("emps",emps);
return "train/add"; }
@PutMapping("/train") public String updateEmptrain(Emptrain emptrain) { emptrainService.updateEmptrain(emptrain); return "redirect:/trains"; }
@DeleteMapping("/train/{id}") public String deleteEmptrainById(@PathVariable("id") Integer id){ emptrainService.deleteEmptrainById(id); return "redirect:/trains"; }
@PostMapping("/trasearch") public String queryEmptrain(@RequestParam String name, Model model,@RequestParam(value="pageNum",defaultValue="1")Integer pageNum){ PageHelper.startPage(pageNum, PaginationConstant.PAGE_SIZE); List<Emptrain> emptrains = emptrainService.query(name);
PageInfo<Emptrain> pageInfo=new PageInfo<>(emptrains);
model.addAttribute("pageInfo",pageInfo); return "train/train"; } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
@Controller public class EmptrainController { @Autowired IEmptrainService emptrainService;
@Autowired IEmpService empService; @GetMapping("/trains") public String list(Model model,@RequestParam(value="pageNum",defaultValue="1")Integer pageNum) {
if(ObjectUtils.isEmpty(pageNum)){ pageNum= PaginationConstant.CURRENT_NUM; } PageHelper.startPage(pageNum, PaginationConstant.PAGE_SIZE);
List<Emptrain> emptrains = emptrainService.getEmptrainAndEmp();
PageInfo<Emptrain> pageInfo=new PageInfo<>(emptrains);
model.addAttribute("pageInfo",pageInfo); return "train/train"; }
@GetMapping("/train") public String toAddPage(Model model) { List<Emp> emps = empService.getAllEmps();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| PageInfo<Emp> pageInfo=new PageInfo<>(emps); model.addAttribute("pageInfo",pageInfo); return "emp/list"; }
@GetMapping("/emp") public String toAddPage(Model model) { List<Dept> depts = deptService.getAllDepts(); model.addAttribute("depts",depts); List<Nation> nations = nationService.getAllNations(); model.addAttribute("nations",nations); List<Position> positions = positionService.getAllPositions(); model.addAttribute("positions",positions); return "emp/add"; }
@PostMapping("/emp") public String addEmp(Emp emp) {
empService.addEmp(emp); return "redirect:/emps"; }
@GetMapping("/emp/{id}") public String toUpdatePage(@PathVariable("id") Integer id,Model model) { Emp emp = empService.getEmpById(id); model.addAttribute("emp",emp);
List<Dept> depts = deptService.getAllDepts(); model.addAttribute("depts",depts);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
@Controller public class EmprpController { @Autowired IEmprpService emprpService;
@Autowired IEmpService empService; @GetMapping("/emprps") public String list(Model model,@RequestParam(value="pageNum",defaultValue="1")Integer pageNum) {
if(ObjectUtils.isEmpty(pageNum)){ pageNum= PaginationConstant.CURRENT_NUM; } PageHelper.startPage(pageNum, PaginationConstant.PAGE_SIZE);
List<Emprp> emprps = emprpService.getEmprpAndEmp();
PageInfo<Emprp> pageInfo=new PageInfo<>(emprps);
model.addAttribute("pageInfo",pageInfo); return "emprp/emprp"; }
@GetMapping("/emprp")
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=072123250309201dx
https://javayms.pages.dev?id=072123250309201dx