refactor(项目设置): 应用设置优化

This commit is contained in:
shiziyuan9527 2022-02-28 16:19:38 +08:00 committed by shiziyuan9527
parent d129a3f90b
commit dfe2e6fd71
35 changed files with 764 additions and 1305 deletions

View File

@ -9,6 +9,9 @@ import io.metersphere.api.dto.parse.postman.PostmanKeyValue;
import io.metersphere.api.parse.PostmanAbstractParserParser;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiModule;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.service.ProjectApplicationService;
import org.apache.commons.lang3.StringUtils;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.domain.Project;
@ -43,8 +46,11 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser<ApiDefi
Map<String, String> repeatMap = new HashMap();
ProjectMapper projectMapper = CommonBeanFactory.getBean(ProjectMapper.class);
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.URL_REPEATABLE.name());
boolean urlRepeat = config.getUrlRepeatable();
parseItem(postmanCollection.getItem(), variables, results,
apiModule, apiModule.getName(), cases, repeatMap, project.getRepeatable());
apiModule, apiModule.getName(), cases, repeatMap, urlRepeat);
Collections.reverse(results); // 调整顺序
Collections.reverse(cases);
apiImport.setData(results);

View File

@ -21,16 +21,14 @@ import io.metersphere.api.parse.ApiImportParser;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.MsTestElementConstants;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ApiReportCountDTO;
import io.metersphere.dto.MsExecResponseDTO;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiScenarioTestJob;
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
@ -40,10 +38,7 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.AutomationReference;
import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.service.EnvironmentGroupProjectService;
import io.metersphere.service.QuotaService;
import io.metersphere.service.RelationshipEdgeService;
import io.metersphere.service.ScheduleService;
import io.metersphere.service.*;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
@ -134,6 +129,8 @@ public class ApiAutomationService {
private ExtProjectVersionMapper extProjectVersionMapper;
@Resource
private MsHashTreeService hashTreeService;
@Resource
private ProjectApplicationService projectApplicationService;
private ThreadLocal<Long> currentScenarioOrder = new ThreadLocal<>();
@ -298,8 +295,9 @@ public class ApiAutomationService {
MSException.throwException("add scenario fail, project is not find.");
}
Boolean openCustomNum = project.getScenarioCustomNum();
if (BooleanUtils.isTrue(openCustomNum)) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.SCENARIO_CUSTOM_NUM.name());
if (BooleanUtils.isTrue(config.getScenarioCustomNum())) {
checkCustomNumExist(request);
}
}
@ -1289,8 +1287,9 @@ public class ApiAutomationService {
Project project = new Project();
if (!CollectionUtils.isEmpty(data) && data.get(0) != null && data.get(0).getProjectId() != null) {
project = projectMapper.selectByPrimaryKey(data.get(0).getProjectId());
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.SCENARIO_CUSTOM_NUM.name());
num = getNextNum(data.get(0).getProjectId());
request.setOpenCustomNum(project.getScenarioCustomNum());
request.setOpenCustomNum(config.getScenarioCustomNum());
}
String defaultVersion = extProjectVersionMapper.getDefaultVersion(request.getProjectId());
request.setDefaultVersion(defaultVersion);
@ -1307,7 +1306,7 @@ public class ApiAutomationService {
item.setName(item.getName().substring(0, 255));
}
item.setNum(num);
if (BooleanUtils.isFalse(project.getScenarioCustomNum())) {
if (BooleanUtils.isFalse(request.getOpenCustomNum())) {
// 如果未开启即使有自定值也直接覆盖
item.setCustomNum(String.valueOf(num));
} else {

View File

@ -36,6 +36,7 @@ import io.metersphere.controller.request.RelationshipEdgeRequest;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.MsExecResponseDTO;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.dto.RelationshipEdgeDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
@ -124,6 +125,8 @@ public class ApiDefinitionService {
private TestPlanService testPlanService;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
@Resource
private ProjectApplicationService projectApplicationService;
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
@ -489,7 +492,9 @@ public class ApiDefinitionService {
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId())
.andVersionIdEqualTo(request.getVersionId());
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
if (project != null && project.getRepeatable() != null && project.getRepeatable()) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.URL_REPEATABLE.name());
boolean urlRepeat = config.getUrlRepeatable();
if (project != null && urlRepeat) {
criteria.andNameEqualTo(request.getName());
if (apiDefinitionMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("api_definition_name_not_repeating"));
@ -1184,6 +1189,8 @@ public class ApiDefinitionService {
ExtApiDefinitionMapper extApiDefinitionMapper = sqlSession.getMapper(ExtApiDefinitionMapper.class);
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.URL_REPEATABLE.name());
boolean urlRepeat = config.getUrlRepeatable();
int num = 0;
if (!CollectionUtils.isEmpty(data) && data.get(0) != null && data.get(0).getProjectId() != null) {
num = getNextNum(data.get(0).getProjectId());
@ -1202,14 +1209,14 @@ public class ApiDefinitionService {
String apiId = item.getId();
EsbApiParamsWithBLOBs model = apiImport.getEsbApiParamsMap().get(apiId);
request.setModeId("fullCoverage");//标准版ESB数据导入不区分是否覆盖默认都为覆盖
importCreate(item, batchMapper, apiTestCaseMapper, extApiDefinitionMapper, request, apiImport.getCases(), apiImport.getMocks(), project.getRepeatable());
importCreate(item, batchMapper, apiTestCaseMapper, extApiDefinitionMapper, request, apiImport.getCases(), apiImport.getMocks(), urlRepeat);
if (model != null) {
apiImport.getEsbApiParamsMap().remove(apiId);
model.setResourceId(item.getId());
apiImport.getEsbApiParamsMap().put(item.getId(), model);
}
} else {
importCreate(item, batchMapper, apiTestCaseMapper, extApiDefinitionMapper, request, apiImport.getCases(), apiImport.getMocks(), project.getRepeatable());
importCreate(item, batchMapper, apiTestCaseMapper, extApiDefinitionMapper, request, apiImport.getCases(), apiImport.getMocks(), urlRepeat);
}
if (i % 300 == 0) {
sqlSession.flushStatements();

View File

@ -10,6 +10,7 @@ import io.metersphere.base.domain.ApiTestEnvironmentExample;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.base.domain.Project;
import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.FileUtils;
@ -17,12 +18,14 @@ import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.EnvironmentRequest;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.service.EnvironmentGroupProjectService;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import io.metersphere.service.SystemParameterService;
import org.apache.commons.collections.CollectionUtils;
@ -42,6 +45,8 @@ public class ApiTestEnvironmentService {
private ApiTestEnvironmentMapper apiTestEnvironmentMapper;
@Resource
private EnvironmentGroupProjectService environmentGroupProjectService;
@Resource
private ProjectApplicationService projectApplicationService;
public List<ApiTestEnvironmentWithBLOBs> list(String projectId) {
ApiTestEnvironmentExample example = new ApiTestEnvironmentExample();
@ -217,11 +222,12 @@ public class ApiTestEnvironmentService {
}
}
}
if(project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0){
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPortStr = config.getMockTcpPort();
if(mockPortStr != null && mockPortStr != 0){
if(configObj.containsKey("tcpConfig")){
if(configObj.containsKey("port")){
if(configObj.getInteger("port").intValue() != project.getMockTcpPort().intValue()){
if(configObj.getInteger("port").intValue() != mockPortStr){
needUpdate = true;
}
}else {
@ -349,9 +355,11 @@ public class ApiTestEnvironmentService {
tcpConfigObj.put("nodelay", false);
tcpConfigObj.put("closeConnection", false);
if(project != null){
if(project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0){
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPort = config.getMockTcpPort();
if(mockPort != null && mockPort != 0){
tcpConfigObj.put("server", tcpSocket);
tcpConfigObj.put("port", project.getMockTcpPort().intValue());
tcpConfigObj.put("port", mockPort);
}
}

View File

@ -24,10 +24,12 @@ import io.metersphere.base.mapper.MockConfigMapper;
import io.metersphere.base.mapper.MockExpectConfigMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.ExtMockExpectConfigMapper;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.jmeter.utils.ScriptEngineUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.service.ProjectApplicationService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -62,6 +64,8 @@ public class MockConfigService {
private ApiDefinitionService apiDefinitionService;
@Resource
private ProjectMapper projectMapper;
@Resource
private ProjectApplicationService projectApplicationService;
public MockConfigResponse findByApiIdList(List<String> apiIdList) {
if (apiIdList.isEmpty()) {
@ -1259,9 +1263,19 @@ public class MockConfigService {
}
public MockExpectConfigWithBLOBs matchTcpMockExpect(String message, int port) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andMockTcpPortEqualTo(port).andIsMockTcpOpenEqualTo(true);
List<Project> projectList = projectMapper.selectByExample(projectExample);
ProjectApplicationExample pae = new ProjectApplicationExample();
pae.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_OPEN.name())
.andTypeValueEqualTo(String.valueOf(true));
pae.or().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name())
.andTypeValueEqualTo(String.valueOf(port));
List<ProjectApplication> projectApplications = projectApplicationService.selectByExample(pae);
List<String> projectIds = projectApplications.stream().map(ProjectApplication::getProjectId).collect(Collectors.toList());
List<Project> projectList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(projectIds)) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andIdIn(projectIds);
projectList = projectMapper.selectByExample(projectExample);
}
boolean isJsonMessage = this.checkMessageIsJson(message);
boolean isXMLMessage = this.checkMessageIsXml(message);

View File

@ -25,48 +25,22 @@ public class Project implements Serializable {
private String azureDevopsId;
private Boolean repeatable;
private String caseTemplateId;
private String issueTemplateId;
private Boolean customNum;
private Boolean scenarioCustomNum;
private String createUser;
private String systemId;
private Integer mockTcpPort;
private Boolean isMockTcpOpen;
private String azureFilterId;
private String platform;
private Boolean thirdPartTemplate;
private Boolean casePublic;
private String apiQuick;
private Boolean versionEnable;
private Boolean cleanTrackReport;
private String cleanTrackReportExpr;
private Boolean cleanApiReport;
private String cleanApiReportExpr;
private Boolean cleanLoadReport;
private String cleanLoadReportExpr;
private String issueConfig;
private static final long serialVersionUID = 1L;

View File

@ -784,66 +784,6 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andRepeatableIsNull() {
addCriterion("`repeatable` is null");
return (Criteria) this;
}
public Criteria andRepeatableIsNotNull() {
addCriterion("`repeatable` is not null");
return (Criteria) this;
}
public Criteria andRepeatableEqualTo(Boolean value) {
addCriterion("`repeatable` =", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableNotEqualTo(Boolean value) {
addCriterion("`repeatable` <>", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableGreaterThan(Boolean value) {
addCriterion("`repeatable` >", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableGreaterThanOrEqualTo(Boolean value) {
addCriterion("`repeatable` >=", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableLessThan(Boolean value) {
addCriterion("`repeatable` <", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableLessThanOrEqualTo(Boolean value) {
addCriterion("`repeatable` <=", value, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableIn(List<Boolean> values) {
addCriterion("`repeatable` in", values, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableNotIn(List<Boolean> values) {
addCriterion("`repeatable` not in", values, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableBetween(Boolean value1, Boolean value2) {
addCriterion("`repeatable` between", value1, value2, "repeatable");
return (Criteria) this;
}
public Criteria andRepeatableNotBetween(Boolean value1, Boolean value2) {
addCriterion("`repeatable` not between", value1, value2, "repeatable");
return (Criteria) this;
}
public Criteria andCaseTemplateIdIsNull() {
addCriterion("case_template_id is null");
return (Criteria) this;
@ -984,126 +924,6 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andCustomNumIsNull() {
addCriterion("custom_num is null");
return (Criteria) this;
}
public Criteria andCustomNumIsNotNull() {
addCriterion("custom_num is not null");
return (Criteria) this;
}
public Criteria andCustomNumEqualTo(Boolean value) {
addCriterion("custom_num =", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotEqualTo(Boolean value) {
addCriterion("custom_num <>", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThan(Boolean value) {
addCriterion("custom_num >", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThanOrEqualTo(Boolean value) {
addCriterion("custom_num >=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThan(Boolean value) {
addCriterion("custom_num <", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThanOrEqualTo(Boolean value) {
addCriterion("custom_num <=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumIn(List<Boolean> values) {
addCriterion("custom_num in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotIn(List<Boolean> values) {
addCriterion("custom_num not in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumBetween(Boolean value1, Boolean value2) {
addCriterion("custom_num between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotBetween(Boolean value1, Boolean value2) {
addCriterion("custom_num not between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumIsNull() {
addCriterion("scenario_custom_num is null");
return (Criteria) this;
}
public Criteria andScenarioCustomNumIsNotNull() {
addCriterion("scenario_custom_num is not null");
return (Criteria) this;
}
public Criteria andScenarioCustomNumEqualTo(Boolean value) {
addCriterion("scenario_custom_num =", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumNotEqualTo(Boolean value) {
addCriterion("scenario_custom_num <>", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumGreaterThan(Boolean value) {
addCriterion("scenario_custom_num >", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumGreaterThanOrEqualTo(Boolean value) {
addCriterion("scenario_custom_num >=", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumLessThan(Boolean value) {
addCriterion("scenario_custom_num <", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumLessThanOrEqualTo(Boolean value) {
addCriterion("scenario_custom_num <=", value, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumIn(List<Boolean> values) {
addCriterion("scenario_custom_num in", values, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumNotIn(List<Boolean> values) {
addCriterion("scenario_custom_num not in", values, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumBetween(Boolean value1, Boolean value2) {
addCriterion("scenario_custom_num between", value1, value2, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andScenarioCustomNumNotBetween(Boolean value1, Boolean value2) {
addCriterion("scenario_custom_num not between", value1, value2, "scenarioCustomNum");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
@ -1244,126 +1064,6 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andMockTcpPortIsNull() {
addCriterion("mock_tcp_port is null");
return (Criteria) this;
}
public Criteria andMockTcpPortIsNotNull() {
addCriterion("mock_tcp_port is not null");
return (Criteria) this;
}
public Criteria andMockTcpPortEqualTo(Integer value) {
addCriterion("mock_tcp_port =", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortNotEqualTo(Integer value) {
addCriterion("mock_tcp_port <>", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortGreaterThan(Integer value) {
addCriterion("mock_tcp_port >", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortGreaterThanOrEqualTo(Integer value) {
addCriterion("mock_tcp_port >=", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortLessThan(Integer value) {
addCriterion("mock_tcp_port <", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortLessThanOrEqualTo(Integer value) {
addCriterion("mock_tcp_port <=", value, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortIn(List<Integer> values) {
addCriterion("mock_tcp_port in", values, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortNotIn(List<Integer> values) {
addCriterion("mock_tcp_port not in", values, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortBetween(Integer value1, Integer value2) {
addCriterion("mock_tcp_port between", value1, value2, "mockTcpPort");
return (Criteria) this;
}
public Criteria andMockTcpPortNotBetween(Integer value1, Integer value2) {
addCriterion("mock_tcp_port not between", value1, value2, "mockTcpPort");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenIsNull() {
addCriterion("is_mock_tcp_open is null");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenIsNotNull() {
addCriterion("is_mock_tcp_open is not null");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenEqualTo(Boolean value) {
addCriterion("is_mock_tcp_open =", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenNotEqualTo(Boolean value) {
addCriterion("is_mock_tcp_open <>", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenGreaterThan(Boolean value) {
addCriterion("is_mock_tcp_open >", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_mock_tcp_open >=", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenLessThan(Boolean value) {
addCriterion("is_mock_tcp_open <", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenLessThanOrEqualTo(Boolean value) {
addCriterion("is_mock_tcp_open <=", value, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenIn(List<Boolean> values) {
addCriterion("is_mock_tcp_open in", values, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenNotIn(List<Boolean> values) {
addCriterion("is_mock_tcp_open not in", values, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenBetween(Boolean value1, Boolean value2) {
addCriterion("is_mock_tcp_open between", value1, value2, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andIsMockTcpOpenNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_mock_tcp_open not between", value1, value2, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andAzureFilterIdIsNull() {
addCriterion("azure_filter_id is null");
return (Criteria) this;
@ -1564,136 +1264,6 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableIsNull() {
addCriterion("version_enable is null");
return (Criteria) this;
@ -1753,396 +1323,6 @@ public class ProjectExample {
addCriterion("version_enable not between", value1, value2, "versionEnable");
return (Criteria) this;
}
public Criteria andCleanTrackReportIsNull() {
addCriterion("clean_track_report is null");
return (Criteria) this;
}
public Criteria andCleanTrackReportIsNotNull() {
addCriterion("clean_track_report is not null");
return (Criteria) this;
}
public Criteria andCleanTrackReportEqualTo(Boolean value) {
addCriterion("clean_track_report =", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportNotEqualTo(Boolean value) {
addCriterion("clean_track_report <>", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportGreaterThan(Boolean value) {
addCriterion("clean_track_report >", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_track_report >=", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportLessThan(Boolean value) {
addCriterion("clean_track_report <", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_track_report <=", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportIn(List<Boolean> values) {
addCriterion("clean_track_report in", values, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportNotIn(List<Boolean> values) {
addCriterion("clean_track_report not in", values, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_track_report between", value1, value2, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_track_report not between", value1, value2, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprIsNull() {
addCriterion("clean_track_report_expr is null");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprIsNotNull() {
addCriterion("clean_track_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprEqualTo(String value) {
addCriterion("clean_track_report_expr =", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotEqualTo(String value) {
addCriterion("clean_track_report_expr <>", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprGreaterThan(String value) {
addCriterion("clean_track_report_expr >", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_track_report_expr >=", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLessThan(String value) {
addCriterion("clean_track_report_expr <", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_track_report_expr <=", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLike(String value) {
addCriterion("clean_track_report_expr like", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotLike(String value) {
addCriterion("clean_track_report_expr not like", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprIn(List<String> values) {
addCriterion("clean_track_report_expr in", values, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotIn(List<String> values) {
addCriterion("clean_track_report_expr not in", values, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprBetween(String value1, String value2) {
addCriterion("clean_track_report_expr between", value1, value2, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotBetween(String value1, String value2) {
addCriterion("clean_track_report_expr not between", value1, value2, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportIsNull() {
addCriterion("clean_api_report is null");
return (Criteria) this;
}
public Criteria andCleanApiReportIsNotNull() {
addCriterion("clean_api_report is not null");
return (Criteria) this;
}
public Criteria andCleanApiReportEqualTo(Boolean value) {
addCriterion("clean_api_report =", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotEqualTo(Boolean value) {
addCriterion("clean_api_report <>", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportGreaterThan(Boolean value) {
addCriterion("clean_api_report >", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_api_report >=", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportLessThan(Boolean value) {
addCriterion("clean_api_report <", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_api_report <=", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportIn(List<Boolean> values) {
addCriterion("clean_api_report in", values, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotIn(List<Boolean> values) {
addCriterion("clean_api_report not in", values, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_api_report between", value1, value2, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_api_report not between", value1, value2, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIsNull() {
addCriterion("clean_api_report_expr is null");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIsNotNull() {
addCriterion("clean_api_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanApiReportExprEqualTo(String value) {
addCriterion("clean_api_report_expr =", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotEqualTo(String value) {
addCriterion("clean_api_report_expr <>", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprGreaterThan(String value) {
addCriterion("clean_api_report_expr >", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_api_report_expr >=", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLessThan(String value) {
addCriterion("clean_api_report_expr <", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_api_report_expr <=", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLike(String value) {
addCriterion("clean_api_report_expr like", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotLike(String value) {
addCriterion("clean_api_report_expr not like", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIn(List<String> values) {
addCriterion("clean_api_report_expr in", values, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotIn(List<String> values) {
addCriterion("clean_api_report_expr not in", values, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprBetween(String value1, String value2) {
addCriterion("clean_api_report_expr between", value1, value2, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotBetween(String value1, String value2) {
addCriterion("clean_api_report_expr not between", value1, value2, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportIsNull() {
addCriterion("clean_load_report is null");
return (Criteria) this;
}
public Criteria andCleanLoadReportIsNotNull() {
addCriterion("clean_load_report is not null");
return (Criteria) this;
}
public Criteria andCleanLoadReportEqualTo(Boolean value) {
addCriterion("clean_load_report =", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotEqualTo(Boolean value) {
addCriterion("clean_load_report <>", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportGreaterThan(Boolean value) {
addCriterion("clean_load_report >", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_load_report >=", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportLessThan(Boolean value) {
addCriterion("clean_load_report <", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_load_report <=", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportIn(List<Boolean> values) {
addCriterion("clean_load_report in", values, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotIn(List<Boolean> values) {
addCriterion("clean_load_report not in", values, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_load_report between", value1, value2, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_load_report not between", value1, value2, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIsNull() {
addCriterion("clean_load_report_expr is null");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIsNotNull() {
addCriterion("clean_load_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprEqualTo(String value) {
addCriterion("clean_load_report_expr =", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotEqualTo(String value) {
addCriterion("clean_load_report_expr <>", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprGreaterThan(String value) {
addCriterion("clean_load_report_expr >", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_load_report_expr >=", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLessThan(String value) {
addCriterion("clean_load_report_expr <", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_load_report_expr <=", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLike(String value) {
addCriterion("clean_load_report_expr like", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotLike(String value) {
addCriterion("clean_load_report_expr not like", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIn(List<String> values) {
addCriterion("clean_load_report_expr in", values, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotIn(List<String> values) {
addCriterion("clean_load_report_expr not in", values, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprBetween(String value1, String value2) {
addCriterion("clean_load_report_expr between", value1, value2, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotBetween(String value1, String value2) {
addCriterion("clean_load_report_expr not between", value1, value2, "cleanLoadReportExpr");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -12,27 +12,14 @@
<result column="jira_key" jdbcType="VARCHAR" property="jiraKey" />
<result column="zentao_id" jdbcType="VARCHAR" property="zentaoId" />
<result column="azure_devops_id" jdbcType="VARCHAR" property="azureDevopsId" />
<result column="repeatable" jdbcType="BIT" property="repeatable" />
<result column="case_template_id" jdbcType="VARCHAR" property="caseTemplateId" />
<result column="issue_template_id" jdbcType="VARCHAR" property="issueTemplateId" />
<result column="custom_num" jdbcType="BIT" property="customNum" />
<result column="scenario_custom_num" jdbcType="BIT" property="scenarioCustomNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="system_id" jdbcType="VARCHAR" property="systemId" />
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" />
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" />
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
<result column="version_enable" jdbcType="BIT" property="versionEnable" />
<result column="clean_track_report" jdbcType="BIT" property="cleanTrackReport" />
<result column="clean_track_report_expr" jdbcType="VARCHAR" property="cleanTrackReportExpr" />
<result column="clean_api_report" jdbcType="BIT" property="cleanApiReport" />
<result column="clean_api_report_expr" jdbcType="VARCHAR" property="cleanApiReportExpr" />
<result column="clean_load_report" jdbcType="BIT" property="cleanLoadReport" />
<result column="clean_load_report_expr" jdbcType="VARCHAR" property="cleanLoadReportExpr" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Project">
<result column="issue_config" jdbcType="LONGVARCHAR" property="issueConfig" />
@ -97,11 +84,8 @@
</sql>
<sql id="Base_Column_List">
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num,
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id,
platform, third_part_template, case_public, api_quick, version_enable, clean_track_report,
clean_track_report_expr, clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr
zentao_id, azure_devops_id, case_template_id, issue_template_id, create_user, system_id,
azure_filter_id, platform, third_part_template, version_enable
</sql>
<sql id="Blob_Column_List">
issue_config
@ -158,25 +142,17 @@
insert into project (id, workspace_id, `name`,
description, create_time, update_time,
tapd_id, jira_key, zentao_id,
azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port,
is_mock_tcp_open, azure_filter_id, platform,
third_part_template, case_public, api_quick,
version_enable, clean_track_report, clean_track_report_expr,
clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr, issue_config)
azure_devops_id, case_template_id, issue_template_id,
create_user, system_id, azure_filter_id,
platform, third_part_template, version_enable,
issue_config)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
#{thirdPartTemplate,jdbcType=BIT}, #{casePublic,jdbcType=BIT}, #{apiQuick,jdbcType=VARCHAR},
#{versionEnable,jdbcType=BIT}, #{cleanTrackReport,jdbcType=BIT}, #{cleanTrackReportExpr,jdbcType=VARCHAR},
#{cleanApiReport,jdbcType=BIT}, #{cleanApiReportExpr,jdbcType=VARCHAR}, #{cleanLoadReport,jdbcType=BIT},
#{cleanLoadReportExpr,jdbcType=VARCHAR}, #{issueConfig,jdbcType=LONGVARCHAR})
#{azureDevopsId,jdbcType=VARCHAR}, #{caseTemplateId,jdbcType=VARCHAR}, #{issueTemplateId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{azureFilterId,jdbcType=VARCHAR},
#{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT}, #{versionEnable,jdbcType=BIT},
#{issueConfig,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project
@ -211,33 +187,18 @@
<if test="azureDevopsId != null">
azure_devops_id,
</if>
<if test="repeatable != null">
`repeatable`,
</if>
<if test="caseTemplateId != null">
case_template_id,
</if>
<if test="issueTemplateId != null">
issue_template_id,
</if>
<if test="customNum != null">
custom_num,
</if>
<if test="scenarioCustomNum != null">
scenario_custom_num,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="systemId != null">
system_id,
</if>
<if test="mockTcpPort != null">
mock_tcp_port,
</if>
<if test="isMockTcpOpen != null">
is_mock_tcp_open,
</if>
<if test="azureFilterId != null">
azure_filter_id,
</if>
@ -247,33 +208,9 @@
<if test="thirdPartTemplate != null">
third_part_template,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="apiQuick != null">
api_quick,
</if>
<if test="versionEnable != null">
version_enable,
</if>
<if test="cleanTrackReport != null">
clean_track_report,
</if>
<if test="cleanTrackReportExpr != null">
clean_track_report_expr,
</if>
<if test="cleanApiReport != null">
clean_api_report,
</if>
<if test="cleanApiReportExpr != null">
clean_api_report_expr,
</if>
<if test="cleanLoadReport != null">
clean_load_report,
</if>
<if test="cleanLoadReportExpr != null">
clean_load_report_expr,
</if>
<if test="issueConfig != null">
issue_config,
</if>
@ -309,33 +246,18 @@
<if test="azureDevopsId != null">
#{azureDevopsId,jdbcType=VARCHAR},
</if>
<if test="repeatable != null">
#{repeatable,jdbcType=BIT},
</if>
<if test="caseTemplateId != null">
#{caseTemplateId,jdbcType=VARCHAR},
</if>
<if test="issueTemplateId != null">
#{issueTemplateId,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=BIT},
</if>
<if test="scenarioCustomNum != null">
#{scenarioCustomNum,jdbcType=BIT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="systemId != null">
#{systemId,jdbcType=VARCHAR},
</if>
<if test="mockTcpPort != null">
#{mockTcpPort,jdbcType=INTEGER},
</if>
<if test="isMockTcpOpen != null">
#{isMockTcpOpen,jdbcType=BIT},
</if>
<if test="azureFilterId != null">
#{azureFilterId,jdbcType=VARCHAR},
</if>
@ -345,33 +267,9 @@
<if test="thirdPartTemplate != null">
#{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null">
#{versionEnable,jdbcType=BIT},
</if>
<if test="cleanTrackReport != null">
#{cleanTrackReport,jdbcType=BIT},
</if>
<if test="cleanTrackReportExpr != null">
#{cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanApiReport != null">
#{cleanApiReport,jdbcType=BIT},
</if>
<if test="cleanApiReportExpr != null">
#{cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanLoadReport != null">
#{cleanLoadReport,jdbcType=BIT},
</if>
<if test="cleanLoadReportExpr != null">
#{cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
<if test="issueConfig != null">
#{issueConfig,jdbcType=LONGVARCHAR},
</if>
@ -416,33 +314,18 @@
<if test="record.azureDevopsId != null">
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
</if>
<if test="record.repeatable != null">
`repeatable` = #{record.repeatable,jdbcType=BIT},
</if>
<if test="record.caseTemplateId != null">
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
</if>
<if test="record.issueTemplateId != null">
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=BIT},
</if>
<if test="record.scenarioCustomNum != null">
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.systemId != null">
system_id = #{record.systemId,jdbcType=VARCHAR},
</if>
<if test="record.mockTcpPort != null">
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
</if>
<if test="record.isMockTcpOpen != null">
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
</if>
<if test="record.azureFilterId != null">
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
</if>
@ -452,33 +335,9 @@
<if test="record.thirdPartTemplate != null">
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
<if test="record.versionEnable != null">
version_enable = #{record.versionEnable,jdbcType=BIT},
</if>
<if test="record.cleanTrackReport != null">
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
</if>
<if test="record.cleanTrackReportExpr != null">
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="record.cleanApiReport != null">
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
</if>
<if test="record.cleanApiReportExpr != null">
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="record.cleanLoadReport != null">
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
</if>
<if test="record.cleanLoadReportExpr != null">
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
<if test="record.issueConfig != null">
issue_config = #{record.issueConfig,jdbcType=LONGVARCHAR},
</if>
@ -499,27 +358,14 @@
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
zentao_id = #{record.zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{record.repeatable,jdbcType=BIT},
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=BIT},
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT},
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR},
issue_config = #{record.issueConfig,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -537,27 +383,14 @@
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
zentao_id = #{record.zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{record.repeatable,jdbcType=BIT},
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=BIT},
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT},
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR}
version_enable = #{record.versionEnable,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -592,33 +425,18 @@
<if test="azureDevopsId != null">
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
</if>
<if test="repeatable != null">
`repeatable` = #{repeatable,jdbcType=BIT},
</if>
<if test="caseTemplateId != null">
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
</if>
<if test="issueTemplateId != null">
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=BIT},
</if>
<if test="scenarioCustomNum != null">
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="systemId != null">
system_id = #{systemId,jdbcType=VARCHAR},
</if>
<if test="mockTcpPort != null">
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
</if>
<if test="isMockTcpOpen != null">
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
</if>
<if test="azureFilterId != null">
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
</if>
@ -628,33 +446,9 @@
<if test="thirdPartTemplate != null">
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null">
version_enable = #{versionEnable,jdbcType=BIT},
</if>
<if test="cleanTrackReport != null">
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
</if>
<if test="cleanTrackReportExpr != null">
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanApiReport != null">
clean_api_report = #{cleanApiReport,jdbcType=BIT},
</if>
<if test="cleanApiReportExpr != null">
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanLoadReport != null">
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
</if>
<if test="cleanLoadReportExpr != null">
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
<if test="issueConfig != null">
issue_config = #{issueConfig,jdbcType=LONGVARCHAR},
</if>
@ -672,27 +466,14 @@
jira_key = #{jiraKey,jdbcType=VARCHAR},
zentao_id = #{zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{repeatable,jdbcType=BIT},
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=BIT},
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT},
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR},
issue_config = #{issueConfig,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -707,27 +488,14 @@
jira_key = #{jiraKey,jdbcType=VARCHAR},
zentao_id = #{zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{repeatable,jdbcType=BIT},
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=BIT},
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT},
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR}
version_enable = #{versionEnable,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -28,8 +28,6 @@ public interface ExtProjectMapper {
@MapKey("id")
Map<String, Project> queryNameByIds(@Param("ids") List<String> ids);
List<Integer> selectTcpPorts();
Project selectProjectByResourceId(@Param("resourceId") String resourceId);
long getProjectMemberSize(@Param("projectId") String projectId);

View File

@ -46,14 +46,10 @@
p.jira_key,
p.zentao_id,
p.azure_devops_id,
p.repeatable,
p.custom_num,
p.azure_filter_id,
user.name AS createUserName,
p.mock_tcp_port AS mockTcpPort,
p.is_mock_tcp_open AS isMockTcpOpen,
p.scenario_custom_num,
p.platform, p.third_part_template,
p.platform,
p.third_part_template,
p.issue_config
FROM project p
JOIN workspace w ON p.workspace_id = w.id
@ -144,7 +140,7 @@
FROM project
</select>
<select id="queryNameByIds" resultType="io.metersphere.base.domain.Project">
SELECT id, name, custom_num
SELECT id, name
FROM project
WHERE id IN
<foreach collection="ids" item="id" index="index"
@ -178,13 +174,6 @@
WHERE workspace_id = #{workspaceId}) AS a)
</update>
<select id="selectTcpPorts" resultType="java.lang.Integer">
SELECT mock_tcp_port
FROM project
WHERE mock_tcp_port IS NOT NULL
AND mock_tcp_port != 0
</select>
<select id="selectProjectByResourceId" resultType="io.metersphere.base.domain.Project">
SELECT *
FROM project

View File

@ -1,7 +1,71 @@
package io.metersphere.commons.constants;
/**
* 项目配置
*/
public enum ProjectApplicationType {
/**
* 测试计划报告分享链接有效期
*/
TRACK_SHARE_REPORT_TIME,
/**
* 性能测试报告分享链接有效期
*/
PERFORMANCE_SHARE_REPORT_TIME,
/**
* 是否开启测试用例自定义ID
*/
CASE_CUSTOM_NUM,
/**
* 场景自定义ID
*/
SCENARIO_CUSTOM_NUM,
/**
* 接口定义快捷添加按钮
*/
API_QUICK_MENU,
/**
*接口定义URL可重复
*/
URL_REPEATABLE,
/**
* 公共用例库
*/
CASE_PUBLIC,
/**
* MOCK使用端口
*/
MOCK_TCP_PORT,
/**
* MOCk是否开启
*/
MOCK_TCP_OPEN,
/**
* 是否开启定时清理测试计划报告
*/
CLEAN_TRACK_REPORT,
/**
* 清理时间配置 (Y|M|D)
*/
CLEAN_TRACK_REPORT_EXPR,
/**
* 是否开启定时清理接口测试报告
*/
CLEAN_API_REPORT,
/**
* 清理时间配置 (Y|M|D)
*/
CLEAN_API_REPORT_EXPR,
/**
* 是否开启定时清理接口测试报告
*/
CLEAN_LOAD_REPORT,
/**
* 清理时间配置 (Y|M|D)
*/
CLEAN_LOAD_REPORT_EXPR,
/**
* 接口分享链接有效期
*/
API_SHARE_REPORT_TIME
}

View File

@ -3,6 +3,8 @@ package io.metersphere.controller;
import io.metersphere.base.domain.ProjectApplication;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.controller.request.ProjectApplicationRequest;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.ProjectApplicationService;
import org.springframework.web.bind.annotation.*;
@ -21,8 +23,24 @@ public class ProjectApplicationController {
projectApplicationService.updateProjectApplication(projectApplication);
}
@PostMapping("/update/batch")
@MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#projectApplication)", content = "#msClass.getLogDetails(#projectApplication)", msClass = ProjectApplicationService.class)
public void updateProjectConfigBatch(@RequestBody ProjectApplicationRequest request) {
projectApplicationService.updateProjectConfigBatch(request);
}
@GetMapping("/get/{projectId}/{type}")
public ProjectApplication getProjectApplication(@PathVariable String projectId,@PathVariable String type) {
return projectApplicationService.getProjectApplication(projectId,type);
}
@GetMapping("/get/config/{projectId}")
public ProjectConfig getProjectConfig(@PathVariable String projectId) {
return projectApplicationService.getProjectConfig(projectId);
}
@GetMapping("/get/config/{projectId}/{type}")
public ProjectConfig getProjectConfigByType(@PathVariable String projectId, @PathVariable String type) {
return projectApplicationService.getSpecificTypeValue(projectId, type);
}
}

View File

@ -105,7 +105,7 @@ public class ProjectController {
@PostMapping("/update")
@MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = ProjectService.class)
public void updateProject(@RequestBody Project Project) {
public void updateProject(@RequestBody AddProjectRequest Project) {
projectService.updateProject(Project);
}

View File

@ -8,4 +8,17 @@ import lombok.Setter;
@Setter
public class AddProjectRequest extends Project {
private String protocal;
private Boolean customNum;
private Boolean scenarioCustomNum;
private Integer mockTcpPort;
private Boolean isMockTcpOpen;
private Boolean casePublic;
private String apiQuick;
private Boolean cleanTrackReport;
private String cleanTrackReportExpr;
private Boolean cleanApiReport;
private String cleanApiReportExpr;
private Boolean cleanLoadReport;
private String cleanLoadReportExpr;
}

View File

@ -0,0 +1,11 @@
package io.metersphere.controller.request;
import io.metersphere.base.domain.ProjectApplication;
import lombok.Data;
import java.util.List;
@Data
public class ProjectApplicationRequest {
private List<ProjectApplication> configs;
}

View File

@ -0,0 +1,28 @@
package io.metersphere.dto;
import lombok.Data;
/**
* 添加新属性需与ProjectApplicationType保持一致
*/
@Data
public class ProjectConfig {
private String trackShareReportTime;
private String performanceShareReportTime;
private String apiShareReportTime;
private Boolean caseCustomNum = false;
private Boolean scenarioCustomNum = false;
private String apiQuickMenu;
private Boolean casePublic = false;
private Integer mockTcpPort = 0;
private Boolean mockTcpOpen = false;
private Boolean cleanTrackReport = false;
private String cleanTrackReportExpr;
private Boolean cleanApiReport = false;
private String cleanApiReportExpr;
private Boolean cleanLoadReport = false;
private String cleanLoadReportExpr;
private Boolean urlRepeatable = false;
}

View File

@ -5,6 +5,8 @@ import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@ -20,6 +22,7 @@ import java.time.ZoneId;
public class CleanUpReportJob extends MsScheduleJob {
private final ProjectService projectService;
private final ProjectApplicationService projectApplicationService;
private static final String UNIT_DAY = "D";
private static final String UNIT_MONTH = "M";
private static final String UNIT_YEAR = "Y";
@ -27,6 +30,7 @@ public class CleanUpReportJob extends MsScheduleJob {
public CleanUpReportJob() {
projectService = CommonBeanFactory.getBean(ProjectService.class);
projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
localDate = LocalDate.now();
}
@ -34,18 +38,20 @@ public class CleanUpReportJob extends MsScheduleJob {
void businessExecute(JobExecutionContext context) {
LogUtil.info("clean up report start.");
Project project = projectService.getProjectById(resourceId);
Boolean cleanTrackReport = project.getCleanTrackReport();
Boolean cleanApiReport = project.getCleanApiReport();
Boolean cleanLoadReport = project.getCleanLoadReport();
if (project == null) {
return;
}
ProjectConfig config = projectApplicationService.getProjectConfig(project.getId());
try {
if (BooleanUtils.isTrue(cleanTrackReport)) {
this.cleanUpTrackReport(project.getCleanTrackReportExpr());
if (BooleanUtils.isTrue(config.getCleanTrackReport())) {
this.cleanUpTrackReport(config.getCleanTrackReportExpr());
}
if (BooleanUtils.isTrue(cleanApiReport)) {
this.cleanUpApiReport(project.getCleanApiReportExpr());
if (BooleanUtils.isTrue(config.getCleanApiReport())) {
this.cleanUpApiReport(config.getCleanApiReportExpr());
}
if (BooleanUtils.isTrue(cleanLoadReport)) {
this.cleanUpLoadReport(project.getCleanLoadReportExpr());
if (BooleanUtils.isTrue(config.getCleanLoadReport())) {
this.cleanUpLoadReport(config.getCleanLoadReportExpr());
}
} catch (Exception e) {
LogUtil.error("clean up report error.");

View File

@ -1,18 +1,34 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import com.google.common.base.CaseFormat;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ProjectApplicationMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.AddProjectRequest;
import io.metersphere.controller.request.ProjectApplicationRequest;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.track.service.TestCaseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
@ -21,14 +37,99 @@ import java.util.Objects;
public class ProjectApplicationService {
@Resource
private ProjectApplicationMapper projectApplicationMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private TestCaseService testCaseService;
@Lazy
@Resource
private ProjectService projectService;
public void updateProjectApplication(ProjectApplication projectApplication){
ProjectApplicationExample projectApplicationExample = new ProjectApplicationExample();
projectApplicationExample.createCriteria().andProjectIdEqualTo(projectApplication.getProjectId()).andTypeEqualTo(projectApplication.getType());
projectApplicationMapper.updateByExample(projectApplication,projectApplicationExample);
this.doBeforeUpdate(projectApplication);
this.createOrUpdateConfig(projectApplication);
}
private void doBeforeUpdate(ProjectApplication projectApplication) {
String type = projectApplication.getType();
String value = projectApplication.getTypeValue();
String projectId = projectApplication.getProjectId();
if (StringUtils.equals(type, ProjectApplicationType.CASE_CUSTOM_NUM.name())
&& BooleanUtils.isTrue(Boolean.parseBoolean(value))) {
testCaseService.updateTestCaseCustomNumByProjectId(projectId);
} else if (StringUtils.equals(type, ProjectApplicationType.MOCK_TCP_PORT.name())) {
this.doHandleMockTcp(projectId, value);
} else if (StringUtils.equals(type, ProjectApplicationType.CLEAN_TRACK_REPORT.name())
|| StringUtils.equals(type, ProjectApplicationType.CLEAN_API_REPORT.name())
|| StringUtils.equals(type, ProjectApplicationType.CLEAN_LOAD_REPORT.name())) {
this.doHandleCleanUp(projectId, type, value);
}
}
private void doHandleCleanUp(String projectId, String type, String value) {
AddProjectRequest request = new AddProjectRequest();
request.setId(projectId);
Boolean cleanUp = Boolean.valueOf(value);
if (BooleanUtils.isTrue(cleanUp)) {
request.setCleanTrackReport(cleanUp);
} else {
ProjectConfig config = getProjectConfig(projectId);
if (StringUtils.equals(type, ProjectApplicationType.CLEAN_TRACK_REPORT.name())) {
config.setCleanTrackReport(cleanUp);
} else if (StringUtils.equals(type, ProjectApplicationType.CLEAN_API_REPORT.name())) {
config.setCleanApiReport(cleanUp);
} else if (StringUtils.equals(type, ProjectApplicationType.CLEAN_LOAD_REPORT.name())) {
config.setCleanLoadReport(cleanUp);
}
// 根据这三个状态判断定时清理任务是否开启
request.setCleanTrackReport(config.getCleanTrackReport());
request.setCleanApiReport(config.getCleanApiReport());
request.setCleanLoadReport(config.getCleanLoadReport());
}
projectService.addOrUpdateCleanUpSchedule(request);
}
private void doHandleMockTcp(String projectId, String value) {
int lastTcpNum = 0;
ProjectConfig config = getSpecificTypeValue(projectId, ProjectApplicationType.MOCK_TCP_PORT.name());
Integer oldPort = config.getMockTcpPort();
if (oldPort != null) {
lastTcpNum = oldPort;
}
int port;
try {
port = Integer.parseInt(value);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
LogUtil.error("update project config parse mock port error.");
port = 0;
}
if (port > 0) {
projectService.checkMockTcpPort(port);
}
AddProjectRequest project = new AddProjectRequest();
project.setMockTcpPort(port);
project.setId(projectId);
projectService.checkProjectTcpPort(project);
//检查Mock环境是否需要同步更新
ApiTestEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
if (apiTestEnvironmentService != null) {
apiTestEnvironmentService.getMockEnvironmentByProjectId(projectId);
}
if (BooleanUtils.isTrue(Boolean.parseBoolean(value))) {
projectService.reloadMockTcp(project, lastTcpNum);
} else {
projectService.closeMockTcp(project);
}
}
public void updateProjectApplication(String projectId, String type, String value) {
ProjectApplication application = new ProjectApplication();
application.setProjectId(projectId);
application.setType(type);
application.setTypeValue(value);
this.updateProjectApplication(application);
}
public String getLogDetails(ProjectApplication projectApplication) {
@ -55,4 +156,147 @@ public class ProjectApplicationService {
}
return projectApplications.get(0);
}
public HashMap<String, String> getProjectConfigMap(String projectId) {
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId);
List<ProjectApplication> applications = projectApplicationMapper.selectByExample(example);
return applications.stream().collect(HashMap::new, (k, v) -> k.put(v.getType(), v.getTypeValue()), HashMap::putAll);
}
public void createOrUpdateConfig(String projectId, String type, String value) {
ProjectApplication conf = new ProjectApplication();
conf.setProjectId(projectId);
conf.setType(type);
conf.setTypeValue(value);
this.createOrUpdateConfig(conf);
}
public void createOrUpdateConfig(ProjectApplication conf) {
String projectId = conf.getProjectId();
String type = conf.getType();
String value = conf.getTypeValue();
if (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value)) {
LogUtil.error("create or update project config error. project id or conf type or value is blank.");
return;
}
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type);
if (projectApplicationMapper.countByExample(example) > 0) {
example.clear();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type);
projectApplicationMapper.updateByExample(conf, example);
return;
}
projectApplicationMapper.insertSelective(conf);
}
/**
* 返回指定项目下某配置的值
* @param projectId 指定项目ID
* @param type ProjectApplicationType中某项目配置
* @return 如果有该配置返回字符串类型否则返回NULL
*/
public String getTypeValue(String projectId, String type) {
ProjectApplication application = this.getProjectApplication(projectId, type);
if (application != null && StringUtils.isEmpty(application.getTypeValue())) {
return application.getTypeValue();
}
return null;
}
public List<ProjectApplication> selectByExample(ProjectApplicationExample example) {
return projectApplicationMapper.selectByExample(example);
}
/**
* 获取指定项目下的所有应用配置选项组成的对象
* @param projectId 项目ID
* @return 项目配置对象ProjectConfig
*/
public ProjectConfig getProjectConfig(String projectId) {
ProjectApplicationExample projectApplicationExample = new ProjectApplicationExample();
projectApplicationExample.createCriteria().andProjectIdEqualTo(projectId);
List<ProjectApplication> applications = projectApplicationMapper.selectByExample(projectApplicationExample);
return assignConfigValue(applications);
}
private ProjectConfig assignConfigValue(List<ProjectApplication> applications) {
ProjectConfig config = new ProjectConfig();
Class<? extends ProjectConfig> clazz = config.getClass();
Field[] fields = clazz.getDeclaredFields();
HashMap<String, String> map = applications.stream()
.collect(HashMap::new, (k, v) -> k.put(v.getType(), v.getTypeValue()), HashMap::putAll);
for (Field field : fields) {
try {
field.setAccessible(true);
String name = field.getName();
String str = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name);
Method method = config.getClass().getMethod("set" + StringUtils.capitalize(name), field.getType());
if (StringUtils.isNotBlank(map.get(str))) {
method.invoke(config, valueOf(field.getType(), map.get(str)));
}
} catch (Exception e) {
LogUtil.error("get project config error.");
LogUtil.error(e.getMessage(), e);
}
}
return config;
}
/**
* 返回指定项目下某配置的值
* @param projectId 项目ID
* @param type ProjectApplicationType中某项目配置
* @return ProjectConfig
*/
public ProjectConfig getSpecificTypeValue(String projectId, String type) {
ProjectApplication application = this.getProjectApplication(projectId, type);
ProjectConfig config = new ProjectConfig();
Class<? extends ProjectConfig> clazz = config.getClass();
Field field = null;
try {
field = clazz.getDeclaredField(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, type));
try {
field.setAccessible(true);
String name = field.getName();
Method method = config.getClass().getMethod("set" + StringUtils.capitalize(name), field.getType());
if (StringUtils.isNotBlank(application.getTypeValue())) {
method.invoke(config, valueOf(field.getType(), application.getTypeValue()));
}
} catch (Exception e) {
LogUtil.error("get project config error.");
LogUtil.error(e.getMessage(), e);
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
return config;
}
return config;
}
private Object valueOf(Class<?> type, String value) {
//todo 其他类型
if (type == Boolean.class) {
return Boolean.valueOf(value);
} else if (type == Integer.class) {
try {
return Integer.valueOf(value);
} catch (Exception e) {
return 0;
}
}
return value;
}
public void updateProjectConfigBatch(ProjectApplicationRequest request) {
List<ProjectApplication> applications = request.getConfigs();
if (CollectionUtils.isNotEmpty(applications)) {
for (ProjectApplication application : applications) {
this.updateProjectApplication(application);
}
}
}
}

View File

@ -20,8 +20,10 @@ import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.AddProjectRequest;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.dto.ProjectDTO;
import io.metersphere.dto.WorkspaceMemberDTO;
import io.metersphere.i18n.Translator;
@ -107,9 +109,11 @@ public class ProjectService {
private ApiScenarioReportService apiScenarioReportService;
@Resource
private ProjectApplicationMapper projectApplicationMapper;
@Resource
private ProjectApplicationService projectApplicationService;
public Project addProject(Project project) {
public Project addProject(AddProjectRequest project) {
if (StringUtils.isBlank(project.getName())) {
MSException.throwException(Translator.get("project_name_is_null"));
}
@ -285,6 +289,7 @@ public class ProjectService {
/**
* 把原来为系统模板的项目模板设置成新的模板
* 只设置改工作空间下的
*
* @param originId
* @param templateId
* @param workspaceId
@ -319,10 +324,10 @@ public class ProjectService {
}
});
//删除分享报告时间
delReportTime(projectId,"PERFORMANCE");
delReportTime(projectId, "PERFORMANCE");
}
private void delReportTime(String projectId,String type) {
private void delReportTime(String projectId, String type) {
ProjectApplicationExample projectApplicationExample = new ProjectApplicationExample();
projectApplicationExample.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type);
projectApplicationMapper.deleteByExample(projectApplicationExample);
@ -337,7 +342,7 @@ public class ProjectService {
}
testCaseService.deleteTestCaseByProjectId(projectId);
//删除分享报告时间
delReportTime(projectId,"TRACK");
delReportTime(projectId, "TRACK");
}
private void deleteAPIResourceByProjectId(String projectId) {
@ -351,47 +356,15 @@ public class ProjectService {
});
}
public void updateProject(Project project) {
//查询之前的TCP端口用于检查是否需要开启/关闭 TCP接口
int lastTcpNum = 0;
Project oldData = projectMapper.selectByPrimaryKey(project.getId());
if (oldData != null && oldData.getMockTcpPort() != null) {
lastTcpNum = oldData.getMockTcpPort().intValue();
}
if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() > 0) {
this.checkMockTcpPort(project.getMockTcpPort().intValue());
}
this.checkProjectTcpPort(project);
public void updateProject(AddProjectRequest project) {
project.setCreateTime(null);
project.setCreateUser(null);
project.setUpdateTime(System.currentTimeMillis());
checkProjectExist(project);
if (BooleanUtils.isTrue(project.getCustomNum())) {
testCaseService.updateTestCaseCustomNumByProjectId(project.getId());
}
projectMapper.updateByPrimaryKeySelective(project);
addOrUpdateCleanUpSchedule(project);
//检查Mock环境是否需要同步更新
ApiTestEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
apiTestEnvironmentService.getMockEnvironmentByProjectId(project.getId());
//开启tcp mock
if (project.getIsMockTcpOpen()) {
if (project.getMockTcpPort() != null) {
this.reloadMockTcp(project, lastTcpNum);
}
} else {
this.closeMockTcp(project);
}
}
public void addOrUpdateCleanUpSchedule(Project project) {
public void addOrUpdateCleanUpSchedule(AddProjectRequest project) {
Boolean cleanTrackReport = project.getCleanTrackReport();
Boolean cleanApiReport = project.getCleanApiReport();
Boolean cleanLoadReport = project.getCleanLoadReport();
@ -462,7 +435,7 @@ public class ProjectService {
return inRange;
}
private void checkMockTcpPort(int port) {
public void checkMockTcpPort(int port) {
if (StringUtils.isNotEmpty(this.tcpMockPorts)) {
try {
if (this.tcpMockPorts.contains("-")) {
@ -495,14 +468,15 @@ public class ProjectService {
}
}
private void checkProjectTcpPort(Project project) {
public void checkProjectTcpPort(AddProjectRequest project) {
//判断端口是否重复
if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) {
String projectId = StringUtils.isEmpty(project.getId()) ? "" : project.getId();
ProjectExample example = new ProjectExample();
example.createCriteria().andMockTcpPortEqualTo(project.getMockTcpPort()).andIdNotEqualTo(projectId);
long countResult = projectMapper.countByExample(example);
if (countResult > 0) {
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name())
.andTypeValueEqualTo(String.valueOf(project.getMockTcpPort()))
.andProjectIdNotEqualTo(projectId);
if (projectApplicationMapper.countByExample(example) > 0) {
MSException.throwException("TCP Port is not unique");
}
}
@ -538,7 +512,7 @@ public class ProjectService {
public Project getProjectById(String id) {
Project project = projectMapper.selectByPrimaryKey(id);
if(project != null){
if (project != null) {
String createUser = project.getCreateUser();
if (StringUtils.isNotBlank(createUser)) {
User user = userMapper.selectByPrimaryKey(createUser);
@ -566,7 +540,8 @@ public class ProjectService {
public boolean useCustomNum(Project project) {
if (project != null) {
Boolean customNum = project.getCustomNum();
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
Boolean customNum = config.getCaseCustomNum();
// 未开启自定义ID
if (!customNum) {
return false;
@ -750,10 +725,12 @@ public class ProjectService {
if (project == null) {
MSException.throwException("Project not found!");
} else {
if (project.getMockTcpPort() == null) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPort = config.getMockTcpPort();
if (mockPort == null || mockPort != 0) {
MSException.throwException("Mock tcp port is not Found!");
} else {
TCPPool.createTcp(project.getMockTcpPort());
TCPPool.createTcp(mockPort);
}
}
}
@ -772,10 +749,12 @@ public class ProjectService {
if (project == null) {
MSException.throwException("Project not found!");
} else {
if (project.getMockTcpPort() == null) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPort = config.getMockTcpPort();
if (mockPort == null || mockPort != 0) {
MSException.throwException("Mock tcp port is not Found!");
} else {
this.closeMockTcp(project.getMockTcpPort().intValue());
this.closeMockTcp(mockPort);
}
}
}
@ -791,24 +770,28 @@ public class ProjectService {
*/
public void initMockTcpService() {
try {
ProjectExample example = new ProjectExample();
Integer portInteger = new Integer(0);
Boolean statusBoolean = new Boolean(true);
example.createCriteria().andIsMockTcpOpenEqualTo(statusBoolean).andMockTcpPortNotEqualTo(portInteger);
List<Project> projectList = projectMapper.selectByExample(example);
List<Integer> opendPortList = new ArrayList<>();
for (Project p : projectList) {
boolean isPortInRange = this.isMockTcpPortIsInRange(p.getMockTcpPort());
if (isPortInRange && !opendPortList.contains(p.getMockTcpPort())) {
opendPortList.add(p.getMockTcpPort());
this.openMockTcp(p);
ProjectApplicationExample pae = new ProjectApplicationExample();
pae.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_OPEN.name())
.andTypeValueEqualTo(String.valueOf(true));
pae.or().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name())
.andTypeValueEqualTo(String.valueOf(0));
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(pae);
List<String> projectIds = projectApplications.stream().map(ProjectApplication::getProjectId).collect(Collectors.toList());
List<Integer> openedPortList = new ArrayList<>();
for (String projectId : projectIds) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(projectId, ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPort = config.getMockTcpPort();
boolean isPortInRange = this.isMockTcpPortIsInRange(mockPort);
if (isPortInRange && !openedPortList.contains(mockPort)) {
openedPortList.add(mockPort);
Project project = new Project();
project.setId(projectId);
this.openMockTcp(project);
} else {
if (opendPortList.contains(p.getMockTcpPort())) {
p.setMockTcpPort(0);
if (openedPortList.contains(mockPort)) {
projectApplicationService.createOrUpdateConfig(projectId, ProjectApplicationType.MOCK_TCP_PORT.name(), String.valueOf(mockPort));
}
p.setIsMockTcpOpen(false);
projectMapper.updateByPrimaryKeySelective(p);
projectApplicationService.createOrUpdateConfig(projectId, ProjectApplicationType.MOCK_TCP_OPEN.name(), String.valueOf(false));
}
}
} catch (Exception e) {
@ -819,14 +802,32 @@ public class ProjectService {
public String genTcpMockPort(String id) {
int returnPort = 0;
Project project = projectMapper.selectByPrimaryKey(id);
if (project != null && project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) {
if (this.isMockTcpPortIsInRange(project.getMockTcpPort().intValue())) {
returnPort = project.getMockTcpPort();
ProjectConfig config = projectApplicationService.getSpecificTypeValue(id, ProjectApplicationType.MOCK_TCP_PORT.name());
Integer mockPort = config.getMockTcpPort();
if (project != null && mockPort != 0) {
if (this.isMockTcpPortIsInRange(mockPort)) {
returnPort = mockPort;
}
} else {
if (StringUtils.isNotEmpty(this.tcpMockPorts)) {
List<Integer> portInRange = new ArrayList<>();
List<Integer> tcpPortInDataBase = extProjectMapper.selectTcpPorts();
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name());
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
List<Integer> tcpPortInDataBase = projectApplications.stream()
.map(pa -> {
String value = pa.getTypeValue();
int p = 0;
try {
p = Integer.parseInt(value);
} catch (Exception e) {
}
return p;
})
.distinct()
.collect(Collectors.toList());
tcpPortInDataBase.remove(new Integer(0));
for (Integer port : tcpPortInDataBase) {
if (this.isMockTcpPortIsInRange(port)) {
portInRange.add(port);
@ -903,10 +904,12 @@ public class ProjectService {
public void checkProjectIsRepeatable(String projectId) {
Project project = this.getProjectById(projectId);
if(project == null){
if (project == null) {
MSException.throwException(Translator.get("cannot_find_project"));
}else {
if(!project.getRepeatable()){
} else {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.URL_REPEATABLE.name());
boolean urlRepeat = config.getUrlRepeatable();
if (!urlRepeat) {
MSException.throwException(Translator.get("project_repeatable_is_false"));
}
}

View File

@ -20,6 +20,7 @@ import io.metersphere.base.mapper.ext.ExtIssuesMapper;
import io.metersphere.base.mapper.ext.ExtProjectVersionMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.constants.IssueRefType;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.exception.MSException;
@ -157,6 +158,9 @@ public class TestCaseService {
private ExtProjectVersionMapper extProjectVersionMapper;
@Resource
private ProjectVersionMapper projectVersionMapper;
@Lazy
@Resource
private ProjectApplicationService projectApplicationService;
private ThreadLocal<Integer> importCreateNum = new ThreadLocal<>();
private ThreadLocal<Integer> beforeImportCreateNum = new ThreadLocal<>();
@ -234,7 +238,8 @@ public class TestCaseService {
String projectId = testCase.getProjectId();
Project project = projectService.getProjectById(projectId);
if (project != null) {
Boolean customNum = project.getCustomNum();
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
boolean customNum = config.getCaseCustomNum();
// 未开启自定义ID
if (!customNum) {
testCase.setCustomNum(null);
@ -909,7 +914,8 @@ public class TestCaseService {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
Project project = projectService.getProjectById(projectId);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
boolean customNum = config.getCaseCustomNum();
try {
if (!testCases.isEmpty()) {
Integer num = importCreateNum.get();
@ -934,7 +940,7 @@ public class TestCaseService {
}
testCase.setNodeId(nodePathMap.get(testCase.getNodePath()));
testCase.setNum(num);
if (project.getCustomNum() && StringUtils.isBlank(testCase.getCustomNum())) {
if (customNum && StringUtils.isBlank(testCase.getCustomNum())) {
testCase.setCustomNum(String.valueOf(num));
}
num++;

View File

@ -16,6 +16,7 @@ import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.ExecuteResult;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.PageUtils;
@ -24,8 +25,10 @@ import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.TestPlanUtils;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.dto.MsExecResponseDTO;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.dto.RunModeConfigDTO;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import io.metersphere.track.dto.*;
import io.metersphere.track.request.testcase.TestPlanScenarioCaseBatchRequest;
@ -68,6 +71,8 @@ public class TestPlanScenarioCaseService {
@Resource
@Lazy
private TestPlanService testPlanService;
@Resource
private ProjectApplicationService projectApplicationService;
public List<ApiScenarioDTO> list(TestPlanScenarioRequest request) {
request.setProjectId(null);
@ -92,7 +97,9 @@ public class TestPlanScenarioCaseService {
apiTestCases.forEach(item -> {
Project project = projectMap.get(item.getProjectId());
if (project != null && project.getScenarioCustomNum() != null && project.getScenarioCustomNum()) {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.SCENARIO_CUSTOM_NUM.name());
boolean custom = config.getCaseCustomNum();
if (project != null && custom) {
item.setCustomNum(item.getCustomNum());
} else {
item.setCustomNum(item.getNum().toString());

View File

@ -6,14 +6,17 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.IssueRefType;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.*;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
@ -68,6 +71,8 @@ public class TestPlanTestCaseService {
private TestCaseService testCaseService;
@Resource
private TestCaseIssueService testCaseIssueService;
@Resource
private ProjectApplicationService projectApplicationService;
public List<TestPlanTestCaseWithBLOBs> listAll() {
TestPlanTestCaseExample example = new TestPlanTestCaseExample();
@ -417,7 +422,9 @@ public class TestPlanTestCaseService {
cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList()));
cases.forEach(item -> {
item.setProjectName(projectMap.get(item.getProjectId()).getName());
item.setIsCustomNum(projectMap.get(item.getProjectId()).getCustomNum());
ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
boolean customNum = config.getCaseCustomNum();
item.setIsCustomNum(customNum);
item.setExecutorName(userNameMap.get(item.getExecutor()));
});
return cases;

View File

@ -535,3 +535,82 @@ VALUES (UUID(), 'project_admin', 'PROJECT_TEMPLATE:READ+ISSUE_TEMPLATE', 'PROJEC
-- project config
insert into project_application(project_id, type, type_value)
select id, 'CASE_CUSTOM_NUM', if(custom_num, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'CASE_CUSTOM_NUM');
insert into project_application(project_id, type, type_value)
select id, 'SCENARIO_CUSTOM_NUM', if(scenario_custom_num, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'SCENARIO_CUSTOM_NUM');
insert into project_application(project_id, type, type_value)
select id, 'API_QUICK_MENU', api_quick
from project
where api_quick is not null
and not exists(select * from project_application where project_id = id and type = 'API_QUICK_MENU');
insert into project_application(project_id, type, type_value)
select id, 'CASE_PUBLIC', if(case_public, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'CASE_PUBLIC');
insert into project_application(project_id, type, type_value)
select id, 'MOCK_TCP_PORT', mock_tcp_port
from project
where project.mock_tcp_port is not null
and not exists(select * from project_application where project_id = id and type = 'MOCK_TCP_PORT');
insert into project_application(project_id, type, type_value)
select id, 'MOCK_TCP_OPEN', if(is_mock_tcp_open, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'MOCK_TCP_OPEN');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_TRACK_REPORT', if(clean_api_report, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'CLEAN_TRACK_REPORT');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_TRACK_REPORT_EXPR', clean_track_report_expr
from project
where clean_track_report_expr is not null
and not exists(select * from project_application where project_id = id and type = 'CLEAN_TRACK_REPORT_EXPR');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_API_REPORT', if(clean_api_report, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'CLEAN_API_REPORT');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_API_REPORT_EXPR', clean_api_report_expr
from project
where clean_api_report_expr is not null
and not exists(select * from project_application where project_id = id and type = 'CLEAN_API_REPORT_EXPR');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_LOAD_REPORT', if(clean_load_report, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'CLEAN_LOAD_REPORT');
insert into project_application(project_id, type, type_value)
select id, 'CLEAN_LOAD_REPORT_EXPR', clean_load_report_expr
from project
where clean_load_report_expr is not null
and not exists(select * from project_application where project_id = id and type = 'CLEAN_LOAD_REPORT_EXPR');
insert into project_application(project_id, type, type_value)
select id, 'URL_REPEATABLE', if(repeatable, 'true', 'false')
from project
where not exists(select * from project_application where project_id = id and type = 'URL_REPEATABLE');

View File

@ -71,7 +71,21 @@
<!--<table tableName="test_plan"/>-->
<!--<table tableName="api_scenario_report"/>-->
<!--<table tableName="test_case_review"/>-->
<table tableName="project_application"/>
<table tableName="project">
<ignoreColumn column="custom_num"/>
<ignoreColumn column="scenario_custom_num"/>
<ignoreColumn column="mock_tcp_port"/>
<ignoreColumn column="is_mock_tcp_open"/>
<ignoreColumn column="api_quick"/>
<ignoreColumn column="case_public"/>
<ignoreColumn column="clean_track_report"/>
<ignoreColumn column="clean_track_report_expr"/>
<ignoreColumn column="clean_api_report"/>
<ignoreColumn column="clean_api_report_expr"/>
<ignoreColumn column="clean_load_report"/>
<ignoreColumn column="clean_load_report_expr"/>
<ignoreColumn column="repeatable"/>
</table>
<!--<table tableName="enterprise_test_report_send_record"/>-->
<!--<table tableName="test_case_review_api_case"/>
<table tableName="test_case_review_load"/>

View File

@ -564,7 +564,7 @@ export default {
});
},
getProject() {
this.$get("/project/get/" + this.projectId, result => {
this.$get('/project_application/get/config/' + this.projectId + "/SCENARIO_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;

View File

@ -94,7 +94,7 @@ export default {
projectId(val) {
this.$refs.nodeTree.list(this.projectId);
if (val) {
this.$get("/project/get/" + val, result => {
this.$get('/project_application/get/config/' + val + "/SCENARIO_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;

View File

@ -487,9 +487,9 @@ export default {
},
addTab(tab) {
if (tab.name === 'add') {
this.result = this.$get('/project/get/' + this.projectId, res => {
this.result = this.$get('/project_application/get/config/' + this.projectId +"/API_QUICK_MENU", res => {
let projectData = res.data;
if (projectData && projectData.apiQuick === 'api') {
if (projectData && projectData.apiQuickMenu === 'api') {
this.handleTabAdd("ADD");
} else {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");

View File

@ -16,20 +16,26 @@
<app-manage-item :title="$t('project.public')" :description="$t('project.public_info')"
v-if="isXpack">
<template #append>
<el-switch v-model="form.casePublic" @change="chooseChange"></el-switch>
<el-switch v-model="config.casePublic" @change="switchChange('CASE_PUBLIC', $event)"></el-switch>
</template>
</app-manage-item>
<app-manage-item :title="$t('project.test_case_custom_id')"
:description="$t('project.test_case_custom_id_info')">
<template #append>
<el-switch v-model="form.customNum" @change="chooseChange"></el-switch>
<el-switch v-model="config.caseCustomNum"
@change="switchChange('CASE_CUSTOM_NUM', $event)"></el-switch>
</template>
</app-manage-item>
<timing-item ref="trackTimingItem" :choose.sync="form.cleanTrackReport" :expr.sync="form.cleanTrackReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_plan_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.typeValue" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/>
<timing-item ref="trackTimingItem" :choose.sync="config.cleanTrackReport"
:expr.sync="config.cleanTrackReportExpr"
@chooseChange="switchChange('CLEAN_TRACK_REPORT', config.cleanTrackReport, ['CLEAN_TRACK_REPORT_EXPR', config.cleanTrackReportExpr])"
:title="$t('project.timing_clean_plan_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="config.shareReport"
:expr.sync="config.trackShareReportTime" :share-link="true"
:unit-options="applyUnitOptions"
@chooseChange="switchChange('TRACK_SHARE_REPORT_TIME', config.trackShareReportTime)"
:title="$t('report.report_sharing_link')"/>
</el-row>
</el-tab-pane>
@ -42,28 +48,34 @@
<el-row style="margin-top: 15px">
<app-manage-item :title="$t('project.repeatable')" :description="$t('project.repeatable_info')">
<template #append>
<el-switch v-model="form.repeatable" @change="chooseChange"></el-switch>
<el-switch v-model="config.urlRepeatable"
@change="switchChange('URL_REPEATABLE', $event)"></el-switch>
</template>
</app-manage-item>
<app-manage-item :title="$t('project.scenario_custom_id')"
:description="$t('project.scenario_custom_id_info')">
<template #append>
<el-switch v-model="form.scenarioCustomNum" @change="chooseChange"></el-switch>
<el-switch v-model="config.scenarioCustomNum"
@change="switchChange('SCENARIO_CUSTOM_NUM', $event)"></el-switch>
</template>
</app-manage-item>
<app-manage-item :title="'TCP Mock Port'" :prepend-span="8" :middle-span="12" :append-span="4">
<template #middle>
<el-input-number v-model="form.mockTcpPort" :controls="false" size="medium"
:disabled="form.isMockTcpOpen"></el-input-number>
<el-input-number v-model="config.mockTcpPort" :controls="false" size="medium"
:disabled="config.mockTcpOpen"></el-input-number>
</template>
<template #append>
<el-switch v-model="form.isMockTcpOpen" @change="chooseChange"></el-switch>
<el-switch v-model="config.mockTcpOpen"
@change="switchChange('MOCK_TCP_OPEN', $event, ['MOCK_TCP_PORT', config.mockTcpPort])"></el-switch>
</template>
</app-manage-item>
<timing-item ref="apiTimingItem" :choose.sync="form.cleanApiReport" :expr.sync="form.cleanApiReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_api_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.typeValue" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/>
<timing-item ref="apiTimingItem" :choose.sync="config.cleanApiReport"
:expr.sync="config.cleanApiReportExpr"
@chooseChange="switchChange('CLEAN_API_REPORT', config.cleanApiReport, ['CLEAN_API_REPORT_EXPR', config.cleanApiReportExpr])"
:title="$t('project.timing_clean_api_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="config.shareReport"
:expr.sync="config.apiShareReportTime" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="switchChange('API_SHARE_REPORT_TIME', config.apiShareReportTime)" :title="$t('report.report_sharing_link')"/>
</el-row>
</el-col>
<el-col :span="8" :offset="4">
@ -74,7 +86,7 @@
<app-manage-item :title="$t('api_test.definition.api_quick_button')"
:append-span="12" :prepend-span="12" :middle-span="0">
<template #append>
<el-radio-group v-model="form.apiQuick" @change="chooseChange">
<el-radio-group v-model="config.apiQuickMenu" @change="switchChange('API_QUICK_MENU', $event)">
<el-radio label="debug" value="debug">
{{ $t('api_test.definition.request.fast_debug') }}
</el-radio>
@ -94,10 +106,15 @@
<span style="font-weight:bold">{{ this.$t('commons.enable_settings') }}</span>
</el-row>
<el-row style="margin-top: 15px">
<timing-item ref="loadTimingItem" :choose.sync="form.cleanLoadReport" :expr.sync="form.cleanLoadReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_load_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.typeValue" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/>
<timing-item ref="loadTimingItem" :choose.sync="config.cleanLoadReport"
:expr.sync="config.cleanLoadReportExpr"
@chooseChange="switchChange('CLEAN_LOAD_REPORT', config.cleanLoadReport, ['CLEAN_LOAD_REPORT_EXPR', config.cleanLoadReportExpr])"
:title="$t('project.timing_clean_load_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="config.shareReport"
:expr.sync="config.performanceShareReportTime" :share-link="true"
:unit-options="applyUnitOptions"
@chooseChange="switchChange('PERFORMANCE_SHARE_REPORT_TIME', config.performanceShareReportTime)"
:title="$t('report.report_sharing_link')"/>
</el-row>
</el-tab-pane>
@ -131,11 +148,6 @@ export default {
MsMainContainer,
MsContainer
},
watch: {
activeName(val) {
this.getProjectApplication();
},
},
data() {
return {
activeName: 'test_track',
@ -147,10 +159,6 @@ export default {
cleanLoadReport: false,
cleanLoadReportExpr: ""
},
application:{
shareReport:'',
typeValue:'',
},
count: 0,
isXpack: false,
result: {},
@ -162,7 +170,26 @@ export default {
{value: "D", label: this.$t('commons.date_unit.day')},
{value: "M", label: this.$t('commons.date_unit.month')},
{value: "Y", label: this.$t('commons.date_unit.year')},
]
],
config: {
trackShareReportTime: "",
performanceShareReportTime: "",
apiShareReportTime: "",
caseCustomNum: false,
scenarioCustomNum: false,
apiQuickMenu: "",
casePublic: false,
mockTcpPort: 0,
mockTcpOpen: false,
cleanTrackReport: false,
cleanTrackReportExpr: "",
cleanApiReport: false,
cleanApiReportExpr: "",
cleanLoadReport: false,
cleanLoadReportExpr: "",
urlRepeatable: false,
shareReport: true
}
};
},
created() {
@ -175,51 +202,30 @@ export default {
},
},
methods: {
chooseChange() {
this.form.workspaceId = getCurrentWorkspaceId();
this.form.createUser = getCurrentUserId();
this.form.id = this.projectId;
this.$post("/project/update", this.form, () => {
switchChange(type, value, other) {
let configs = [];
if (other && value) {
//
configs.push({projectId: this.projectId, typeValue: other[1], type: other[0]});
}
//
// tcp
configs.push({projectId: this.projectId, typeValue: value, type});
let params = {configs};
this.$post("/project_application/update/batch", params, () => {
this.$success(this.$t('commons.save_success'));
this.init();
}, () => {
this.init();
});
},
chooseChangeApply(){
if(!this.application.shareReport){
return;
}
this.$post("/project_application/update", this.application, () => {
this.$success(this.$t('commons.save_success'));
this.init();
}, () => {
this.init();
});
},
getProjectApplication(){
let type;
if(this.activeName==='test_track'){
type = 'TRACK_SHARE_REPORT_TIME'
}else if(this.activeName==='performance'){
type = 'PERFORMANCE_SHARE_REPORT_TIME'
}else if(this.activeName==='api'){
type = 'API_SHARE_REPORT_TIME'
}
if(type){
this.$get('/project_application/get/' + this.projectId+"/"+type, res => {
if(res.data){
res.data.shareReport = true;
this.application = res.data;
}
});
}
},
init() {
this.result = this.$get('/project/get/' + this.projectId, res => {
this.form = res.data;
this.$get('/project_application/get/config/' + this.projectId, res => {
if (res.data) {
this.config = res.data;
this.config.shareReport = true;
}
});
this.getProjectApplication();
}
}
};

View File

@ -631,10 +631,10 @@ export default {
this.condition = data;
},
getProject() {
this.$get("/project/get/" + this.projectId, result => {
this.$get('/project_application/get/config/' + this.projectId + "/CASE_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.$store.commit('setCurrentProjectIsCustomNum', data.customNum);
this.$store.commit('setCurrentProjectIsCustomNum', data.caseCustomNum);
}
});
},

View File

@ -449,9 +449,9 @@ export default {
}
}
}),
this.result = this.$get('/project/get/' + this.projectId, res => {
this.result = this.$get('/project_application/get/config/' + this.projectId + "/CASE_PUBLIC", res => {
let data = res.data;
if (data.casePublic) {
if (data && data.casePublic) {
this.isPublic = true;
}
})

View File

@ -399,9 +399,9 @@ export default {
}
}
}),
this.result = this.$get('/project/get/' + this.projectId, res => {
this.result = this.$get('/project_application/get/config/' + this.projectId + "/CASE_PUBLIC", res => {
let data = res.data;
if (data.casePublic) {
if (data && data.casePublic) {
this.isPublic = true;
}
})

View File

@ -1065,9 +1065,9 @@ export default {
this.$refs.batchEdit.open(this.condition.selectAll ? this.page.total : this.$refs.table.selectRows.size);
},
handleBatchAddPublic() {
this.$get('/project/get/' + getCurrentProjectID(), res => {
this.$get('/project_application/get/config/' + getCurrentProjectID() + "/CASE_PUBLIC", res => {
let data = res.data;
if (data.casePublic) {
if (data && data.casePublic) {
let param = {};
param.ids = this.$refs.table.selectIds;
param.casePublic = true;

View File

@ -230,7 +230,7 @@
},
getProject(projectId) {
if (projectId) {
this.$get("/project/get/" + projectId, result => {
this.$get('/project_application/get/config/' + projectId + "/SCENARIO_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;

View File

@ -8,7 +8,7 @@
:label="$t('commons.id')"
show-overflow-tooltip>
<template v-slot:default="{row}">
{{row.isCustomNum ? row.customNum : row.num }}
{{isCustomNum ? row.customNum : row.num }}
</template>
</el-table-column>
<el-table-column
@ -92,6 +92,11 @@ export default {
testCases: []
}
},
computed: {
isCustomNum() {
return this.$store.state.currentProjectIsCustomNum;
},
},
mounted() {
this.getFunctionalTestCase();
},

View File

@ -11,7 +11,7 @@
:label="$t('commons.id')"
show-overflow-tooltip>
<template v-slot:default="{row}">
{{ row.isCustomNum ? row.customNum : row.num }}
{{ isCustomNum ? row.customNum : row.num }}
</template>
</el-table-column>
<el-table-column
@ -91,6 +91,11 @@ export default {
}
}
},
computed: {
isCustomNum() {
return this.$store.state.currentProjectIsCustomNum;
},
},
methods: {
getFailureTestCase() {
if (this.isTemplate || this.isDb) {