|
|
@@ -1,42 +1,65 @@
|
|
|
package com.its.op.dao.repository.bis;
|
|
|
|
|
|
+import com.its.op.dto.bis.BitStatusHistoryInf;
|
|
|
+import com.its.op.dto.its.common.SttsHsErrCntInf;
|
|
|
import com.its.op.entity.bis.BitStatusHistory;
|
|
|
import com.its.op.entity.bis.BitStatusHistoryKey;
|
|
|
-import com.its.op.dto.its.common.SttsHsErrCntInf;
|
|
|
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.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Repository
|
|
|
public interface BitStatusHistoryRepository extends JpaRepository<BitStatusHistory, BitStatusHistoryKey>, JpaSpecificationExecutor<BitStatusHistory> {
|
|
|
|
|
|
- @Query("select p from BitStatusHistory p " +
|
|
|
- " where (p.bitid, p.recorddate, p.recordtimestamp) " +
|
|
|
- " in (select h.bitid, max(h.recorddate), max(h.recordtimestamp) " +
|
|
|
- " from BitStatusHistory h " +
|
|
|
- " where h.recorddate >= :fromDt " +
|
|
|
- " group by h.bitid) ")
|
|
|
- List<BitStatusHistory> findAllStts(@Param("fromDt") LocalDateTime fromDt);
|
|
|
+// @Query("select p from BitStatusHistory p " +
|
|
|
+// " where (p.bitid, p.recorddate, p.recordtimestamp) " +
|
|
|
+// " in (select h.bitid, max(h.recorddate), max(h.recordtimestamp) " +
|
|
|
+// " from BitStatusHistory h " +
|
|
|
+// " where h.recorddate >= :fromDt " +
|
|
|
+// " group by h.bitid) " +
|
|
|
+// " and p.recorddate >= :fromDt" )
|
|
|
+// List<BitStatusHistory> findAllStts(@Param("fromDt") LocalDateTime fromDt);
|
|
|
|
|
|
- @Query("select p from BitStatusHistory p " +
|
|
|
+ @Query(value =
|
|
|
+ "select to_char(p.recorddate, 'YYYYMMDDHH24MISS') as recorddate, p.bitid, p.temperature, "+
|
|
|
+ " p.wcommstatus, p.doorstatus, p.fanstatus, p.heateropstatus, p.monitorstatus " +
|
|
|
+ " from BITSTATUS_HISTORY p " +
|
|
|
" where (p.bitid, p.recorddate, p.recordtimestamp) " +
|
|
|
" in (select h.bitid, max(h.recorddate), max(h.recordtimestamp) " +
|
|
|
- " from BitStatusHistory h " +
|
|
|
- " where h.recorddate >= :fromDt " +
|
|
|
+ " from BITSTATUS_HISTORY h " +
|
|
|
+ " where h.recorddate >= trunc(sysdate) " +
|
|
|
" group by h.bitid) " +
|
|
|
- " and p.wcommstatus <> '1'")
|
|
|
- List<BitStatusHistory> findAllCommError(@Param("fromDt") LocalDateTime fromDt);
|
|
|
+ " and p.recorddate >= trunc(sysdate)",
|
|
|
+ nativeQuery = true)
|
|
|
+ List<BitStatusHistoryInf> findAllSttsNative();
|
|
|
+
|
|
|
+// @Query("select p from BitStatusHistory p " +
|
|
|
+// " where (p.bitid, p.recorddate, p.recordtimestamp) " +
|
|
|
+// " in (select h.bitid, max(h.recorddate), max(h.recordtimestamp) " +
|
|
|
+// " from BitStatusHistory h " +
|
|
|
+// " where h.recorddate >= :fromDt " +
|
|
|
+// " group by h.bitid) " +
|
|
|
+// " and p.recorddate >= :fromDt " +
|
|
|
+// " and p.wcommstatus <> '1'")
|
|
|
+// List<BitStatusHistory> findAllCommError(@Param("fromDt") LocalDateTime fromDt);
|
|
|
+
|
|
|
+// @Query("select p.bitid as nmbr, count(p.bitid) as errCnt " +
|
|
|
+// " from BitStatusHistory p " +
|
|
|
+// " where p.recorddate >= :fromDt " +
|
|
|
+// " and p.wcommstatus <> '1' " +
|
|
|
+// " group by p.bitid")
|
|
|
+// List<SttsHsErrCntInf> findAllCommErrorCount(@Param("fromDt") LocalDateTime fromDt);
|
|
|
|
|
|
- @Query("select p.bitid as nmbr, count(p.bitid) as errCnt " +
|
|
|
- " from BitStatusHistory p " +
|
|
|
- " where p.recorddate >= :fromDt " +
|
|
|
+ @Query(value =
|
|
|
+ "select p.bitid as nmbr, count(p.bitid) as errCnt " +
|
|
|
+ " from BITSTATUS_HISTORY p " +
|
|
|
+ " where p.recorddate >= trunc(sysdate) " +
|
|
|
" and p.wcommstatus <> '1' " +
|
|
|
- " group by p.bitid")
|
|
|
- List<SttsHsErrCntInf> findAllCommErrorCount(@Param("fromDt") LocalDateTime fromDt);
|
|
|
+ " group by p.bitid",
|
|
|
+ nativeQuery = true)
|
|
|
+ List<SttsHsErrCntInf> findAllCommErrorCountNative();
|
|
|
|
|
|
}
|