|
|
@@ -1,51 +1,86 @@
|
|
|
package com.its.op.controller.database;
|
|
|
|
|
|
-import com.its.op.controller.AbstractDatabaseController;
|
|
|
-import com.its.op.service.database.impl.TbAtrdServiceImpl;
|
|
|
-import com.its.op.model.vo.database.TbAtrdRoadRltnVo;
|
|
|
-import com.its.op.model.vo.database.TbIfscVo;
|
|
|
+import com.its.op.model.dto.AtrdDto;
|
|
|
+import com.its.op.model.dto.AtrdRoadRltnDto;
|
|
|
+import com.its.op.model.dto.RoadIfscRltnDto;
|
|
|
+import com.its.op.model.entity.Atrd;
|
|
|
+import com.its.op.model.entity.AtrdRoadRltn;
|
|
|
+import com.its.op.service.database.TbAtrdService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
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-atrd")
|
|
|
@Api(tags = "09.기초데이터관리-05.간선도로관리", description="간선도로관리")
|
|
|
-public class TbAtrdController extends AbstractDatabaseController<TbIfscVo> {
|
|
|
+public class TbAtrdController {
|
|
|
|
|
|
- private final TbAtrdServiceImpl service;
|
|
|
+ private final TbAtrdService service;
|
|
|
|
|
|
- public TbAtrdController(TbAtrdServiceImpl service) {
|
|
|
- super(service);
|
|
|
- this.service = service;
|
|
|
+ @ApiOperation(value = "전체조회(TB_ATRD)", response = AtrdDto.AtrdInfo.class)
|
|
|
+ @GetMapping(value = "", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<AtrdDto.AtrdInfo>> findAll() {
|
|
|
+ List<Atrd> data = this.service.findAll();
|
|
|
+ List<AtrdDto.AtrdInfo> result = new ArrayList<>();
|
|
|
+ for (Atrd obj: data) {
|
|
|
+ result.add(new AtrdDto.AtrdInfo(obj));
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "도로구성정보전체조회(TB_ATRD, TB_ATRD_ROAD_RLTN, TB_ROAD)", response = TbAtrdRoadRltnVo.class, responseContainer = "ArrayList")
|
|
|
- @GetMapping(value = "/road/", produces = {"application/json; charset=utf8"})
|
|
|
- public ResponseEntity<List<TbAtrdRoadRltnVo>> findAllRoadRltn(HttpServletRequest request) {
|
|
|
- List<TbAtrdRoadRltnVo> result = this.service.findAllRoadRltn();
|
|
|
- return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ @ApiOperation(value = "서비스링크개별조회(TB_ATRD)", response = AtrdDto.AtrdInfo.class)
|
|
|
+ @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<AtrdDto.AtrdInfo> findById(@PathVariable final String id) {
|
|
|
+ Atrd obj = this.service.findById(id);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(new AtrdDto.AtrdInfo(obj), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "도로구성정보전체조회(TB_ATRD, TB_ATRD_ROAD_RLTN, TB_ROAD)", response = TbAtrdRoadRltnVo.class, responseContainer = "ArrayList")
|
|
|
- @GetMapping(value = "/road/{id}", produces = {"application/json; charset=utf8"})
|
|
|
- public ResponseEntity<TbAtrdRoadRltnVo> findByIdRoadRltn(@PathVariable("id") String id, HttpServletRequest request) {
|
|
|
- TbAtrdRoadRltnVo result = this.service.findByIdRoadRltn(id);
|
|
|
- return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ @ApiOperation(value = "구간명변경(TB_ATRD)", response = AtrdDto.AtrdInfo.class)
|
|
|
+ @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<AtrdDto.AtrdInfo> updateNameById(@PathVariable final String id, @RequestBody final AtrdDto.AtrdNameUpdateReq req) {
|
|
|
+ Atrd obj = this.service.updateNameById(id, req);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(new AtrdDto.AtrdInfo(obj), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "간선도로구간개별구성정보조회(TB_ATRD_ROAD_RLTN)", response = RoadIfscRltnDto.RoadIfscRltnUpdateReq.class)
|
|
|
+ @GetMapping(value = "/atrd-rltn/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<AtrdRoadRltnDto.AtrdRoadRltnInfo>> findLinkRltnById(@PathVariable final String id) {
|
|
|
+ List<AtrdRoadRltn> objs = this.service.findLinkRltnById(id);
|
|
|
+ if (objs != null) {
|
|
|
+ List<AtrdRoadRltnDto.AtrdRoadRltnInfo> result = new ArrayList<>();
|
|
|
+ for (AtrdRoadRltn obj : objs) {
|
|
|
+ result.add(new AtrdRoadRltnDto.AtrdRoadRltnInfo(obj));
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "도로구성정보업데이트(TB_ATRD, TB_ATRD_ROAD_RLTN, TB_ROAD)", response = TbAtrdRoadRltnVo.class, responseContainer = "ArrayList")
|
|
|
- @PutMapping(value = "/road/", produces = {"application/json; charset=utf8"})
|
|
|
- public int updateByIdRoadRltn(@RequestBody TbAtrdRoadRltnVo obj, HttpServletRequest request) {
|
|
|
- log.error("{}", obj);
|
|
|
- return this.service.updateByIdRoadRltn(obj);
|
|
|
+ @ApiOperation(value = "간선도로구간개별구성정보변경/생성(TB_ATRD_ROAD_RLTN)", response = AtrdDto.AtrdInfo.class)
|
|
|
+ @PutMapping(value = "/atrd-rltn/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<AtrdRoadRltnDto.AtrdRoadRltnUpdateReq>> updateNameById(
|
|
|
+ @PathVariable final String id,
|
|
|
+ @RequestBody final List<AtrdRoadRltnDto.AtrdRoadRltnUpdateReq> req) {
|
|
|
+ List<AtrdRoadRltnDto.AtrdRoadRltnUpdateReq> obj = this.service.updateLinkRltn(id, req);
|
|
|
+ if (obj != null) {
|
|
|
+ return new ResponseEntity<>(obj, HttpStatus.OK);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
}
|
|
|
|
|
|
}
|