| | |
| | | package com.moral.api.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import javafx.scene.input.Mnemonic; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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 java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.moral.api.entity.ManageCoordinate; |
| | | import com.moral.api.mapper.ManageCoordinateMapper; |
| | | import com.moral.api.service.ManageCoordinateService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | private ManageCoordinateMapper manageCoordinateMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加路段信息 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @PostMapping("interCruiserRoad") |
| | | public ResultMessage interCruiserRoad(@RequestBody Map<String,Object> params){ |
| | | public ResultMessage interCruiserRoad(@RequestBody Map<String, Object> params) { |
| | | if (!params.containsKey("startPoint") || !params.containsKey("mac")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | Integer integer = manageCoordinateService.interCoordinate(params); |
| | | if (integer==null){ |
| | | if (integer == null) { |
| | | return ResultMessage.ok("路段已存在"); |
| | | } |
| | | return ResultMessage.ok(); |
| | |
| | | |
| | | /** |
| | | * 修改路段信息 |
| | | * |
| | | * @param manageCoordinate |
| | | * @return |
| | | */ |
| | | @PostMapping("updateCruiserRoad") |
| | | public ResultMessage updateCruiserRoad(@RequestBody ManageCoordinate manageCoordinate){ |
| | | if (ObjectUtils.isEmpty(manageCoordinate)){ |
| | | public ResultMessage updateCruiserRoad(@RequestBody ManageCoordinate manageCoordinate) { |
| | | if (ObjectUtils.isEmpty(manageCoordinate)) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | manageCoordinateService.updateCoordinate(manageCoordinate); |
| | |
| | | |
| | | /** |
| | | * 删除路段信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("deleteCruiserRoad") |
| | | public ResultMessage deleteCruiser(Integer id){ |
| | | if (id==null){ |
| | | public ResultMessage deleteCruiser(Integer id) { |
| | | if (id == null) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("selectCruiserRoad") |
| | | public ResultMessage selectCruiser(String name,String mac){ |
| | | List<ManageCoordinate> manageCoordinates = manageCoordinateService.selectCoordinate(name,mac); |
| | | public ResultMessage selectCruiser(String name, String mac) { |
| | | List<ManageCoordinate> manageCoordinates = manageCoordinateService.selectCoordinate(name, mac); |
| | | return ResultMessage.ok(manageCoordinates); |
| | | } |
| | | } |