|
|
@@ -1,35 +1,86 @@
|
|
|
package com.its.op.controller.database;
|
|
|
|
|
|
-import com.its.op.controller.AbstractDatabaseController;
|
|
|
-import com.its.op.service.database.impl.TbRoadServiceImpl;
|
|
|
-import com.its.op.model.vo.database.TbRoadVo;
|
|
|
+import com.its.op.model.dto.RoadDto;
|
|
|
+import com.its.op.model.dto.RoadIfscRltnDto;
|
|
|
+import com.its.op.model.entity.Road;
|
|
|
+import com.its.op.model.entity.RoadIfscRltn;
|
|
|
+import com.its.op.service.database.TbRoadService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
@RestController
|
|
|
-@RequestMapping("/api/database//tb-road")
|
|
|
+@RequestMapping("/api/database/tb-road")
|
|
|
@Api(tags = "09.기초데이터관리-04.도로", description="도로")
|
|
|
-public class TbRoadController extends AbstractDatabaseController<TbRoadVo> {
|
|
|
+public class TbRoadController {
|
|
|
|
|
|
- private final TbRoadServiceImpl service;
|
|
|
+ private final TbRoadService service;
|
|
|
|
|
|
- public TbRoadController(TbRoadServiceImpl service) {
|
|
|
- super(service);
|
|
|
- this.service = service;
|
|
|
+ @ApiOperation(value = "전체조회(TB_IFSC)", response = RoadDto.RoadInfo.class)
|
|
|
+ @GetMapping(value = "", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<RoadDto.RoadInfo>> findAll() {
|
|
|
+ List<Road> data = this.service.findAll();
|
|
|
+ List<RoadDto.RoadInfo> result = new ArrayList<>();
|
|
|
+ for (Road obj: data) {
|
|
|
+ result.add(new RoadDto.RoadInfo(obj));
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "이름변경(TB_ROAD)", response = TbRoadVo.class)
|
|
|
- @PutMapping(value = "/name/", produces = {"application/json; charset=utf8"})
|
|
|
- public int updateNameById(@RequestBody TbRoadVo obj, HttpServletRequest request) {
|
|
|
- return this.service.updateNameById(obj);
|
|
|
+ @ApiOperation(value = "서비스링크개별조회(TB_IFSC)", response = RoadDto.RoadInfo.class)
|
|
|
+ @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<RoadDto.RoadInfo> findById(@PathVariable final Long id) {
|
|
|
+ Road obj = this.service.findById(id);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(new RoadDto.RoadInfo(obj), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "구간명변경(TB_IFSC)", response = RoadDto.RoadInfo.class)
|
|
|
+ @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<RoadDto.RoadInfo> updateNameById(@PathVariable final Long id, @RequestBody final RoadDto.RoadNameUpdateReq req) {
|
|
|
+ Road obj = this.service.updateNameById(id, req);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(new RoadDto.RoadInfo(obj), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "도로구간개별구성정보조회(TB_ROAD_IFSC_RLTN)", response = RoadIfscRltnDto.RoadIfscRltnUpdateReq.class)
|
|
|
+ @GetMapping(value = "/road-rltn/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<RoadIfscRltnDto.RoadIfscRltnInfo>> findLinkRltnById(@PathVariable final Long id) {
|
|
|
+ List<RoadIfscRltn> objs = this.service.findLinkRltnById(id);
|
|
|
+ if (objs != null) {
|
|
|
+ List<RoadIfscRltnDto.RoadIfscRltnInfo> result = new ArrayList<>();
|
|
|
+ for (RoadIfscRltn obj : objs) {
|
|
|
+ result.add(new RoadIfscRltnDto.RoadIfscRltnInfo(obj));
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "도로구간개별구성정보변경/생성(TB_ROAD_IFSC_RLTN)", response = RoadDto.RoadInfo.class)
|
|
|
+ @PutMapping(value = "/road-rltn/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<RoadIfscRltnDto.RoadIfscRltnUpdateReq>> updateNameById(
|
|
|
+ @PathVariable final Long id,
|
|
|
+ @RequestBody final List<RoadIfscRltnDto.RoadIfscRltnUpdateReq> req) {
|
|
|
+ List<RoadIfscRltnDto.RoadIfscRltnUpdateReq> obj = this.service.updateLinkRltn(id, req);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(obj, HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
}
|
|
|
|
|
|
}
|