|
|
@ -312,9 +312,8 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository { |
|
|
public long countAlarmsByQuery(TenantId tenantId, CustomerId customerId, AlarmCountQuery query) { |
|
|
public long countAlarmsByQuery(TenantId tenantId, CustomerId customerId, AlarmCountQuery query) { |
|
|
QueryContext ctx = new QueryContext(new QuerySecurityContext(tenantId, null, EntityType.ALARM)); |
|
|
QueryContext ctx = new QueryContext(new QuerySecurityContext(tenantId, null, EntityType.ALARM)); |
|
|
|
|
|
|
|
|
ctx.append("select count(id) from alarm_info a "); |
|
|
|
|
|
|
|
|
|
|
|
if (query.isSearchPropagatedAlarms()) { |
|
|
if (query.isSearchPropagatedAlarms()) { |
|
|
|
|
|
ctx.append("select count(distinct(a.id)) from alarm_info a "); |
|
|
ctx.append(JOIN_ENTITY_ALARMS); |
|
|
ctx.append(JOIN_ENTITY_ALARMS); |
|
|
ctx.append("where a.tenant_id = :tenantId and ea.tenant_id = :tenantId"); |
|
|
ctx.append("where a.tenant_id = :tenantId and ea.tenant_id = :tenantId"); |
|
|
ctx.addUuidParameter("tenantId", tenantId.getId()); |
|
|
ctx.addUuidParameter("tenantId", tenantId.getId()); |
|
|
@ -323,6 +322,7 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository { |
|
|
ctx.addUuidParameter("customerId", customerId.getId()); |
|
|
ctx.addUuidParameter("customerId", customerId.getId()); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
ctx.append("select count(id) from alarm_info a "); |
|
|
ctx.append("where a.tenant_id = :tenantId"); |
|
|
ctx.append("where a.tenant_id = :tenantId"); |
|
|
ctx.addUuidParameter("tenantId", tenantId.getId()); |
|
|
ctx.addUuidParameter("tenantId", tenantId.getId()); |
|
|
if (customerId != null && !customerId.isNullUid()) { |
|
|
if (customerId != null && !customerId.isNullUid()) { |
|
|
|