Pārlūkot izejas kodu

增加告警消息部门过滤

lishuangjiang@potevio.com 1 gadu atpakaļ
vecāks
revīzija
f8e130292d

+ 4 - 0
iot-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/AlertRecordDataImpl.java

@@ -22,6 +22,8 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Service;
 
+import java.util.Objects;
+
 import static cc.iotkit.data.model.QTbAlertConfig.tbAlertConfig;
 import static cc.iotkit.data.model.QTbAlertRecord.tbAlertRecord;
 
@@ -72,10 +74,12 @@ public class AlertRecordDataImpl implements IAlertRecordData, IJPACommData<Alert
     }
 
     private Predicate buildPredicate(AlertRecord data) {
+
         return PredicateBuilder.instance()
                 .and(StringUtils.isNotEmpty(data.getTenantId()),()->tbAlertRecord.tenantId.eq(data.getTenantId()))
                 .and(StringUtils.isNotEmpty(data.getUid()),()->tbAlertRecord.uid.eq(data.getUid()))
                 .and(StringUtils.isNotEmpty(data.getLevel()), () -> tbAlertRecord.level.eq(data.getLevel()))
+                .and(Objects.nonNull(data.getCreateDept()), () -> tbAlertRecord.createDept.eq(data.getCreateDept()))
                 .and(StringUtils.isNotEmpty(data.getName()), () -> tbAlertRecord.name.like("%"+data.getName()+"%"))
                 .build();
     }