OverHaulOlanController.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package com.jiayue.ipfcst.console.controller;
  2. import com.jiayue.ipfcst.common.core.exception.BusinessException;
  3. import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
  4. import com.jiayue.ipfcst.common.data.entity.OverhaulPlan;
  5. import com.jiayue.ipfcst.console.service.OverHaulPlanService;
  6. import lombok.SneakyThrows;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.data.domain.Page;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.List;
  11. /**
  12. * 检修计划信息restful接口
  13. *
  14. * @author tl
  15. * @version 3.0
  16. * @since 2020/03/27 10:12
  17. */
  18. @RestController
  19. @RequestMapping("overHaulPlan")
  20. public class OverHaulOlanController {
  21. final private OverHaulPlanService overHaulPlanService;
  22. @Autowired
  23. public OverHaulOlanController(OverHaulPlanService overHaulPlanService) {
  24. this.overHaulPlanService = overHaulPlanService;
  25. }
  26. /**
  27. * 新增 检修计划接口
  28. *
  29. * @param overhaulPlan
  30. * @return 操作结果
  31. */
  32. @PostMapping
  33. public ResponseVO insert(@RequestBody OverhaulPlan overhaulPlan) {
  34. this.overHaulPlanService.add(overhaulPlan);
  35. return ResponseVO.success(1);
  36. }
  37. /**
  38. * 修改 检修计划接口
  39. */
  40. @PutMapping
  41. public ResponseVO update(@RequestBody OverhaulPlan overhaulPlan) throws BusinessException {
  42. this.overHaulPlanService.save(overhaulPlan);
  43. return ResponseVO.success(1);
  44. }
  45. /**
  46. * 删除 检修计划接口
  47. *
  48. * @param overhaulPlan
  49. * @return 操作结果
  50. */
  51. @DeleteMapping
  52. public ResponseVO delete(@RequestBody OverhaulPlan overhaulPlan) {
  53. this.overHaulPlanService.delete(overhaulPlan.getId());
  54. return ResponseVO.success(1);
  55. }
  56. /**
  57. * 获取 检修计划接口
  58. *
  59. * @param page 页码
  60. * @param size 条数
  61. * @return 操作结果
  62. */
  63. @SneakyThrows
  64. @GetMapping(value = "/{page}/{size}")
  65. public ResponseVO get(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
  66. OverhaulPlan overhaulPlan = new OverhaulPlan();
  67. Page<OverhaulPlan> overhaulPlanCalendarPage = this.overHaulPlanService.get(overhaulPlan, page, size);
  68. return ResponseVO.success(overhaulPlanCalendarPage);
  69. }
  70. /**
  71. * 获取 检修计划接口
  72. *
  73. * @param page 页码
  74. * @param size 条数
  75. * @return 操作结果
  76. */
  77. @SneakyThrows
  78. @GetMapping(value = "/{page}/{size}/{stationCode}")
  79. public ResponseVO getByStationCode(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
  80. OverhaulPlan overhaulPlan = new OverhaulPlan();
  81. Page<OverhaulPlan> overhaulPlanCalendarPage = this.overHaulPlanService.getByStationCode(overhaulPlan, page, size, stationCode);
  82. return ResponseVO.success(overhaulPlanCalendarPage);
  83. }
  84. /**
  85. * 获取全部 检修计划接口
  86. *
  87. * @return 操作结果
  88. */
  89. @SneakyThrows
  90. @GetMapping()
  91. public ResponseVO getAll() {
  92. List<OverhaulPlan> list = this.overHaulPlanService.getAll();
  93. return ResponseVO.success(list);
  94. }
  95. }