EmployeeController.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package com.huimv.management.controller;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import java.util.Map;
  5. import io.swagger.annotations.Api;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.PathVariable;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import com.huimv.management.entity.EmployeeEntity;
  13. import com.huimv.management.service.EmployeeService;
  14. import com.huimv.common.utils.PageUtils;
  15. import com.huimv.common.utils.R;
  16. /**
  17. * 养殖员信息表
  18. *
  19. * @author yinhao
  20. * @email yinhao@163.com
  21. * @date 2021-05-07 15:32:42
  22. */
  23. @Api(tags = "养殖员信息表")
  24. @RestController
  25. @RequestMapping("management/employee")
  26. public class EmployeeController {
  27. @Autowired
  28. private EmployeeService employeeService;
  29. /**
  30. * 列表
  31. */
  32. @RequestMapping("/list")
  33. public R list(@RequestParam Map<String, Object> params){
  34. PageUtils page = employeeService.queryPage(params);
  35. return R.ok().put("page", page);
  36. }
  37. /**
  38. * 信息
  39. */
  40. @RequestMapping("/info/{id}")
  41. public R info(@PathVariable("id") Integer id){
  42. EmployeeEntity employee = employeeService.getById(id);
  43. return R.ok().put("employee", employee);
  44. }
  45. /**
  46. * 保存
  47. */
  48. @RequestMapping("/save")
  49. public R save(@RequestBody EmployeeEntity employee){
  50. employeeService.save(employee);
  51. return R.ok();
  52. }
  53. /**
  54. * 修改
  55. */
  56. @RequestMapping("/update")
  57. public R update(@RequestBody EmployeeEntity employee){
  58. employeeService.updateById(employee);
  59. return R.ok();
  60. }
  61. /**
  62. * 删除
  63. */
  64. @RequestMapping("/delete")
  65. public R delete(@RequestBody Integer[] ids){
  66. employeeService.removeByIds(Arrays.asList(ids));
  67. return R.ok();
  68. }
  69. /**
  70. * 查询全部
  71. */
  72. @RequestMapping("/findAll")
  73. public R findAll(Integer formFarmId){
  74. List list = employeeService.findAll(formFarmId);
  75. return R.ok().put("all",list);
  76. }
  77. }