Skip to content

Commit

Permalink
feat: update version to 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen9 committed Nov 11, 2024
1 parent bab2a06 commit 16e5833
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ApplicationOperationConfiguration> {

private final MongoTemplate mongoTemplate;

@Override
Expand All @@ -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
Expand Down Expand Up @@ -73,7 +76,8 @@ public ApplicationOperationConfiguration listByOperationId(String operationId) {

// the search of operation's based—info by serviceId
public List<ApplicationOperationConfiguration> 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());
Expand All @@ -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,
Expand Down Expand Up @@ -127,4 +132,17 @@ public List<ApplicationOperationConfiguration> queryByMultiCondition(
return mongoTemplate.find(filters, ServiceOperationCollection.class).stream()
.map(ServiceOperationMapper.INSTANCE::dtoFromDao).collect(Collectors.toList());
}

public List<ApplicationOperationConfiguration> queryByOperationIdList(
Collection<String> 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());
}


}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
</profiles>

<properties>
<revision>2.0.1</revision>
<revision>2.0.2</revision>
<commons-lang3.version>3.3.2</commons-lang3.version>
<java.version>1.8</java.version>

Expand Down

0 comments on commit 16e5833

Please sign in to comment.