From 3855416afcaa7d97c4e13629e6487dada89ea281 Mon Sep 17 00:00:00 2001 From: Rui Chen <44330697+coryhh@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:28:15 +0800 Subject: [PATCH] feat: update version to 2.0.2 (#283) --- ...nOperationConfigurationRepositoryImpl.java | 26 ++++++++++++++++--- pom.xml | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arex-storage-config/src/main/java/com/arextest/config/repository/impl/ApplicationOperationConfigurationRepositoryImpl.java b/arex-storage-config/src/main/java/com/arextest/config/repository/impl/ApplicationOperationConfigurationRepositoryImpl.java index faf8e66a..b5f3b5ba 100644 --- a/arex-storage-config/src/main/java/com/arextest/config/repository/impl/ApplicationOperationConfigurationRepositoryImpl.java +++ b/arex-storage-config/src/main/java/com/arextest/config/repository/impl/ApplicationOperationConfigurationRepositoryImpl.java @@ -5,7 +5,7 @@ import com.arextest.config.model.dto.application.ApplicationOperationConfiguration; import com.arextest.config.repository.ConfigRepositoryProvider; import com.arextest.config.utils.MongoHelper; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -18,10 +18,12 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; +import org.springframework.util.CollectionUtils; @RequiredArgsConstructor public class ApplicationOperationConfigurationRepositoryImpl implements ConfigRepositoryProvider { + private final MongoTemplate mongoTemplate; @Override @@ -45,7 +47,8 @@ public boolean update(ApplicationOperationConfiguration configuration) { Update update = MongoHelper.getMongoTemplateUpdates(configuration, ServiceOperationCollection.Fields.status); MongoHelper.withMongoTemplateBaseUpdate(update); - return mongoTemplate.updateMulti(query, update, ServiceOperationCollection.class).getModifiedCount() > 0; + return mongoTemplate.updateMulti(query, update, ServiceOperationCollection.class) + .getModifiedCount() > 0; } @Override @@ -73,7 +76,8 @@ public ApplicationOperationConfiguration listByOperationId(String operationId) { // the search of operation's based—info by serviceId public List operationBaseInfoList(String serviceId) { - Query filter = new Query(Criteria.where(ServiceOperationCollection.Fields.serviceId).is(serviceId)); + Query filter = new Query( + Criteria.where(ServiceOperationCollection.Fields.serviceId).is(serviceId)); return mongoTemplate.find(filter, ServiceOperationCollection.class) .stream().map(ServiceOperationMapper.INSTANCE::baseInfoFromDao) .collect(Collectors.toList()); @@ -88,7 +92,8 @@ public boolean removeByAppId(String appId) { public boolean findAndUpdate(ApplicationOperationConfiguration configuration) { Query query = new Query( Criteria.where(ServiceOperationCollection.Fields.serviceId).is(configuration.getServiceId()) - .and(ServiceOperationCollection.Fields.operationName).is(configuration.getOperationName()) + .and(ServiceOperationCollection.Fields.operationName) + .is(configuration.getOperationName()) .and(ServiceOperationCollection.Fields.appId).is(configuration.getAppId()) ); Update update = MongoHelper.getMongoTemplateUpdates(configuration, @@ -127,4 +132,17 @@ public List queryByMultiCondition( return mongoTemplate.find(filters, ServiceOperationCollection.class).stream() .map(ServiceOperationMapper.INSTANCE::dtoFromDao).collect(Collectors.toList()); } + + public List queryByOperationIdList( + Collection operationIds) { + if (CollectionUtils.isEmpty(operationIds)) { + return Collections.emptyList(); + } + Query query = new Query(Criteria.where(DASH_ID).in(operationIds)); + return mongoTemplate.find(query, ServiceOperationCollection.class) + .stream().map(ServiceOperationMapper.INSTANCE::dtoFromDao) + .collect(Collectors.toList()); + } + + } diff --git a/pom.xml b/pom.xml index 3dd6dfa7..999a7ad4 100644 --- a/pom.xml +++ b/pom.xml @@ -448,7 +448,7 @@ - 2.0.1 + 2.0.2 3.3.2 1.8