12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package com.sw.patroleditor.controller;
- import com.sw.patroleditor.common.ResultData;
- import com.sw.patroleditor.domain.vo.PointVO;
- import com.sw.patroleditor.domain.vo.TargetVO;
- import com.sw.patroleditor.exception.ErrorCode;
- import com.sw.patroleditor.service.LocationService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- /**
- * Created by shiwn on 2024/7/26 15:07
- */
- @Api(tags = {"标点接口"})
- @RestController
- @RequestMapping("location")
- public class LocationController {
- @Resource
- private LocationService locationService;
- @ApiOperation(value = "保存停靠点")
- @PostMapping("/savePoint")
- public ResultData savePoint(@RequestBody PointVO vo) {
- int flag = locationService.savePoint(vo);
- if (flag > 0) {
- return ResultData.success();
- } else {
- return ResultData.fail(ErrorCode.FAIL);
- }
- }
- @ApiOperation(value = "保存巡检点")
- @PostMapping("/saveTarget")
- public ResultData saveTarget(@RequestBody TargetVO vo) {
- int flag = locationService.saveTarget(vo);
- if (flag > 0) {
- return ResultData.success();
- } else {
- return ResultData.fail(ErrorCode.FAIL);
- }
- }
- @ApiOperation(value = "删除停靠点")
- @PostMapping("/deletePoint")
- public ResultData deletePoint(@RequestBody Integer pointId) {
- int flag = locationService.deletePoint(pointId);
- if (flag > 0) {
- return ResultData.success();
- } else {
- return ResultData.fail(ErrorCode.FAIL);
- }
- }
- @ApiOperation(value = "删除巡检点")
- @PostMapping("/deleteTarget")
- public ResultData deleteTarget(@RequestBody Long targetId) {
- int flag = locationService.deleteTarget(targetId);
- if (flag > 0) {
- return ResultData.success();
- } else {
- return ResultData.fail(ErrorCode.FAIL);
- }
- }
- }
|