change CrudRepository to JpaRepository
This commit is contained in:
parent
94bcd14647
commit
6d7a40664f
@ -19,6 +19,7 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -41,7 +42,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D>
|
||||
|
||||
protected abstract Class<E> getEntityClass();
|
||||
|
||||
protected abstract CrudRepository<E, UUID> getCrudRepository();
|
||||
protected abstract JpaRepository<E, UUID> getRepository();
|
||||
|
||||
protected void setSearchText(E entity) {
|
||||
}
|
||||
@ -63,52 +64,52 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D>
|
||||
entity.setUuid(uuid);
|
||||
entity.setCreatedTime(Uuids.unixTimestamp(uuid));
|
||||
}
|
||||
entity = getCrudRepository().save(entity);
|
||||
entity = getRepository().save(entity);
|
||||
return DaoUtil.getData(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public D findById(TenantId tenantId, UUID key) {
|
||||
log.debug("Get entity by key {}", key);
|
||||
Optional<E> entity = getCrudRepository().findById(key);
|
||||
Optional<E> entity = getRepository().findById(key);
|
||||
return DaoUtil.getData(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<D> findByIdAsync(TenantId tenantId, UUID key) {
|
||||
log.debug("Get entity by key async {}", key);
|
||||
return service.submit(() -> DaoUtil.getData(getCrudRepository().findById(key)));
|
||||
return service.submit(() -> DaoUtil.getData(getRepository().findById(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsById(TenantId tenantId, UUID key) {
|
||||
log.debug("Exists by key {}", key);
|
||||
return getCrudRepository().existsById(key);
|
||||
return getRepository().existsById(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<Boolean> existsByIdAsync(TenantId tenantId, UUID key) {
|
||||
log.debug("Exists by key async {}", key);
|
||||
return service.submit(() -> getCrudRepository().existsById(key));
|
||||
return service.submit(() -> getRepository().existsById(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean removeById(TenantId tenantId, UUID id) {
|
||||
getCrudRepository().deleteById(id);
|
||||
getRepository().deleteById(id);
|
||||
log.debug("Remove request: {}", id);
|
||||
return !getCrudRepository().existsById(id);
|
||||
return !getRepository().existsById(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void removeAllByIds(Collection<UUID> ids) {
|
||||
CrudRepository<E, UUID> repository = getCrudRepository();
|
||||
CrudRepository<E, UUID> repository = getRepository();
|
||||
ids.forEach(repository::deleteById);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<D> find(TenantId tenantId) {
|
||||
List<E> entities = Lists.newArrayList(getCrudRepository().findAll());
|
||||
List<E> entities = Lists.newArrayList(getRepository().findAll());
|
||||
return DaoUtil.convertDataList(entities);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,13 +17,11 @@ package org.thingsboard.server.dao.sql.alarm;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.alarm.AlarmSeverity;
|
||||
import org.thingsboard.server.common.data.alarm.AlarmStatus;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.dao.model.sql.AlarmEntity;
|
||||
import org.thingsboard.server.dao.model.sql.AlarmInfoEntity;
|
||||
|
||||
@ -34,7 +32,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/21/2017.
|
||||
*/
|
||||
public interface AlarmRepository extends CrudRepository<AlarmEntity, UUID> {
|
||||
public interface AlarmRepository extends JpaRepository<AlarmEntity, UUID> {
|
||||
|
||||
@Query("SELECT a FROM AlarmEntity a WHERE a.originatorId = :originatorId AND a.type = :alarmType ORDER BY a.startTs DESC")
|
||||
List<AlarmEntity> findLatestByOriginatorAndType(@Param("originatorId") UUID originatorId,
|
||||
|
||||
@ -19,7 +19,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.alarm.Alarm;
|
||||
import org.thingsboard.server.common.data.alarm.AlarmInfo;
|
||||
@ -39,7 +39,6 @@ import org.thingsboard.server.dao.DaoUtil;
|
||||
import org.thingsboard.server.dao.alarm.AlarmDao;
|
||||
import org.thingsboard.server.dao.model.sql.AlarmEntity;
|
||||
import org.thingsboard.server.dao.model.sql.EntityAlarmEntity;
|
||||
import org.thingsboard.server.dao.relation.RelationDao;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractDao;
|
||||
import org.thingsboard.server.dao.sql.query.AlarmQueryRepository;
|
||||
|
||||
@ -72,7 +71,7 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<AlarmEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<AlarmEntity, UUID> getRepository() {
|
||||
return alarmRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,12 +17,11 @@ package org.thingsboard.server.dao.sql.asset;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.AssetEntity;
|
||||
import org.thingsboard.server.dao.model.sql.AssetInfoEntity;
|
||||
import org.thingsboard.server.dao.model.sql.RuleChainEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -30,7 +29,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/21/2017.
|
||||
*/
|
||||
public interface AssetRepository extends PagingAndSortingRepository<AssetEntity, UUID> {
|
||||
public interface AssetRepository extends JpaRepository<AssetEntity, UUID> {
|
||||
|
||||
@Query("SELECT new org.thingsboard.server.dao.model.sql.AssetInfoEntity(a, c.title, c.additionalInfo) " +
|
||||
"FROM AssetEntity a " +
|
||||
|
||||
@ -15,29 +15,22 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.asset;
|
||||
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.EntitySubtype;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.common.data.asset.Asset;
|
||||
import org.thingsboard.server.common.data.asset.AssetInfo;
|
||||
import org.thingsboard.server.common.data.id.EdgeId;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
import org.thingsboard.server.common.data.page.PageLink;
|
||||
import org.thingsboard.server.common.data.page.TimePageLink;
|
||||
import org.thingsboard.server.common.data.relation.EntityRelation;
|
||||
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
import org.thingsboard.server.dao.asset.AssetDao;
|
||||
import org.thingsboard.server.dao.model.sql.AssetEntity;
|
||||
import org.thingsboard.server.dao.model.sql.AssetInfoEntity;
|
||||
import org.thingsboard.server.dao.relation.RelationDao;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -65,7 +58,7 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<AssetEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<AssetEntity, UUID> getRepository() {
|
||||
return assetRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.audit;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.common.data.audit.ActionType;
|
||||
@ -27,7 +27,7 @@ import org.thingsboard.server.dao.model.sql.AuditLogEntity;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface AuditLogRepository extends PagingAndSortingRepository<AuditLogEntity, UUID> {
|
||||
public interface AuditLogRepository extends JpaRepository<AuditLogEntity, UUID> {
|
||||
|
||||
@Query("SELECT a FROM AuditLogEntity a WHERE " +
|
||||
"a.tenantId = :tenantId " +
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.audit;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.audit.ActionType;
|
||||
import org.thingsboard.server.common.data.audit.AuditLog;
|
||||
@ -47,7 +47,7 @@ public class JpaAuditLogDao extends JpaAbstractDao<AuditLogEntity, AuditLog> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<AuditLogEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<AuditLogEntity, UUID> getRepository() {
|
||||
return auditLogRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.component;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.plugin.ComponentScope;
|
||||
import org.thingsboard.server.common.data.plugin.ComponentType;
|
||||
@ -29,7 +29,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/6/2017.
|
||||
*/
|
||||
public interface ComponentDescriptorRepository extends PagingAndSortingRepository<ComponentDescriptorEntity, UUID> {
|
||||
public interface ComponentDescriptorRepository extends JpaRepository<ComponentDescriptorEntity, UUID> {
|
||||
|
||||
ComponentDescriptorEntity findByClazz(String clazz);
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.component;
|
||||
|
||||
import com.datastax.oss.driver.api.core.uuid.Uuids;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.common.data.id.ComponentDescriptorId;
|
||||
@ -55,7 +55,7 @@ public class JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<Comp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<ComponentDescriptorEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<ComponentDescriptorEntity, UUID> getRepository() {
|
||||
return componentDescriptorRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.customer;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.CustomerEntity;
|
||||
|
||||
@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/6/2017.
|
||||
*/
|
||||
public interface CustomerRepository extends PagingAndSortingRepository<CustomerEntity, UUID> {
|
||||
public interface CustomerRepository extends JpaRepository<CustomerEntity, UUID> {
|
||||
|
||||
@Query("SELECT c FROM CustomerEntity c WHERE c.tenantId = :tenantId " +
|
||||
"AND LOWER(c.searchText) LIKE LOWER(CONCAT('%', :textSearch, '%'))")
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.customer;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.Customer;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -46,7 +46,7 @@ public class JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Cus
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<CustomerEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<CustomerEntity, UUID> getRepository() {
|
||||
return customerRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.dashboard;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.DashboardInfoEntity;
|
||||
|
||||
@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/6/2017.
|
||||
*/
|
||||
public interface DashboardInfoRepository extends PagingAndSortingRepository<DashboardInfoEntity, UUID> {
|
||||
public interface DashboardInfoRepository extends JpaRepository<DashboardInfoEntity, UUID> {
|
||||
|
||||
DashboardInfoEntity findFirstByTenantIdAndTitle(UUID tenantId, String title);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.dashboard;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.DashboardEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -23,7 +23,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/6/2017.
|
||||
*/
|
||||
public interface DashboardRepository extends CrudRepository<DashboardEntity, UUID> {
|
||||
public interface DashboardRepository extends JpaRepository<DashboardEntity, UUID> {
|
||||
|
||||
Long countByTenantId(UUID tenantId);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.dashboard;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.Dashboard;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -41,7 +41,7 @@ public class JpaDashboardDao extends JpaAbstractSearchTextDao<DashboardEntity, D
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<DashboardEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<DashboardEntity, UUID> getRepository() {
|
||||
return dashboardRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.dashboard;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.DashboardInfo;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
@ -26,7 +26,6 @@ import org.thingsboard.server.common.data.page.SortOrder;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
import org.thingsboard.server.dao.dashboard.DashboardInfoDao;
|
||||
import org.thingsboard.server.dao.model.sql.DashboardInfoEntity;
|
||||
import org.thingsboard.server.dao.relation.RelationDao;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -50,7 +49,7 @@ public class JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<DashboardInfoEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<DashboardInfoEntity, UUID> getRepository() {
|
||||
return dashboardInfoRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.device;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -43,7 +43,7 @@ public class JpaDeviceCredentialsDao extends JpaAbstractDao<DeviceCredentialsEnt
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<DeviceCredentialsEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<DeviceCredentialsEntity, UUID> getRepository() {
|
||||
return deviceCredentialsRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
@ -63,7 +63,7 @@ public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<DeviceEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<DeviceEntity, UUID> getRepository() {
|
||||
return deviceRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.device;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.common.data.DeviceProfile;
|
||||
@ -46,7 +46,7 @@ public class JpaDeviceProfileDao extends JpaAbstractSearchTextDao<DeviceProfileE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<DeviceProfileEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<DeviceProfileEntity, UUID> getRepository() {
|
||||
return deviceProfileRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,15 +17,15 @@ package org.thingsboard.server.dao.sql.edge;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.EdgeEventEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface EdgeEventRepository extends PagingAndSortingRepository<EdgeEventEntity, UUID>, JpaSpecificationExecutor<EdgeEventEntity> {
|
||||
public interface EdgeEventRepository extends JpaRepository<EdgeEventEntity, UUID>, JpaSpecificationExecutor<EdgeEventEntity> {
|
||||
|
||||
@Query("SELECT e FROM EdgeEventEntity e WHERE " +
|
||||
"e.tenantId = :tenantId " +
|
||||
|
||||
@ -17,17 +17,16 @@ package org.thingsboard.server.dao.sql.edge;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.EdgeEntity;
|
||||
import org.thingsboard.server.dao.model.sql.EdgeInfoEntity;
|
||||
import org.thingsboard.server.dao.model.sql.RuleChainEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface EdgeRepository extends PagingAndSortingRepository<EdgeEntity, UUID> {
|
||||
public interface EdgeRepository extends JpaRepository<EdgeEntity, UUID> {
|
||||
|
||||
@Query("SELECT d FROM EdgeEntity d WHERE d.tenantId = :tenantId " +
|
||||
"AND d.customerId = :customerId " +
|
||||
|
||||
@ -19,7 +19,7 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.edge.EdgeEvent;
|
||||
import org.thingsboard.server.common.data.id.EdgeEventId;
|
||||
@ -63,7 +63,7 @@ public class JpaBaseEdgeEventDao extends JpaAbstractSearchTextDao<EdgeEventEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<EdgeEventEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<EdgeEventEntity, UUID> getRepository() {
|
||||
return edgeEventRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ package org.thingsboard.server.dao.sql.edge;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.EntitySubtype;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
@ -53,7 +53,7 @@ public class JpaEdgeDao extends JpaAbstractSearchTextDao<EdgeEntity, Edge> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<EdgeEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<EdgeEntity, UUID> getRepository() {
|
||||
return edgeRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,10 +17,9 @@ package org.thingsboard.server.dao.sql.entityview;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.DeviceEntity;
|
||||
import org.thingsboard.server.dao.model.sql.EntityViewEntity;
|
||||
import org.thingsboard.server.dao.model.sql.EntityViewInfoEntity;
|
||||
|
||||
@ -30,7 +29,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Victor Basanets on 8/31/2017.
|
||||
*/
|
||||
public interface EntityViewRepository extends PagingAndSortingRepository<EntityViewEntity, UUID> {
|
||||
public interface EntityViewRepository extends JpaRepository<EntityViewEntity, UUID> {
|
||||
|
||||
@Query("SELECT new org.thingsboard.server.dao.model.sql.EntityViewInfoEntity(e, c.title, c.additionalInfo) " +
|
||||
"FROM EntityViewEntity e " +
|
||||
|
||||
@ -18,7 +18,7 @@ package org.thingsboard.server.dao.sql.entityview;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.EntitySubtype;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
@ -57,7 +57,7 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<EntityViewEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<EntityViewEntity, UUID> getRepository() {
|
||||
return entityViewRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.event;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.dao.model.sql.EventEntity;
|
||||
@ -29,7 +29,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/3/2017.
|
||||
*/
|
||||
public interface EventRepository extends PagingAndSortingRepository<EventEntity, UUID> {
|
||||
public interface EventRepository extends JpaRepository<EventEntity, UUID> {
|
||||
|
||||
EventEntity findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid(UUID tenantId,
|
||||
EntityType entityType,
|
||||
|
||||
@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.Event;
|
||||
import org.thingsboard.server.common.data.event.DebugEvent;
|
||||
@ -70,7 +70,7 @@ public class JpaBaseEventDao extends JpaAbstractDao<EventEntity, Event> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<EventEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<EventEntity, UUID> getRepository() {
|
||||
return eventRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
@ -40,7 +40,7 @@ public class JpaOAuth2ClientRegistrationTemplateDao extends JpaAbstractDao<OAuth
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OAuth2ClientRegistrationTemplateEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OAuth2ClientRegistrationTemplateEntity, UUID> getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.oauth2.OAuth2Domain;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
@ -39,7 +39,7 @@ public class JpaOAuth2DomainDao extends JpaAbstractDao<OAuth2DomainEntity, OAuth
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OAuth2DomainEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OAuth2DomainEntity, UUID> getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.oauth2.OAuth2Mobile;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
@ -39,7 +39,7 @@ public class JpaOAuth2MobileDao extends JpaAbstractDao<OAuth2MobileEntity, OAuth
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OAuth2MobileEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OAuth2MobileEntity, UUID> getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.oauth2.OAuth2Params;
|
||||
@ -36,7 +37,7 @@ public class JpaOAuth2ParamsDao extends JpaAbstractDao<OAuth2ParamsEntity, OAuth
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OAuth2ParamsEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OAuth2ParamsEntity, UUID> getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.oauth2.OAuth2Registration;
|
||||
import org.thingsboard.server.common.data.oauth2.PlatformType;
|
||||
@ -41,7 +41,7 @@ public class JpaOAuth2RegistrationDao extends JpaAbstractDao<OAuth2RegistrationE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OAuth2RegistrationEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OAuth2RegistrationEntity, UUID> getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.OAuth2ClientRegistrationTemplateEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OAuth2ClientRegistrationTemplateRepository extends CrudRepository<OAuth2ClientRegistrationTemplateEntity, UUID> {
|
||||
public interface OAuth2ClientRegistrationTemplateRepository extends JpaRepository<OAuth2ClientRegistrationTemplateEntity, UUID> {
|
||||
|
||||
OAuth2ClientRegistrationTemplateEntity findByProviderId(String providerId);
|
||||
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.OAuth2DomainEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OAuth2DomainRepository extends CrudRepository<OAuth2DomainEntity, UUID> {
|
||||
public interface OAuth2DomainRepository extends JpaRepository<OAuth2DomainEntity, UUID> {
|
||||
|
||||
List<OAuth2DomainEntity> findByOauth2ParamsId(UUID oauth2ParamsId);
|
||||
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.OAuth2MobileEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OAuth2MobileRepository extends CrudRepository<OAuth2MobileEntity, UUID> {
|
||||
public interface OAuth2MobileRepository extends JpaRepository<OAuth2MobileEntity, UUID> {
|
||||
|
||||
List<OAuth2MobileEntity> findByOauth2ParamsId(UUID oauth2ParamsId);
|
||||
|
||||
|
||||
@ -15,10 +15,11 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.thingsboard.server.dao.model.sql.OAuth2ParamsEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OAuth2ParamsRepository extends CrudRepository<OAuth2ParamsEntity, UUID> {
|
||||
public interface OAuth2ParamsRepository extends JpaRepository<OAuth2ParamsEntity, UUID> {
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.oauth2;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.oauth2.SchemeType;
|
||||
import org.thingsboard.server.dao.model.sql.OAuth2RegistrationEntity;
|
||||
@ -24,7 +24,7 @@ import org.thingsboard.server.dao.model.sql.OAuth2RegistrationEntity;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OAuth2RegistrationRepository extends CrudRepository<OAuth2RegistrationEntity, UUID> {
|
||||
public interface OAuth2RegistrationRepository extends JpaRepository<OAuth2RegistrationEntity, UUID> {
|
||||
|
||||
@Query("SELECT reg " +
|
||||
"FROM OAuth2RegistrationEntity reg " +
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.ota;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.OtaPackage;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -40,7 +40,7 @@ public class JpaOtaPackageDao extends JpaAbstractSearchTextDao<OtaPackageEntity,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OtaPackageEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OtaPackageEntity, UUID> getRepository() {
|
||||
return otaPackageRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.ota;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.OtaPackageInfo;
|
||||
import org.thingsboard.server.common.data.ota.OtaPackageType;
|
||||
@ -47,7 +47,7 @@ public class JpaOtaPackageInfoDao extends JpaAbstractSearchTextDao<OtaPackageInf
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<OtaPackageInfoEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<OtaPackageInfoEntity, UUID> getRepository() {
|
||||
return otaPackageInfoRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,15 +17,15 @@ package org.thingsboard.server.dao.sql.ota;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.ota.OtaPackageType;
|
||||
import org.thingsboard.server.dao.model.sql.OtaPackageInfoEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OtaPackageInfoRepository extends CrudRepository<OtaPackageInfoEntity, UUID> {
|
||||
public interface OtaPackageInfoRepository extends JpaRepository<OtaPackageInfoEntity, UUID> {
|
||||
@Query("SELECT new OtaPackageInfoEntity(f.id, f.createdTime, f.tenantId, f.deviceProfileId, f.type, f.title, f.version, f.tag, f.url, f.fileName, f.contentType, f.checksumAlgorithm, f.checksum, f.dataSize, f.additionalInfo, CASE WHEN (f.data IS NOT NULL OR f.url IS NOT NULL) THEN true ELSE false END) FROM OtaPackageEntity f WHERE " +
|
||||
"f.tenantId = :tenantId " +
|
||||
"AND LOWER(f.searchText) LIKE LOWER(CONCAT('%', :searchText, '%'))")
|
||||
|
||||
@ -15,15 +15,14 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.ota;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.OtaPackageEntity;
|
||||
import org.thingsboard.server.dao.model.sql.OtaPackageInfoEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface OtaPackageRepository extends CrudRepository<OtaPackageEntity, UUID> {
|
||||
public interface OtaPackageRepository extends JpaRepository<OtaPackageEntity, UUID> {
|
||||
@Query(value = "SELECT COALESCE(SUM(ota.data_size), 0) FROM ota_package ota WHERE ota.tenant_id = :tenantId AND ota.data IS NOT NULL", nativeQuery = true)
|
||||
Long sumDataSizeByTenantId(@Param("tenantId") UUID tenantId);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.resource;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.ResourceType;
|
||||
import org.thingsboard.server.common.data.TbResource;
|
||||
@ -48,7 +48,7 @@ public class JpaTbResourceDao extends JpaAbstractSearchTextDao<TbResourceEntity,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<TbResourceEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<TbResourceEntity, UUID> getRepository() {
|
||||
return resourceRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.resource;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.TbResourceInfo;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -44,7 +44,7 @@ public class JpaTbResourceInfoDao extends JpaAbstractSearchTextDao<TbResourceInf
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<TbResourceInfoEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<TbResourceInfoEntity, UUID> getRepository() {
|
||||
return resourceInfoRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ package org.thingsboard.server.dao.sql.resource;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.TbResourceInfoEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TbResourceInfoRepository extends CrudRepository<TbResourceInfoEntity, UUID> {
|
||||
public interface TbResourceInfoRepository extends JpaRepository<TbResourceInfoEntity, UUID> {
|
||||
|
||||
@Query("SELECT tr FROM TbResourceInfoEntity tr WHERE " +
|
||||
"LOWER(tr.title) LIKE LOWER(CONCAT('%', :searchText, '%'))" +
|
||||
|
||||
@ -17,15 +17,15 @@ package org.thingsboard.server.dao.sql.resource;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.TbResourceEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TbResourceRepository extends CrudRepository<TbResourceEntity, UUID> {
|
||||
public interface TbResourceRepository extends JpaRepository<TbResourceEntity, UUID> {
|
||||
|
||||
TbResourceEntity findByTenantIdAndResourceTypeAndResourceKey(UUID tenantId, String resourceType, String resourceKey);
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.rpc;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.DeviceId;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -45,7 +45,7 @@ public class JpaRpcDao extends JpaAbstractDao<RpcEntity, Rpc> implements RpcDao
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<RpcEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<RpcEntity, UUID> getRepository() {
|
||||
return rpcRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,15 +17,15 @@ package org.thingsboard.server.dao.sql.rpc;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.rpc.RpcStatus;
|
||||
import org.thingsboard.server.dao.model.sql.RpcEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface RpcRepository extends CrudRepository<RpcEntity, UUID> {
|
||||
public interface RpcRepository extends JpaRepository<RpcEntity, UUID> {
|
||||
Page<RpcEntity> findAllByTenantIdAndDeviceId(UUID tenantId, UUID deviceId, Pageable pageable);
|
||||
|
||||
Page<RpcEntity> findAllByTenantIdAndDeviceIdAndStatus(UUID tenantId, UUID deviceId, RpcStatus status, Pageable pageable);
|
||||
|
||||
@ -17,13 +17,12 @@ package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
import org.thingsboard.server.common.data.page.PageLink;
|
||||
import org.thingsboard.server.common.data.rule.RuleChain;
|
||||
import org.thingsboard.server.common.data.rule.RuleChainOutputLabelsUsage;
|
||||
import org.thingsboard.server.common.data.rule.RuleChainType;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
import org.thingsboard.server.dao.model.sql.RuleChainEntity;
|
||||
@ -31,7 +30,6 @@ import org.thingsboard.server.dao.rule.RuleChainDao;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -48,7 +46,7 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<RuleChainEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<RuleChainEntity, UUID> getRepository() {
|
||||
return ruleChainRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.rule.RuleNode;
|
||||
@ -42,7 +42,7 @@ public class JpaRuleNodeDao extends JpaAbstractSearchTextDao<RuleNodeEntity, Rul
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<RuleNodeEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<RuleNodeEntity, UUID> getRepository() {
|
||||
return ruleNodeRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,10 +17,9 @@ package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.common.data.id.EntityId;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
import org.thingsboard.server.common.data.page.PageLink;
|
||||
import org.thingsboard.server.common.data.rule.RuleNodeState;
|
||||
@ -44,7 +43,7 @@ public class JpaRuleNodeStateDao extends JpaAbstractDao<RuleNodeStateEntity, Rul
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<RuleNodeStateEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<RuleNodeStateEntity, UUID> getRepository() {
|
||||
return ruleNodeStateRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,20 +17,16 @@ package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
|
||||
import org.thingsboard.server.common.data.rule.RuleChainType;
|
||||
import org.thingsboard.server.dao.model.sql.RelationEntity;
|
||||
import org.thingsboard.server.dao.model.sql.RuleChainEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface RuleChainRepository extends PagingAndSortingRepository<RuleChainEntity, UUID> {
|
||||
public interface RuleChainRepository extends JpaRepository<RuleChainEntity, UUID> {
|
||||
|
||||
@Query("SELECT rc FROM RuleChainEntity rc WHERE rc.tenantId = :tenantId " +
|
||||
"AND LOWER(rc.searchText) LIKE LOWER(CONCAT('%', :searchText, '%'))")
|
||||
|
||||
@ -15,15 +15,15 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.RuleNodeEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface RuleNodeRepository extends CrudRepository<RuleNodeEntity, UUID> {
|
||||
public interface RuleNodeRepository extends JpaRepository<RuleNodeEntity, UUID> {
|
||||
|
||||
@Query("SELECT r FROM RuleNodeEntity r WHERE r.ruleChainId in " +
|
||||
"(select id from RuleChainEntity rc WHERE rc.tenantId = :tenantId) " +
|
||||
|
||||
@ -17,16 +17,14 @@ package org.thingsboard.server.dao.sql.rule;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.dao.model.sql.EventEntity;
|
||||
import org.thingsboard.server.dao.model.sql.RuleNodeStateEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface RuleNodeStateRepository extends PagingAndSortingRepository<RuleNodeStateEntity, UUID> {
|
||||
public interface RuleNodeStateRepository extends JpaRepository<RuleNodeStateEntity, UUID> {
|
||||
|
||||
@Query("SELECT e FROM RuleNodeStateEntity e WHERE e.ruleNodeId = :ruleNodeId")
|
||||
Page<RuleNodeStateEntity> findByRuleNodeId(@Param("ruleNodeId") UUID ruleNodeId, Pageable pageable);
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.settings;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.AdminSettingsEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -23,7 +23,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 5/6/2017.
|
||||
*/
|
||||
public interface AdminSettingsRepository extends CrudRepository<AdminSettingsEntity, UUID> {
|
||||
public interface AdminSettingsRepository extends JpaRepository<AdminSettingsEntity, UUID> {
|
||||
|
||||
AdminSettingsEntity findByKey(String key);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ package org.thingsboard.server.dao.sql.settings;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.AdminSettings;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -41,7 +41,7 @@ public class JpaAdminSettingsDao extends JpaAbstractDao<AdminSettingsEntity, Adm
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<AdminSettingsEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<AdminSettingsEntity, UUID> getRepository() {
|
||||
return adminSettingsRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.tenant;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.Tenant;
|
||||
import org.thingsboard.server.common.data.TenantInfo;
|
||||
@ -48,7 +48,7 @@ public class JpaTenantDao extends JpaAbstractSearchTextDao<TenantEntity, Tenant>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<TenantEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<TenantEntity, UUID> getRepository() {
|
||||
return tenantRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.tenant;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.EntityInfo;
|
||||
import org.thingsboard.server.common.data.TenantProfile;
|
||||
@ -43,7 +43,7 @@ public class JpaTenantProfileDao extends JpaAbstractSearchTextDao<TenantProfileE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<TenantProfileEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<TenantProfileEntity, UUID> getRepository() {
|
||||
return tenantProfileRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -17,15 +17,15 @@ package org.thingsboard.server.dao.sql.tenant;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.EntityInfo;
|
||||
import org.thingsboard.server.dao.model.sql.TenantProfileEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TenantProfileRepository extends PagingAndSortingRepository<TenantProfileEntity, UUID> {
|
||||
public interface TenantProfileRepository extends JpaRepository<TenantProfileEntity, UUID> {
|
||||
|
||||
@Query("SELECT new org.thingsboard.server.common.data.EntityInfo(t.id, 'TENANT_PROFILE', t.name) " +
|
||||
"FROM TenantProfileEntity t " +
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.tenant;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.TenantEntity;
|
||||
import org.thingsboard.server.dao.model.sql.TenantInfoEntity;
|
||||
@ -28,7 +28,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 4/30/2017.
|
||||
*/
|
||||
public interface TenantRepository extends PagingAndSortingRepository<TenantEntity, UUID> {
|
||||
public interface TenantRepository extends JpaRepository<TenantEntity, UUID> {
|
||||
|
||||
@Query("SELECT new org.thingsboard.server.dao.model.sql.TenantInfoEntity(t, p.name) " +
|
||||
"FROM TenantEntity t " +
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.usagerecord;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thingsboard.server.dao.model.sql.ApiUsageStateEntity;
|
||||
@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* @author Valerii Sosliuk
|
||||
*/
|
||||
public interface ApiUsageStateRepository extends CrudRepository<ApiUsageStateEntity, UUID> {
|
||||
public interface ApiUsageStateRepository extends JpaRepository<ApiUsageStateEntity, UUID> {
|
||||
|
||||
@Query("SELECT ur FROM ApiUsageStateEntity ur WHERE ur.tenantId = :tenantId " +
|
||||
"AND ur.entityId = :tenantId AND ur.entityType = 'TENANT' ")
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.usagerecord;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.ApiUsageState;
|
||||
import org.thingsboard.server.common.data.id.EntityId;
|
||||
@ -45,7 +45,7 @@ public class JpaApiUsageStateDao extends JpaAbstractDao<ApiUsageStateEntity, Api
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<ApiUsageStateEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<ApiUsageStateEntity, UUID> getRepository() {
|
||||
return apiUsageStateRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.user;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.security.UserCredentials;
|
||||
@ -42,7 +42,7 @@ public class JpaUserCredentialsDao extends JpaAbstractDao<UserCredentialsEntity,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<UserCredentialsEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<UserCredentialsEntity, UUID> getRepository() {
|
||||
return userCredentialsRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.user;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.User;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -48,7 +48,7 @@ public class JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<UserEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<UserEntity, UUID> getRepository() {
|
||||
return userRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.user;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.thingsboard.server.dao.model.sql.UserCredentialsEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -23,7 +23,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 4/22/2017.
|
||||
*/
|
||||
public interface UserCredentialsRepository extends CrudRepository<UserCredentialsEntity, UUID> {
|
||||
public interface UserCredentialsRepository extends JpaRepository<UserCredentialsEntity, UUID> {
|
||||
|
||||
UserCredentialsEntity findByUserId(UUID userId);
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.user;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.common.data.security.Authority;
|
||||
import org.thingsboard.server.dao.model.sql.UserEntity;
|
||||
@ -28,7 +28,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* @author Valerii Sosliuk
|
||||
*/
|
||||
public interface UserRepository extends PagingAndSortingRepository<UserEntity, UUID> {
|
||||
public interface UserRepository extends JpaRepository<UserEntity, UUID> {
|
||||
|
||||
UserEntity findByEmail(String email);
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.widget;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.widget.WidgetType;
|
||||
@ -24,7 +24,6 @@ import org.thingsboard.server.common.data.widget.WidgetTypeDetails;
|
||||
import org.thingsboard.server.common.data.widget.WidgetTypeInfo;
|
||||
import org.thingsboard.server.dao.DaoUtil;
|
||||
import org.thingsboard.server.dao.model.sql.WidgetTypeDetailsEntity;
|
||||
import org.thingsboard.server.dao.model.sql.WidgetTypeEntity;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractDao;
|
||||
import org.thingsboard.server.dao.widget.WidgetTypeDao;
|
||||
|
||||
@ -46,7 +45,7 @@ public class JpaWidgetTypeDao extends JpaAbstractDao<WidgetTypeDetailsEntity, Wi
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<WidgetTypeDetailsEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<WidgetTypeDetailsEntity, UUID> getRepository() {
|
||||
return widgetTypeRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
package org.thingsboard.server.dao.sql.widget;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
@ -47,7 +47,7 @@ public class JpaWidgetsBundleDao extends JpaAbstractSearchTextDao<WidgetsBundleE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CrudRepository<WidgetsBundleEntity, UUID> getCrudRepository() {
|
||||
protected JpaRepository<WidgetsBundleEntity, UUID> getRepository() {
|
||||
return widgetsBundleRepository;
|
||||
}
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.thingsboard.server.dao.sql.widget;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.WidgetTypeDetailsEntity;
|
||||
import org.thingsboard.server.dao.model.sql.WidgetTypeEntity;
|
||||
@ -25,7 +25,7 @@ import org.thingsboard.server.dao.model.sql.WidgetTypeInfoEntity;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface WidgetTypeRepository extends CrudRepository<WidgetTypeDetailsEntity, UUID> {
|
||||
public interface WidgetTypeRepository extends JpaRepository<WidgetTypeDetailsEntity, UUID> {
|
||||
|
||||
@Query("SELECT wt FROM WidgetTypeEntity wt WHERE wt.id = :widgetTypeId")
|
||||
WidgetTypeEntity findWidgetTypeById(@Param("widgetTypeId") UUID widgetTypeId);
|
||||
|
||||
@ -17,8 +17,8 @@ package org.thingsboard.server.dao.sql.widget;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.thingsboard.server.dao.model.sql.WidgetsBundleEntity;
|
||||
|
||||
@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Created by Valerii Sosliuk on 4/23/2017.
|
||||
*/
|
||||
public interface WidgetsBundleRepository extends PagingAndSortingRepository<WidgetsBundleEntity, UUID> {
|
||||
public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEntity, UUID> {
|
||||
|
||||
WidgetsBundleEntity findWidgetsBundleByTenantIdAndAlias(UUID tenantId, String alias);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user