shjung vor 2 Jahren
Ursprung
Commit
a8ec8e503d

+ 18 - 3
src/main/java/com/its/op/controller/its/rse/TbRseSectTrafHsController.java

@@ -4,10 +4,12 @@ import com.its.op.dto.its.rse.TbRseSectTrafHsDto;
 import com.its.op.service.its.rse.TbRseSectTrafHsService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.RequiredArgsConstructor;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -21,10 +23,23 @@ public class TbRseSectTrafHsController {
 
     private final TbRseSectTrafHsService service;
 
-    @ApiOperation(value = "RSE 구간 소통상황 전체조회(TB_RSE_SECT_TRAF_HS)", response = TbRseSectTrafHsDto.class, responseContainer = "ArrayList")
+//    @ApiOperation(value = "RSE 구간 소통상황 전체조회(TB_RSE_SECT_TRAF_HS)", response = TbRseSectTrafHsDto.class, responseContainer = "ArrayList")
+//    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
+//    public List<TbRseSectTrafHsDto> findAll() {
+//        return this.service.findAll();
+//    }
+
+    @ApiOperation(value = "RSE 구간 소통상황 이력조회(TB_RSE_SECT_TRAF_HS)", response = TbRseSectTrafHsDto.class, responseContainer = "ArrayList")
     @GetMapping(value = "", produces = {"application/json; charset=utf8"})
-    public List<TbRseSectTrafHsDto> findAll() {
-        return this.service.findAll();
+    public List<TbRseSectTrafHsDto> findAllByDateRange(
+            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
+            @RequestParam String FROM_DT,
+            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152000", required = true)
+            @RequestParam String TO_DT,
+            @ApiParam(name = "id", value = "RSE 구간 ID 목록", example = "[10011002,10011004]", required = true)
+            @RequestParam List<Long> ids
+    ) {
+        return this.service.findAllByDateRange(FROM_DT, TO_DT, ids);
     }
 
 }

+ 3 - 3
src/main/java/com/its/op/controller/its/scrs/TbScIxrCmraMngmController.java

@@ -33,10 +33,10 @@ public class TbScIxrCmraMngmController {
         return this.service.findAllList();
     }
 
-    @ApiOperation(value = "카메라 관리 개별조회(TB_SC_IXR_CMRA_MNGM)", response = TbScIxrCmraMngmDto.class)
+    @ApiOperation(value = "카메라 관리 개별조회(TB_SC_IXR_CMRA_MNGM)", response = TbScIxrCmraMngmDto.class, responseContainer = "ArrayList")
     @GetMapping(value = "/{ixrId}", produces = {"application/json; charset=utf8"})
-    public TbScIxrCmraMngmDto findById(@PathVariable("ixrId") final TbScIxrCmraMngmKey ixrId) {
-        return this.service.findById(ixrId);
+    public List<TbScIxrCmraMngmDto> findById(@PathVariable("ixrId") final String ixrId) {
+        return this.service.findListById(ixrId);
     }
 
     @ApiOperation(value = "카메라 관리 정보변경(TB_SC_IXR_CMRA_MNGM)", response = TbScIxrCmraMngmDto.class)

+ 3 - 0
src/main/java/com/its/op/dao/repository/its/scrs/TbScIxrCmraMngmRepository.java

@@ -5,6 +5,7 @@ import com.its.op.entity.its.scrs.TbScIxrCmraMngmKey;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -18,4 +19,6 @@ public interface TbScIxrCmraMngmRepository extends JpaRepository<TbScIxrCmraMngm
     @Query("select p from TbScIxrCmraMngm p")
     List<TbScIxrCmraMngm> findAllList();
 
+    @Query("select p from TbScIxrCmraMngm p where p.ixrId = :ixrId")
+    List<TbScIxrCmraMngm> findListById(@Param("ixrId") String ixrId);
 }

+ 10 - 0
src/main/java/com/its/op/service/its/scrs/TbScIxrCmraMngmService.java

@@ -171,4 +171,14 @@ public class TbScIxrCmraMngmService {
 
         return result;
     }
+
+    @Transactional(readOnly = true)
+    public List<TbScIxrCmraMngmDto> findListById(String ixrId) {
+        List<TbScIxrCmraMngmDto> result = new ArrayList<>();
+        List<TbScIxrCmraMngm> data = this.repo.findListById(ixrId);
+        for (TbScIxrCmraMngm entity : data) {
+            result.add(entity.toDto());
+        }
+        return result;
+    }
 }