123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- package com.jiayue.ipfcst.console.controller;
- import com.jiayue.ipfcst.common.core.exception.BusinessException;
- import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
- import com.jiayue.ipfcst.common.data.entity.OverhaulPlan;
- import com.jiayue.ipfcst.console.service.OverHaulPlanService;
- import lombok.SneakyThrows;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.domain.Page;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * 检修计划信息restful接口
- *
- * @author tl
- * @version 3.0
- * @since 2020/03/27 10:12
- */
- @RestController
- @RequestMapping("overHaulPlan")
- public class OverHaulOlanController {
- final private OverHaulPlanService overHaulPlanService;
- @Autowired
- public OverHaulOlanController(OverHaulPlanService overHaulPlanService) {
- this.overHaulPlanService = overHaulPlanService;
- }
- /**
- * 新增 检修计划接口
- *
- * @param overhaulPlan
- * @return 操作结果
- */
- @PostMapping
- public ResponseVO insert(@RequestBody OverhaulPlan overhaulPlan) {
- this.overHaulPlanService.add(overhaulPlan);
- return ResponseVO.success(1);
- }
- /**
- * 修改 检修计划接口
- */
- @PutMapping
- public ResponseVO update(@RequestBody OverhaulPlan overhaulPlan) throws BusinessException {
- this.overHaulPlanService.save(overhaulPlan);
- return ResponseVO.success(1);
- }
- /**
- * 删除 检修计划接口
- *
- * @param overhaulPlan
- * @return 操作结果
- */
- @DeleteMapping
- public ResponseVO delete(@RequestBody OverhaulPlan overhaulPlan) {
- this.overHaulPlanService.delete(overhaulPlan.getId());
- return ResponseVO.success(1);
- }
- /**
- * 获取 检修计划接口
- *
- * @param page 页码
- * @param size 条数
- * @return 操作结果
- */
- @SneakyThrows
- @GetMapping(value = "/{page}/{size}")
- public ResponseVO get(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
- OverhaulPlan overhaulPlan = new OverhaulPlan();
- Page<OverhaulPlan> overhaulPlanCalendarPage = this.overHaulPlanService.get(overhaulPlan, page, size);
- return ResponseVO.success(overhaulPlanCalendarPage);
- }
- /**
- * 获取 检修计划接口
- *
- * @param page 页码
- * @param size 条数
- * @return 操作结果
- */
- @SneakyThrows
- @GetMapping(value = "/{page}/{size}/{stationCode}")
- public ResponseVO getByStationCode(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
- OverhaulPlan overhaulPlan = new OverhaulPlan();
- Page<OverhaulPlan> overhaulPlanCalendarPage = this.overHaulPlanService.getByStationCode(overhaulPlan, page, size, stationCode);
- return ResponseVO.success(overhaulPlanCalendarPage);
- }
- /**
- * 获取全部 检修计划接口
- *
- * @return 操作结果
- */
- @SneakyThrows
- @GetMapping()
- public ResponseVO getAll() {
- List<OverhaulPlan> list = this.overHaulPlanService.getAll();
- return ResponseVO.success(list);
- }
- }
|