|
|
@@ -1,9 +1,13 @@
|
|
|
package com.its.op.controller.common;
|
|
|
|
|
|
import com.its.op.model.dto.UnitSystSttsDto;
|
|
|
-import com.its.op.model.entity.VwUnitSystStts;
|
|
|
-import com.its.op.model.mapper.VwUnitSystSttsMapper;
|
|
|
+import com.its.op.model.entity.*;
|
|
|
+import com.its.op.model.mapper.CommonEntityMapper;
|
|
|
import com.its.op.model.vo.common.*;
|
|
|
+import com.its.op.repository.IfscRepository;
|
|
|
+import com.its.op.repository.LinkRepository;
|
|
|
+import com.its.op.repository.NodeRepository;
|
|
|
+import com.its.op.repository.RoadRepository;
|
|
|
import com.its.op.service.common.impl.CommonServiceImpl;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -12,11 +16,13 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
@@ -26,6 +32,45 @@ import java.util.List;
|
|
|
public class CommonController {
|
|
|
|
|
|
private final CommonServiceImpl service;
|
|
|
+ private final LinkRepository linkRepo;
|
|
|
+ private final IfscRepository ifscRepo;
|
|
|
+ private final RoadRepository roadRepo;
|
|
|
+ private final NodeRepository nodeRepo;
|
|
|
+
|
|
|
+ @ApiOperation(value = "노드", response = Node.class, responseContainer = "ArrayList")
|
|
|
+ @GetMapping(value = "/nodes", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<Node>> findNodeAll(HttpServletRequest request) {
|
|
|
+ List<Node> result = this.nodeRepo.findAll();
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "링크", response = Link.class, responseContainer = "ArrayList")
|
|
|
+ @GetMapping(value = "/links", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<Link>> findLinkAll(HttpServletRequest request) {
|
|
|
+ List<Link> result = this.linkRepo.findAll();
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "서비스구간", response = Ifsc.class, responseContainer = "ArrayList")
|
|
|
+ @GetMapping(value = "/ifscs", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<Ifsc>> findIfscAll(HttpServletRequest request) {
|
|
|
+ List<Ifsc> result = this.ifscRepo.findAll();
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "서비스구간 ID", response = Ifsc.class, responseContainer = "ArrayList")
|
|
|
+ @GetMapping(value = "/ifscs/{id}", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<Ifsc> findIfscById(@PathVariable("id") Long id) {
|
|
|
+ Optional<Ifsc> obj = this.ifscRepo.findById(id);
|
|
|
+ return new ResponseEntity<>(obj.orElse(null), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "도로", response = Road.class, responseContainer = "ArrayList")
|
|
|
+ @GetMapping(value = "/roads", produces = {"application/json; charset=utf8"})
|
|
|
+ public ResponseEntity<List<Road>> findRoadAll(HttpServletRequest request) {
|
|
|
+ List<Road> result = this.roadRepo.findAll();
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "시설물 유형(TB_CMMN_CD)", response = FcltTypeVo.class, responseContainer = "ArrayList")
|
|
|
@GetMapping(value = "/fclt/type/", produces = {"application/json; charset=utf8"})
|
|
|
@@ -38,7 +83,7 @@ public class CommonController {
|
|
|
@GetMapping(value = "/process/stts/", produces = {"application/json; charset=utf8"})
|
|
|
public ResponseEntity<List<UnitSystSttsDto>> findUnitSystSttsAll(HttpServletRequest request) {
|
|
|
List<VwUnitSystStts> result = this.service.findAllVwUnitSystStts();
|
|
|
- List<UnitSystSttsDto> response = VwUnitSystSttsMapper.INSTANCE.toDtoList(result);
|
|
|
+ List<UnitSystSttsDto> response = CommonEntityMapper.INSTANCE.unitSystSttsToDtoList(result);
|
|
|
return new ResponseEntity<>(response, HttpStatus.OK);
|
|
|
}
|
|
|
|