...
|
...
|
@@ -32,7 +32,7 @@ import java.util.concurrent.CompletableFuture; |
32
|
32
|
public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvCompositeKey> {
|
33
|
33
|
|
34
|
34
|
@Query("SELECT tskv FROM TsKvEntity tskv WHERE tskv.entityId = :entityId " +
|
35
|
|
- "AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
35
|
+ "AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
36
|
36
|
List<TsKvEntity> findAllWithLimit(@Param("entityId") UUID entityId,
|
37
|
37
|
@Param("entityKey") int key,
|
38
|
38
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -42,7 +42,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
42
|
42
|
@Transactional
|
43
|
43
|
@Modifying
|
44
|
44
|
@Query("DELETE FROM TsKvEntity tskv WHERE tskv.entityId = :entityId " +
|
45
|
|
- "AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
45
|
+ "AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
46
|
46
|
void delete(@Param("entityId") UUID entityId,
|
47
|
47
|
@Param("entityKey") int key,
|
48
|
48
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -51,7 +51,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
51
|
51
|
@Async
|
52
|
52
|
@Query("SELECT new TsKvEntity(MAX(tskv.strValue)) FROM TsKvEntity tskv " +
|
53
|
53
|
"WHERE tskv.strValue IS NOT NULL " +
|
54
|
|
- "AND tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
54
|
+ "AND tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
55
|
55
|
CompletableFuture<TsKvEntity> findStringMax(@Param("entityId") UUID entityId,
|
56
|
56
|
@Param("entityKey") int entityKey,
|
57
|
57
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -63,7 +63,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
63
|
63
|
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
64
|
64
|
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
65
|
65
|
"'MAX') FROM TsKvEntity tskv " +
|
66
|
|
- "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
66
|
+ "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
67
|
67
|
CompletableFuture<TsKvEntity> findNumericMax(@Param("entityId") UUID entityId,
|
68
|
68
|
@Param("entityKey") int entityKey,
|
69
|
69
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -73,7 +73,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
73
|
73
|
@Async
|
74
|
74
|
@Query("SELECT new TsKvEntity(MIN(tskv.strValue)) FROM TsKvEntity tskv " +
|
75
|
75
|
"WHERE tskv.strValue IS NOT NULL " +
|
76
|
|
- "AND tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
76
|
+ "AND tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
77
|
77
|
CompletableFuture<TsKvEntity> findStringMin(@Param("entityId") UUID entityId,
|
78
|
78
|
@Param("entityKey") int entityKey,
|
79
|
79
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -85,7 +85,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
85
|
85
|
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
86
|
86
|
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
87
|
87
|
"'MIN') FROM TsKvEntity tskv " +
|
88
|
|
- "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
88
|
+ "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
89
|
89
|
CompletableFuture<TsKvEntity> findNumericMin(
|
90
|
90
|
@Param("entityId") UUID entityId,
|
91
|
91
|
@Param("entityKey") int entityKey,
|
...
|
...
|
@@ -98,7 +98,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
98
|
98
|
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
99
|
99
|
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
100
|
100
|
"SUM(CASE WHEN tskv.jsonValue IS NULL THEN 0 ELSE 1 END)) FROM TsKvEntity tskv " +
|
101
|
|
- "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
101
|
+ "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
102
|
102
|
CompletableFuture<TsKvEntity> findCount(@Param("entityId") UUID entityId,
|
103
|
103
|
@Param("entityKey") int entityKey,
|
104
|
104
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -110,7 +110,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
110
|
110
|
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
111
|
111
|
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
112
|
112
|
"'AVG') FROM TsKvEntity tskv " +
|
113
|
|
- "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
113
|
+ "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
114
|
114
|
CompletableFuture<TsKvEntity> findAvg(@Param("entityId") UUID entityId,
|
115
|
115
|
@Param("entityKey") int entityKey,
|
116
|
116
|
@Param("startTs") long startTs,
|
...
|
...
|
@@ -122,7 +122,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite |
122
|
122
|
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
123
|
123
|
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
124
|
124
|
"'SUM') FROM TsKvEntity tskv " +
|
125
|
|
- "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
|
125
|
+ "WHERE tskv.entityId = :entityId AND tskv.key = :entityKey AND tskv.ts >= :startTs AND tskv.ts < :endTs")
|
126
|
126
|
CompletableFuture<TsKvEntity> findSum(@Param("entityId") UUID entityId,
|
127
|
127
|
@Param("entityKey") int entityKey,
|
128
|
128
|
@Param("startTs") long startTs,
|
...
|
...
|
|