count assets by tenantId improvements
This commit is contained in:
parent
e39e37babf
commit
7cd2a870f5
@ -122,5 +122,5 @@ public interface AssetRepository extends PagingAndSortingRepository<AssetEntity,
|
|||||||
@Query("SELECT DISTINCT a.type FROM AssetEntity a WHERE a.tenantId = :tenantId")
|
@Query("SELECT DISTINCT a.type FROM AssetEntity a WHERE a.tenantId = :tenantId")
|
||||||
List<String> findTenantAssetTypes(@Param("tenantId") UUID tenantId);
|
List<String> findTenantAssetTypes(@Param("tenantId") UUID tenantId);
|
||||||
|
|
||||||
Long countByTenantId(UUID tenantId);
|
Long countByTenantIdAndTypeIsNot(UUID tenantId, String type);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,7 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao {
|
public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao {
|
||||||
|
public static final String TB_SERVICE_QUEUE = "TbServiceQueue";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetRepository assetRepository;
|
private AssetRepository assetRepository;
|
||||||
@ -179,6 +180,6 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long countByTenantId(TenantId tenantId) {
|
public Long countByTenantId(TenantId tenantId) {
|
||||||
return assetRepository.countByTenantId(tenantId.getId());
|
return assetRepository.countByTenantIdAndTypeIsNot(tenantId.getId(), TB_SERVICE_QUEUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user