fix: 修复空项目下点击环境报错的问题、修复表格复选框全选时的展示问题

修复空项目下点击环境报错的问题、修复表格复选框全选时的展示问题
This commit is contained in:
song-tianyang 2021-05-10 16:00:08 +08:00 committed by 刘瑞斌
parent ed9859c80f
commit 414c4ccfb8
5 changed files with 10 additions and 5 deletions

View File

@ -12,15 +12,13 @@ import io.metersphere.controller.request.EnvironmentRequest;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -36,11 +34,14 @@ public class ApiTestEnvironmentService {
} }
public List<ApiTestEnvironmentWithBLOBs> listByConditions(EnvironmentRequest environmentRequest) { public List<ApiTestEnvironmentWithBLOBs> listByConditions(EnvironmentRequest environmentRequest) {
if (CollectionUtils.isEmpty(environmentRequest.getProjectIds())) {
return new ArrayList<>();
}
ApiTestEnvironmentExample example = new ApiTestEnvironmentExample(); ApiTestEnvironmentExample example = new ApiTestEnvironmentExample();
ApiTestEnvironmentExample.Criteria criteria = example.createCriteria(); ApiTestEnvironmentExample.Criteria criteria = example.createCriteria();
criteria.andProjectIdIn(environmentRequest.getProjectIds()); criteria.andProjectIdIn(environmentRequest.getProjectIds());
if (StringUtils.isNotBlank(environmentRequest.getName())) { if (StringUtils.isNotBlank(environmentRequest.getName())) {
environmentRequest.setName(StringUtils.wrapIfMissing(environmentRequest.getName(),'%')); //使搜索文本变成数据库中的正则表达式 environmentRequest.setName(StringUtils.wrapIfMissing(environmentRequest.getName(), '%')); //使搜索文本变成数据库中的正则表达式
criteria.andNameLike(environmentRequest.getName()); criteria.andNameLike(environmentRequest.getName());
} }
return apiTestEnvironmentMapper.selectByExampleWithBLOBs(example); return apiTestEnvironmentMapper.selectByExampleWithBLOBs(example);

View File

@ -302,6 +302,7 @@ export default {
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
this.condition.selectAll = false;
this.initTable(); this.initTable();
}, },
currentProtocol() { currentProtocol() {

View File

@ -217,6 +217,7 @@ export default {
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
this.condition.selectAll = false;
this.search(); this.search();
}, },
planId() { planId() {

View File

@ -414,6 +414,7 @@ export default {
this.refreshTableAndPlan(); this.refreshTableAndPlan();
}, },
selectNodeIds() { selectNodeIds() {
this.condition.selectAll = false;
this.search(); this.search();
}, },
tableLabel: { tableLabel: {

View File

@ -231,6 +231,7 @@ export default {
}, },
watch: { watch: {
selectProjectId() { selectProjectId() {
this.condition.selectAll = false;
this.initTable(); this.initTable();
}, },
planId() { planId() {