commit
3b74539d4e
@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.UUIDConverter;
|
||||
import org.thingsboard.server.common.data.id.EntityId;
|
||||
@ -238,7 +239,9 @@ public class JpaTimeseriesDao extends JpaAbstractDaoListeningExecutorService imp
|
||||
query.getKey(),
|
||||
query.getStartTs(),
|
||||
query.getEndTs(),
|
||||
new PageRequest(0, query.getLimit()))));
|
||||
new PageRequest(0, query.getLimit(),
|
||||
new Sort(Sort.Direction.fromString(
|
||||
query.getOrderBy()), "ts")))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -35,7 +35,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite
|
||||
|
||||
@Query("SELECT tskv FROM TsKvEntity tskv WHERE tskv.entityId = :entityId " +
|
||||
"AND tskv.entityType = :entityType AND tskv.key = :entityKey " +
|
||||
"AND tskv.ts > :startTs AND tskv.ts < :endTs ORDER BY tskv.ts DESC")
|
||||
"AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
List<TsKvEntity> findAllWithLimit(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String key,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user