fixed AttributeKvRepository
This commit is contained in:
parent
4c77a75ef6
commit
a89985efdd
@ -42,12 +42,12 @@ public interface AttributeKvRepository extends JpaRepository<AttributeKvEntity,
|
||||
@Param("attributeType") int attributeType,
|
||||
@Param("attributeKey") int attributeKey);
|
||||
|
||||
@Query(value = "SELECT DISTINCT attribute_key FROM attribute_kv WHERE entity_type = 'DEVICE' " +
|
||||
@Query(value = "SELECT DISTINCT attribute_key FROM attribute_kv WHERE " +
|
||||
"AND entity_id in (SELECT id FROM device WHERE tenant_id = :tenantId and device_profile_id = :deviceProfileId limit 100) ORDER BY attribute_key", nativeQuery = true)
|
||||
List<Integer> findAllKeysByDeviceProfileId(@Param("tenantId") UUID tenantId,
|
||||
@Param("deviceProfileId") UUID deviceProfileId);
|
||||
|
||||
@Query(value = "SELECT DISTINCT attribute_key FROM attribute_kv WHERE entity_type = 'DEVICE' " +
|
||||
@Query(value = "SELECT DISTINCT attribute_key FROM attribute_kv WHERE " +
|
||||
"AND entity_id in (SELECT id FROM device WHERE tenant_id = :tenantId limit 100) ORDER BY attribute_key", nativeQuery = true)
|
||||
List<Integer> findAllKeysByTenantId(@Param("tenantId") UUID tenantId);
|
||||
|
||||
|
||||
@ -84,8 +84,8 @@ public class JpaKeyDictionaryDao extends JpaAbstractDaoListeningExecutorService
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey(Integer attributeKey) {
|
||||
Optional<KeyDictionaryEntry> byKeyId = keyDictionaryRepository.findByKeyId(attributeKey);
|
||||
public String getKey(Integer keyId) {
|
||||
Optional<KeyDictionaryEntry> byKeyId = keyDictionaryRepository.findByKeyId(keyId);
|
||||
return byKeyId.map(KeyDictionaryEntry::getKey).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user