diff --git a/backend/pom.xml b/backend/pom.xml index 6b06f9cfbd..c4a77b35ac 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -327,6 +327,12 @@ com.google.guava 31.0.1-jre + + + org.eclipse.jgit + org.eclipse.jgit + 5.13.0.202109080827-r + diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java index c76f2418e0..86f6717f4e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java @@ -65,4 +65,6 @@ public class SaveApiScenarioRequest { private String environmentGroupId; private String versionId; + + private List repositoryFileIds; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/variable/ScenarioVariable.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/variable/ScenarioVariable.java index 4ed0188566..c4906c426b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/variable/ScenarioVariable.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/variable/ScenarioVariable.java @@ -40,6 +40,15 @@ public class ScenarioVariable { */ private String minNumber; private String maxNumber; + /** + * repository csv + */ + private String fileResource; + private String repositoryId; + private String repositoryBranch; + private String repositoryFilePath; + + public ScenarioVariable() { diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java index f92363cabd..cc2733eda7 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java @@ -31,11 +31,13 @@ import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; import io.metersphere.plugin.core.MsTestElement; import io.metersphere.service.EnvironmentGroupProjectService; +import io.metersphere.utils.LoggerUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.lang.reflect.Method; import java.util.*; import java.util.stream.Collectors; @@ -235,6 +237,16 @@ public class ApiScenarioEnvService { String definition = apiScenarioWithBLOBs.getScenarioDefinition(); MsScenario scenario = JSONObject.parseObject(definition, MsScenario.class); GenerateHashTreeUtil.parse(definition, scenario); + // 添加csv版本控制台打印信息 + try { + if (Class.forName("io.metersphere.xpack.repository.service.GitRepositoryService") != null) { + Class clazz = Class.forName("io.metersphere.xpack.repository.service.GitRepositoryService"); + Method method = clazz.getMethod("getCsvVersionScriptProcess", String.class, MsTestElement.class); + method.invoke(CommonBeanFactory.getBean("gitRepositoryService"), apiScenarioWithBLOBs.getId(), scenario); + } + } catch (Exception exception) { + LoggerUtil.error("不存在GitRepositoryService类"); + } if (StringUtils.equals(environmentType, EnvironmentType.JSON.toString())) { scenario.setEnvironmentMap(JSON.parseObject(environmentJson, Map.class)); } else if (StringUtils.equals(environmentType, EnvironmentType.GROUP.toString())) { diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java index 9841e5c3e8..ba05b7fa2d 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java @@ -11,10 +11,7 @@ import io.metersphere.api.dto.definition.request.ParameterConfig; import io.metersphere.api.exec.queue.DBTestQueue; import io.metersphere.api.exec.utils.GenerateHashTreeUtil; import io.metersphere.api.jmeter.JMeterService; -import io.metersphere.api.service.ApiExecutionQueueService; -import io.metersphere.api.service.ApiScenarioReportService; -import io.metersphere.api.service.ApiScenarioReportStructureService; -import io.metersphere.api.service.TcpApiParamService; +import io.metersphere.api.service.*; import io.metersphere.base.domain.ApiScenarioExample; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.TestPlanApiScenario; @@ -27,10 +24,7 @@ import io.metersphere.commons.constants.ApiRunMode; import io.metersphere.commons.constants.ReportTriggerMode; import io.metersphere.commons.constants.ReportTypeConstants; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.FileUtils; -import io.metersphere.commons.utils.LogUtil; -import io.metersphere.commons.utils.ServiceUtils; -import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.commons.utils.*; import io.metersphere.constants.RunModeConstants; import io.metersphere.dto.JmeterRunRequestDTO; import io.metersphere.dto.MsExecResponseDTO; @@ -51,6 +45,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.lang.reflect.Method; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -308,6 +303,17 @@ public class ApiScenarioExecuteService { public void testElement(RunDefinitionRequest request) { if (request.getTestElement() != null) { + // 添加csv版本控制台打印信息 + try { + if (Class.forName("io.metersphere.xpack.repository.service.GitRepositoryService") != null) { + Class clazz = Class.forName("io.metersphere.xpack.repository.service.GitRepositoryService"); + Method method = clazz.getMethod("getCsvVersionScriptProcess",String.class, MsTestElement.class); + method.invoke(CommonBeanFactory.getBean("gitRepositoryService"),request.getScenarioId(), request.getTestElement()); + } + } catch (Exception exception) { + LoggerUtil.error("不存在GitRepositoryService类"); + } + tcpApiParamService.checkTestElement(request.getTestElement()); } } diff --git a/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepository.java b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepository.java new file mode 100644 index 0000000000..3b51b2aaed --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepository.java @@ -0,0 +1,29 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class WorkspaceRepository implements Serializable { + private String id; + + private String repositoryName; + + private String repositoryUrl; + + private String username; + + private String password; + + private Long createTime; + + private Long updateTime; + + private String workspaceId; + + private String createUser; + + private String description; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryExample.java b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryExample.java new file mode 100644 index 0000000000..b0be0d1d65 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryExample.java @@ -0,0 +1,810 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class WorkspaceRepositoryExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public WorkspaceRepositoryExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andRepositoryNameIsNull() { + addCriterion("repository_name is null"); + return (Criteria) this; + } + + public Criteria andRepositoryNameIsNotNull() { + addCriterion("repository_name is not null"); + return (Criteria) this; + } + + public Criteria andRepositoryNameEqualTo(String value) { + addCriterion("repository_name =", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameNotEqualTo(String value) { + addCriterion("repository_name <>", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameGreaterThan(String value) { + addCriterion("repository_name >", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameGreaterThanOrEqualTo(String value) { + addCriterion("repository_name >=", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameLessThan(String value) { + addCriterion("repository_name <", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameLessThanOrEqualTo(String value) { + addCriterion("repository_name <=", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameLike(String value) { + addCriterion("repository_name like", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameNotLike(String value) { + addCriterion("repository_name not like", value, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameIn(List values) { + addCriterion("repository_name in", values, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameNotIn(List values) { + addCriterion("repository_name not in", values, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameBetween(String value1, String value2) { + addCriterion("repository_name between", value1, value2, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryNameNotBetween(String value1, String value2) { + addCriterion("repository_name not between", value1, value2, "repositoryName"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlIsNull() { + addCriterion("repository_url is null"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlIsNotNull() { + addCriterion("repository_url is not null"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlEqualTo(String value) { + addCriterion("repository_url =", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlNotEqualTo(String value) { + addCriterion("repository_url <>", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlGreaterThan(String value) { + addCriterion("repository_url >", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlGreaterThanOrEqualTo(String value) { + addCriterion("repository_url >=", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlLessThan(String value) { + addCriterion("repository_url <", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlLessThanOrEqualTo(String value) { + addCriterion("repository_url <=", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlLike(String value) { + addCriterion("repository_url like", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlNotLike(String value) { + addCriterion("repository_url not like", value, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlIn(List values) { + addCriterion("repository_url in", values, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlNotIn(List values) { + addCriterion("repository_url not in", values, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlBetween(String value1, String value2) { + addCriterion("repository_url between", value1, value2, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andRepositoryUrlNotBetween(String value1, String value2) { + addCriterion("repository_url not between", value1, value2, "repositoryUrl"); + return (Criteria) this; + } + + public Criteria andUsernameIsNull() { + addCriterion("username is null"); + return (Criteria) this; + } + + public Criteria andUsernameIsNotNull() { + addCriterion("username is not null"); + return (Criteria) this; + } + + public Criteria andUsernameEqualTo(String value) { + addCriterion("username =", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotEqualTo(String value) { + addCriterion("username <>", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThan(String value) { + addCriterion("username >", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThanOrEqualTo(String value) { + addCriterion("username >=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThan(String value) { + addCriterion("username <", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThanOrEqualTo(String value) { + addCriterion("username <=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLike(String value) { + addCriterion("username like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotLike(String value) { + addCriterion("username not like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameIn(List values) { + addCriterion("username in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotIn(List values) { + addCriterion("username not in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameBetween(String value1, String value2) { + addCriterion("username between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotBetween(String value1, String value2) { + addCriterion("username not between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andPasswordIsNull() { + addCriterion("`password` is null"); + return (Criteria) this; + } + + public Criteria andPasswordIsNotNull() { + addCriterion("`password` is not null"); + return (Criteria) this; + } + + public Criteria andPasswordEqualTo(String value) { + addCriterion("`password` =", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotEqualTo(String value) { + addCriterion("`password` <>", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThan(String value) { + addCriterion("`password` >", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThanOrEqualTo(String value) { + addCriterion("`password` >=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThan(String value) { + addCriterion("`password` <", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThanOrEqualTo(String value) { + addCriterion("`password` <=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLike(String value) { + addCriterion("`password` like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotLike(String value) { + addCriterion("`password` not like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordIn(List values) { + addCriterion("`password` in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotIn(List values) { + addCriterion("`password` not in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordBetween(String value1, String value2) { + addCriterion("`password` between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotBetween(String value1, String value2) { + addCriterion("`password` not between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNull() { + addCriterion("workspace_id is null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNotNull() { + addCriterion("workspace_id is not null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdEqualTo(String value) { + addCriterion("workspace_id =", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotEqualTo(String value) { + addCriterion("workspace_id <>", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThan(String value) { + addCriterion("workspace_id >", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) { + addCriterion("workspace_id >=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThan(String value) { + addCriterion("workspace_id <", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThanOrEqualTo(String value) { + addCriterion("workspace_id <=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLike(String value) { + addCriterion("workspace_id like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotLike(String value) { + addCriterion("workspace_id not like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIn(List values) { + addCriterion("workspace_id in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotIn(List values) { + addCriterion("workspace_id not in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdBetween(String value1, String value2) { + addCriterion("workspace_id between", value1, value2, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotBetween(String value1, String value2) { + addCriterion("workspace_id not between", value1, value2, "workspaceId"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersion.java b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersion.java new file mode 100644 index 0000000000..45217c8165 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersion.java @@ -0,0 +1,27 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class WorkspaceRepositoryFileVersion implements Serializable { + private String id; + + private String repositoryId; + + private String branch; + + private String path; + + private String scenarioId; + + private Long createTime; + + private Long updateTime; + + private String createUser; + + private String commitId; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersionExample.java b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersionExample.java new file mode 100644 index 0000000000..2af6013f10 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/WorkspaceRepositoryFileVersionExample.java @@ -0,0 +1,810 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class WorkspaceRepositoryFileVersionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public WorkspaceRepositoryFileVersionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andRepositoryIdIsNull() { + addCriterion("repository_id is null"); + return (Criteria) this; + } + + public Criteria andRepositoryIdIsNotNull() { + addCriterion("repository_id is not null"); + return (Criteria) this; + } + + public Criteria andRepositoryIdEqualTo(String value) { + addCriterion("repository_id =", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdNotEqualTo(String value) { + addCriterion("repository_id <>", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdGreaterThan(String value) { + addCriterion("repository_id >", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdGreaterThanOrEqualTo(String value) { + addCriterion("repository_id >=", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdLessThan(String value) { + addCriterion("repository_id <", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdLessThanOrEqualTo(String value) { + addCriterion("repository_id <=", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdLike(String value) { + addCriterion("repository_id like", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdNotLike(String value) { + addCriterion("repository_id not like", value, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdIn(List values) { + addCriterion("repository_id in", values, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdNotIn(List values) { + addCriterion("repository_id not in", values, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdBetween(String value1, String value2) { + addCriterion("repository_id between", value1, value2, "repositoryId"); + return (Criteria) this; + } + + public Criteria andRepositoryIdNotBetween(String value1, String value2) { + addCriterion("repository_id not between", value1, value2, "repositoryId"); + return (Criteria) this; + } + + public Criteria andBranchIsNull() { + addCriterion("branch is null"); + return (Criteria) this; + } + + public Criteria andBranchIsNotNull() { + addCriterion("branch is not null"); + return (Criteria) this; + } + + public Criteria andBranchEqualTo(String value) { + addCriterion("branch =", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchNotEqualTo(String value) { + addCriterion("branch <>", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchGreaterThan(String value) { + addCriterion("branch >", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchGreaterThanOrEqualTo(String value) { + addCriterion("branch >=", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchLessThan(String value) { + addCriterion("branch <", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchLessThanOrEqualTo(String value) { + addCriterion("branch <=", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchLike(String value) { + addCriterion("branch like", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchNotLike(String value) { + addCriterion("branch not like", value, "branch"); + return (Criteria) this; + } + + public Criteria andBranchIn(List values) { + addCriterion("branch in", values, "branch"); + return (Criteria) this; + } + + public Criteria andBranchNotIn(List values) { + addCriterion("branch not in", values, "branch"); + return (Criteria) this; + } + + public Criteria andBranchBetween(String value1, String value2) { + addCriterion("branch between", value1, value2, "branch"); + return (Criteria) this; + } + + public Criteria andBranchNotBetween(String value1, String value2) { + addCriterion("branch not between", value1, value2, "branch"); + return (Criteria) this; + } + + public Criteria andPathIsNull() { + addCriterion("`path` is null"); + return (Criteria) this; + } + + public Criteria andPathIsNotNull() { + addCriterion("`path` is not null"); + return (Criteria) this; + } + + public Criteria andPathEqualTo(String value) { + addCriterion("`path` =", value, "path"); + return (Criteria) this; + } + + public Criteria andPathNotEqualTo(String value) { + addCriterion("`path` <>", value, "path"); + return (Criteria) this; + } + + public Criteria andPathGreaterThan(String value) { + addCriterion("`path` >", value, "path"); + return (Criteria) this; + } + + public Criteria andPathGreaterThanOrEqualTo(String value) { + addCriterion("`path` >=", value, "path"); + return (Criteria) this; + } + + public Criteria andPathLessThan(String value) { + addCriterion("`path` <", value, "path"); + return (Criteria) this; + } + + public Criteria andPathLessThanOrEqualTo(String value) { + addCriterion("`path` <=", value, "path"); + return (Criteria) this; + } + + public Criteria andPathLike(String value) { + addCriterion("`path` like", value, "path"); + return (Criteria) this; + } + + public Criteria andPathNotLike(String value) { + addCriterion("`path` not like", value, "path"); + return (Criteria) this; + } + + public Criteria andPathIn(List values) { + addCriterion("`path` in", values, "path"); + return (Criteria) this; + } + + public Criteria andPathNotIn(List values) { + addCriterion("`path` not in", values, "path"); + return (Criteria) this; + } + + public Criteria andPathBetween(String value1, String value2) { + addCriterion("`path` between", value1, value2, "path"); + return (Criteria) this; + } + + public Criteria andPathNotBetween(String value1, String value2) { + addCriterion("`path` not between", value1, value2, "path"); + return (Criteria) this; + } + + public Criteria andScenarioIdIsNull() { + addCriterion("scenario_id is null"); + return (Criteria) this; + } + + public Criteria andScenarioIdIsNotNull() { + addCriterion("scenario_id is not null"); + return (Criteria) this; + } + + public Criteria andScenarioIdEqualTo(String value) { + addCriterion("scenario_id =", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotEqualTo(String value) { + addCriterion("scenario_id <>", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdGreaterThan(String value) { + addCriterion("scenario_id >", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdGreaterThanOrEqualTo(String value) { + addCriterion("scenario_id >=", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLessThan(String value) { + addCriterion("scenario_id <", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLessThanOrEqualTo(String value) { + addCriterion("scenario_id <=", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLike(String value) { + addCriterion("scenario_id like", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotLike(String value) { + addCriterion("scenario_id not like", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdIn(List values) { + addCriterion("scenario_id in", values, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotIn(List values) { + addCriterion("scenario_id not in", values, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdBetween(String value1, String value2) { + addCriterion("scenario_id between", value1, value2, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotBetween(String value1, String value2) { + addCriterion("scenario_id not between", value1, value2, "scenarioId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCommitIdIsNull() { + addCriterion("commit_id is null"); + return (Criteria) this; + } + + public Criteria andCommitIdIsNotNull() { + addCriterion("commit_id is not null"); + return (Criteria) this; + } + + public Criteria andCommitIdEqualTo(String value) { + addCriterion("commit_id =", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdNotEqualTo(String value) { + addCriterion("commit_id <>", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdGreaterThan(String value) { + addCriterion("commit_id >", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdGreaterThanOrEqualTo(String value) { + addCriterion("commit_id >=", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdLessThan(String value) { + addCriterion("commit_id <", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdLessThanOrEqualTo(String value) { + addCriterion("commit_id <=", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdLike(String value) { + addCriterion("commit_id like", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdNotLike(String value) { + addCriterion("commit_id not like", value, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdIn(List values) { + addCriterion("commit_id in", values, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdNotIn(List values) { + addCriterion("commit_id not in", values, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdBetween(String value1, String value2) { + addCriterion("commit_id between", value1, value2, "commitId"); + return (Criteria) this; + } + + public Criteria andCommitIdNotBetween(String value1, String value2) { + addCriterion("commit_id not between", value1, value2, "commitId"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.java b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.java new file mode 100644 index 0000000000..1ee94c77fe --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.java @@ -0,0 +1,30 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.WorkspaceRepositoryFileVersion; +import io.metersphere.base.domain.WorkspaceRepositoryFileVersionExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface WorkspaceRepositoryFileVersionMapper { + long countByExample(WorkspaceRepositoryFileVersionExample example); + + int deleteByExample(WorkspaceRepositoryFileVersionExample example); + + int deleteByPrimaryKey(String id); + + int insert(WorkspaceRepositoryFileVersion record); + + int insertSelective(WorkspaceRepositoryFileVersion record); + + List selectByExample(WorkspaceRepositoryFileVersionExample example); + + WorkspaceRepositoryFileVersion selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") WorkspaceRepositoryFileVersion record, @Param("example") WorkspaceRepositoryFileVersionExample example); + + int updateByExample(@Param("record") WorkspaceRepositoryFileVersion record, @Param("example") WorkspaceRepositoryFileVersionExample example); + + int updateByPrimaryKeySelective(WorkspaceRepositoryFileVersion record); + + int updateByPrimaryKey(WorkspaceRepositoryFileVersion record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.xml new file mode 100644 index 0000000000..2c0f67fab3 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryFileVersionMapper.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, repository_id, branch, `path`, scenario_id, create_time, update_time, create_user, + commit_id + + + + + delete from workspace_repository_file_version + where id = #{id,jdbcType=VARCHAR} + + + delete from workspace_repository_file_version + + + + + + insert into workspace_repository_file_version (id, repository_id, branch, + `path`, scenario_id, create_time, + update_time, create_user, commit_id + ) + values (#{id,jdbcType=VARCHAR}, #{repositoryId,jdbcType=VARCHAR}, #{branch,jdbcType=VARCHAR}, + #{path,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{commitId,jdbcType=VARCHAR} + ) + + + insert into workspace_repository_file_version + + + id, + + + repository_id, + + + branch, + + + `path`, + + + scenario_id, + + + create_time, + + + update_time, + + + create_user, + + + commit_id, + + + + + #{id,jdbcType=VARCHAR}, + + + #{repositoryId,jdbcType=VARCHAR}, + + + #{branch,jdbcType=VARCHAR}, + + + #{path,jdbcType=VARCHAR}, + + + #{scenarioId,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{commitId,jdbcType=VARCHAR}, + + + + + + update workspace_repository_file_version + + + id = #{record.id,jdbcType=VARCHAR}, + + + repository_id = #{record.repositoryId,jdbcType=VARCHAR}, + + + branch = #{record.branch,jdbcType=VARCHAR}, + + + `path` = #{record.path,jdbcType=VARCHAR}, + + + scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + commit_id = #{record.commitId,jdbcType=VARCHAR}, + + + + + + + + update workspace_repository_file_version + set id = #{record.id,jdbcType=VARCHAR}, + repository_id = #{record.repositoryId,jdbcType=VARCHAR}, + branch = #{record.branch,jdbcType=VARCHAR}, + `path` = #{record.path,jdbcType=VARCHAR}, + scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + commit_id = #{record.commitId,jdbcType=VARCHAR} + + + + + + update workspace_repository_file_version + + + repository_id = #{repositoryId,jdbcType=VARCHAR}, + + + branch = #{branch,jdbcType=VARCHAR}, + + + `path` = #{path,jdbcType=VARCHAR}, + + + scenario_id = #{scenarioId,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + commit_id = #{commitId,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update workspace_repository_file_version + set repository_id = #{repositoryId,jdbcType=VARCHAR}, + branch = #{branch,jdbcType=VARCHAR}, + `path` = #{path,jdbcType=VARCHAR}, + scenario_id = #{scenarioId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR}, + commit_id = #{commitId,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.java b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.java new file mode 100644 index 0000000000..6e0b96afb3 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.java @@ -0,0 +1,36 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.WorkspaceRepository; +import io.metersphere.base.domain.WorkspaceRepositoryExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface WorkspaceRepositoryMapper { + long countByExample(WorkspaceRepositoryExample example); + + int deleteByExample(WorkspaceRepositoryExample example); + + int deleteByPrimaryKey(String id); + + int insert(WorkspaceRepository record); + + int insertSelective(WorkspaceRepository record); + + List selectByExampleWithBLOBs(WorkspaceRepositoryExample example); + + List selectByExample(WorkspaceRepositoryExample example); + + WorkspaceRepository selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") WorkspaceRepository record, @Param("example") WorkspaceRepositoryExample example); + + int updateByExampleWithBLOBs(@Param("record") WorkspaceRepository record, @Param("example") WorkspaceRepositoryExample example); + + int updateByExample(@Param("record") WorkspaceRepository record, @Param("example") WorkspaceRepositoryExample example); + + int updateByPrimaryKeySelective(WorkspaceRepository record); + + int updateByPrimaryKeyWithBLOBs(WorkspaceRepository record); + + int updateByPrimaryKey(WorkspaceRepository record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.xml new file mode 100644 index 0000000000..9aecf06362 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceRepositoryMapper.xml @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, repository_name, repository_url, username, `password`, create_time, update_time, + workspace_id, create_user + + + description + + + + + + delete from workspace_repository + where id = #{id,jdbcType=VARCHAR} + + + delete from workspace_repository + + + + + + insert into workspace_repository (id, repository_name, repository_url, + username, `password`, create_time, + update_time, workspace_id, create_user, + description) + values (#{id,jdbcType=VARCHAR}, #{repositoryName,jdbcType=VARCHAR}, #{repositoryUrl,jdbcType=VARCHAR}, + #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}, #{workspaceId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, + #{description,jdbcType=LONGVARCHAR}) + + + insert into workspace_repository + + + id, + + + repository_name, + + + repository_url, + + + username, + + + `password`, + + + create_time, + + + update_time, + + + workspace_id, + + + create_user, + + + description, + + + + + #{id,jdbcType=VARCHAR}, + + + #{repositoryName,jdbcType=VARCHAR}, + + + #{repositoryUrl,jdbcType=VARCHAR}, + + + #{username,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{workspaceId,jdbcType=VARCHAR}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{description,jdbcType=LONGVARCHAR}, + + + + + + update workspace_repository + + + id = #{record.id,jdbcType=VARCHAR}, + + + repository_name = #{record.repositoryName,jdbcType=VARCHAR}, + + + repository_url = #{record.repositoryUrl,jdbcType=VARCHAR}, + + + username = #{record.username,jdbcType=VARCHAR}, + + + `password` = #{record.password,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=LONGVARCHAR}, + + + + + + + + update workspace_repository + set id = #{record.id,jdbcType=VARCHAR}, + repository_name = #{record.repositoryName,jdbcType=VARCHAR}, + repository_url = #{record.repositoryUrl,jdbcType=VARCHAR}, + username = #{record.username,jdbcType=VARCHAR}, + `password` = #{record.password,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=LONGVARCHAR} + + + + + + update workspace_repository + set id = #{record.id,jdbcType=VARCHAR}, + repository_name = #{record.repositoryName,jdbcType=VARCHAR}, + repository_url = #{record.repositoryUrl,jdbcType=VARCHAR}, + username = #{record.username,jdbcType=VARCHAR}, + `password` = #{record.password,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + create_user = #{record.createUser,jdbcType=VARCHAR} + + + + + + update workspace_repository + + + repository_name = #{repositoryName,jdbcType=VARCHAR}, + + + repository_url = #{repositoryUrl,jdbcType=VARCHAR}, + + + username = #{username,jdbcType=VARCHAR}, + + + `password` = #{password,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update workspace_repository + set repository_name = #{repositoryName,jdbcType=VARCHAR}, + repository_url = #{repositoryUrl,jdbcType=VARCHAR}, + username = #{username,jdbcType=VARCHAR}, + `password` = #{password,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + create_user = #{createUser,jdbcType=VARCHAR}, + description = #{description,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update workspace_repository + set repository_name = #{repositoryName,jdbcType=VARCHAR}, + repository_url = #{repositoryUrl,jdbcType=VARCHAR}, + username = #{username,jdbcType=VARCHAR}, + `password` = #{password,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + create_user = #{createUser,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/commons/utils/FileUtils.java b/backend/src/main/java/io/metersphere/commons/utils/FileUtils.java index cb822207f1..9beac4340a 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/FileUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/FileUtils.java @@ -75,6 +75,34 @@ public class FileUtils { } } + private static void copyFile(List bodyUploadIds, List existfilePaths, String path) { + String filePath = BODY_FILE_DIR; + if (StringUtils.isNotEmpty(path)) { + filePath = path; + } + if (CollectionUtils.isNotEmpty(bodyUploadIds) && CollectionUtils.isNotEmpty(existfilePaths)) { + File testDir = new File(filePath); + if (!testDir.exists()) { + testDir.mkdirs(); + } + for (int i = 0; i < bodyUploadIds.size(); i++) { + String oldFilePath = existfilePaths.get(i); + String[] oldFilePathSplits = oldFilePath.split("/"); + String newFilePath = filePath + "/" + bodyUploadIds.get(i) + "_" + oldFilePathSplits[oldFilePathSplits.length-1]; + File existfile = new File(oldFilePath); + if (existfile.exists()) { + try { + FileUtil.copyFile(existfile, new File(newFilePath)); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + } + } + // 将旧的文件 item 复制到新的文件路径 filePath 下 + + } + } + } + public static String create(String id, MultipartFile item) { String filePath = BODY_FILE_DIR + "/plugin"; if (item != null) { @@ -200,6 +228,10 @@ public class FileUtils { FileUtils.create(bodyUploadIds, bodyFiles, null); } + public static void createBodyFileByCopy(List bodyUploadIds, List existfilePaths) { + FileUtils.copyFile(bodyUploadIds, existfilePaths, null); + } + public static void createFiles(List bodyUploadIds, List bodyFiles, String path) { FileUtils.create(bodyUploadIds, bodyFiles, path); } diff --git a/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java b/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java index 0e8588b4bb..1fd77e1097 100644 --- a/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java +++ b/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java @@ -23,6 +23,7 @@ public class SystemReference { public static Map baseColumns = new LinkedHashMap<>(); public static Map groupColumns = new LinkedHashMap<>(); public static Map projectApplicationColumns = new LinkedHashMap<>(); + public static Map workspaceRepositoryColumns = new LinkedHashMap<>(); static { @@ -44,6 +45,7 @@ public class SystemReference { mailColumns.clear(); groupColumns.clear(); projectApplicationColumns.clear(); + workspaceRepositoryColumns.clear(); userColumns.put("name", "用户名称"); userColumns.put("createUser", "创建人"); @@ -159,5 +161,9 @@ public class SystemReference { groupColumns.put("description", "描述"); groupColumns.put("type", "所属类型"); groupColumns.put("scopeId", "全局用户组"); + + workspaceRepositoryColumns.put("repositoryName", "存储库名称"); + workspaceRepositoryColumns.put("repositoryUrl", "存储库地址"); + workspaceRepositoryColumns.put("workspaceId", "工作空间"); } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 65db21ce81..faa4ee9313 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 65db21ce81f9056eb0a60b567799854786e329d6 +Subproject commit faa4ee93137988ff135d2496648ceb74f5753b06 diff --git a/backend/src/main/resources/db/migration/V110__v1.19_release.sql b/backend/src/main/resources/db/migration/V110__v1.19_release.sql index 47c313cf8f..1b4a9fa687 100644 --- a/backend/src/main/resources/db/migration/V110__v1.19_release.sql +++ b/backend/src/main/resources/db/migration/V110__v1.19_release.sql @@ -666,4 +666,51 @@ from api_scenario_report where execute_type = 'Saved' and report_type = 'API_INT delete from api_scenario_report where report_type = 'API_INTEGRATED'; -ALTER TABLE api_definition MODIFY COLUMN path varchar(1000); \ No newline at end of file +ALTER TABLE api_definition MODIFY COLUMN path varchar(1000); + +-- csv版本git管理 +INSERT INTO user_group_permission (id, group_id, permission_id, module_id) +VALUES (uuid(), 'ws_admin', 'WORKSPACE_REPOSITORY:READ', 'WORKSPACE_USER'); + +INSERT INTO user_group_permission (id, group_id, permission_id, module_id) +VALUES (uuid(), 'ws_member', 'WORKSPACE_REPOSITORY:READ', 'WORKSPACE_USER'); + +INSERT INTO user_group_permission (id, group_id, permission_id, module_id) +VALUES (uuid(), 'ws_admin', 'WORKSPACE_REPOSITORY:READ+CREATE', 'WORKSPACE_USER'); + +INSERT INTO user_group_permission (id, group_id, permission_id, module_id) +VALUES (uuid(), 'ws_admin', 'WORKSPACE_REPOSITORY:READ+EDIT', 'WORKSPACE_USER'); + +INSERT INTO user_group_permission (id, group_id, permission_id, module_id) +VALUES (uuid(), 'ws_admin', 'WORKSPACE_REPOSITORY:READ+DELETE', 'WORKSPACE_USER'); + +DROP TABLE IF EXISTS `workspace_repository`; +CREATE TABLE IF NOT EXISTS `workspace_repository` +( + `id` varchar(50) NOT NULL COMMENT 'Repository ID', + `repository_name` varchar(100) NOT NULL COMMENT '存储库名称', + `repository_url` varchar(300) NOT NULL COMMENT '存储库地址', + `username` varchar(256) NOT NULL COMMENT 'UserName', + `password` varchar(256) NOT NULL COMMENT 'Password', + `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', + `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', + `workspace_id` varchar(50) DEFAULT NULL COMMENT '工作空间ID', + `create_user` varchar(100) DEFAULT NULL COMMENT '创建人', + `description` longtext COMMENT '仓库描述信息', + PRIMARY KEY (`id`) +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + + +DROP TABLE IF EXISTS `workspace_repository_file_version`; +CREATE TABLE `workspace_repository_file_version` ( + `id` varchar(50) NOT NULL COMMENT 'ID', + `repository_id` varchar(50) NOT NULL COMMENT '存储库ID', + `branch` varchar(100) NOT NULL COMMENT '存储库分支', + `path` varchar(500) NOT NULL COMMENT '文件路径', + `scenario_id` varchar(100) NOT NULL COMMENT '场景ID', + `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', + `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', + `create_user` varchar(100) DEFAULT NULL COMMENT '创建人', + `commit_id` varchar(100) NOT NULL COMMENT '文件commentId', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC; \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index bee024047e..5495000a0c 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -305,6 +305,7 @@ environment_group_has_duplicate_project=Environment group has duplicate project error_report_library=Error report issue_jira_info_error=Check the service integration information or Jira project ID error_code_is_unique=Error code is not unique - no_version_exists=version not exists jira_auth_error=Account name or password (Token) is wrong +#workspace repository +workspace_repository_required_is_null=存储库必填信息为空 diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 9b123d98e4..1e3c5516b9 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -306,3 +306,5 @@ issue_jira_info_error=请检查服务集成信息或Jira项目ID error_code_is_unique=错误代码不可重复 no_version_exists=不存在版本!请先创建项目的版本 jira_auth_error=账号名或密码(Token)错误 +#workspace repository +workspace_repository_required_is_null=存储库必填信息为空 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 315b650a2e..a86c8ea58b 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -307,3 +307,5 @@ error_code_is_unique=錯誤代碼不可重複 no_version_exists=不存在版本!請先創建項目的版本 jira_auth_error=賬號名或密碼(Token)錯誤 +#workspace repository +workspace_repository_required_is_null=存储库必填信息为空 diff --git a/backend/src/main/resources/permission.json b/backend/src/main/resources/permission.json index 92c9e1f5c1..583a1b9f59 100644 --- a/backend/src/main/resources/permission.json +++ b/backend/src/main/resources/permission.json @@ -160,6 +160,26 @@ "name": "permission.workspace_user.delete", "resourceId": "WORKSPACE_USER" }, + { + "id": "WORKSPACE_REPOSITORY:READ", + "name": "permission.workspace_repository.read", + "resourceId": "WORKSPACE_REPOSITORY" + }, + { + "id": "WORKSPACE_REPOSITORY:READ+CREATE", + "name": "permission.workspace_repository.create", + "resourceId": "WORKSPACE_REPOSITORY" + }, + { + "id": "WORKSPACE_REPOSITORY:READ+EDIT", + "name": "permission.workspace_repository.edit", + "resourceId": "WORKSPACE_REPOSITORY" + }, + { + "id": "WORKSPACE_REPOSITORY:READ+DELETE", + "name": "permission.workspace_repository.delete", + "resourceId": "WORKSPACE_REPOSITORY" + }, { "id": "WORKSPACE_PROJECT_MANAGER:READ", "name": "permission.workspace_project_manager.read", @@ -1124,6 +1144,10 @@ { "id": "PERSONAL_INFORMATION", "name": "permission.personal_information.name" + }, + { + "id": "WORKSPACE_REPOSITORY", + "name": "permission.workspace_repository.name" } ] } \ No newline at end of file diff --git a/frontend/src/business/components/api/automation/api-automation.js b/frontend/src/business/components/api/automation/api-automation.js index ea3e7eaa29..1fdf5b0238 100644 --- a/frontend/src/business/components/api/automation/api-automation.js +++ b/frontend/src/business/components/api/automation/api-automation.js @@ -70,6 +70,34 @@ function getScenarioFiles(obj) { return scenarioFiles; } +function getRepositoryFiles(obj) { + let repositoryFiles = []; + obj.repositoryFileIds = []; + // 场景变量csv 文件 + if (obj.variables) { + obj.variables.forEach(param => { + if (param.type === 'CSV' && param.fileResource === 'repository') { + param.files = []; + let fileId = getUUID().substring(0, 12); + let fileSplits = param.repositoryFilePath.split('/'); + let fileName = fileSplits[fileSplits.length-1]; + param.files.push({ + id: fileId, + name: fileName + }); + obj.repositoryFileIds.push(fileId); + let repositoryFile = { + repositoryId: param.repositoryId, + repositoryBranch: param.repositoryBranch, + repositoryFilePath: param.repositoryFilePath, + }; + repositoryFiles.push(repositoryFile); + } + }); + } + return repositoryFiles; +} + export function saveScenario(url, scenario, scenarioDefinition, _this, success) { let bodyFiles = getBodyUploadFiles(scenario, scenarioDefinition); if (_this && _this.$store && _this.$store.state && _this.$store.state.pluginFiles && _this.$store.state.pluginFiles.length > 0) { @@ -92,6 +120,10 @@ export function saveScenario(url, scenario, scenarioDefinition, _this, success) formData.append("scenarioFiles", f); }) } + if (_this.showXpackCompnent) { + let repositoryFiles = getRepositoryFiles(scenario); + formData.append('repositoryFiles', new Blob([JSON.stringify(repositoryFiles)], {type: "application/json"})); + } formData.append('request', new Blob([JSON.stringify(scenario)], {type: "application/json"})); let axiosRequestConfig = getUploadConfig(url, formData); request(axiosRequestConfig, (response) => { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 2d2bf051a5..1aa6ed77c7 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -97,7 +97,7 @@ @setProjectEnvMap="setProjectEnvMap" @setEnvGroup="setEnvGroup" @showPopover="showPopover" :has-option-group="true" ref="envPopover" class="ms-message-right"/> - + {{ $t('api_test.request.debug') }} @@ -105,7 +105,7 @@ - {{ $t('report.stop_btn') }} + {{ $t('report.stop_btn') }} @@ -371,6 +371,7 @@ import {ENV_TYPE} from "@/common/js/constants"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {}; +const workspaceRepository = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./repository/WorkspaceRepository.vue") : {}; let jsonPath = require('jsonpath'); export default { @@ -457,6 +458,8 @@ export default { expandedNode: [], scenarioDefinition: [], path: "/api/automation/create", + repositoryCreatePath: "/repository/api/automation/create", + repositoryUpdatePath: "/repository/api/automation/update", debugData: {}, reportId: "", enableCookieShare: false, @@ -503,6 +506,8 @@ export default { pluginDelStep: false, isBatchProcess: false, isCheckedAll: false, + showXpackCompnent: false, + showDebug: true, selectDataCounts: 0, dffScenarioId: "", scenarioRefId: "", @@ -555,6 +560,9 @@ export default { if (hasLicense()) { this.getVersionHistory(); } + if (requireComponent !== null && JSON.stringify(workspaceRepository) !== '{}') { + this.showXpackCompnent = true; + } }, mounted() { this.$nextTick(() => { @@ -1061,11 +1069,16 @@ export default { return index - 0.33 }, setVariables(v, headers) { + if (this.showXpackCompnent) { + this.showDebug = false; + } this.currentScenario.variables = v; this.currentScenario.headers = headers; if (this.path.endsWith("/update")) { // 直接更新场景防止编辑内容丢失 this.editScenario(); + } else { + this.showDebug = true; } if (this.$refs.maximizeHeader) { this.$refs.maximizeHeader.getVariableSize(); @@ -1469,9 +1482,19 @@ export default { this.currentScenario.versionId = this.$refs.versionHistory.currentVersion.id; } } + if (this.path.endsWith("/update") && this.showXpackCompnent) { + this.path = this.repositoryUpdatePath; + } + if (this.path.endsWith("/create") && this.showXpackCompnent) { + this.path = this.repositoryCreatePath; + } saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => { this.$success(this.$t('commons.save_success')); - this.path = "/api/automation/update"; + if (this.showXpackCompnent) { + this.path = this.repositoryUpdatePath; + } else { + this.path = "/api/automation/update"; + } this.$store.state.pluginFiles = []; if (response.data) { this.currentScenario.id = response.data.id; diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue b/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue index 6a6f703b90..a1060305e6 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue @@ -15,7 +15,49 @@ - + + + {{$t('variables.file_resource')}} + + + {{$t('variables.local_file')}} + {{$t('variables.git_repository')}} + + + + + {{$t('variables.git_repository')}} + + + + + + + + + + + {{$t('variables.git_branch')}} + + + + + + + + {{$t('variables.git_file_path')}} + + + + + + {{$t('variables.add_file')}} @@ -80,6 +122,10 @@ diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index bcead74c5a..2b6e79e169 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -163,6 +163,9 @@ getCustomTableHeader } from "@/common/js/tableUtils"; + const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); + const workspaceRepository = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./repository/WorkspaceRepository.vue") : {}; + export default { name: "MsVariableList", components: { @@ -198,7 +201,9 @@ selection: [], loading: false, currentPage: 1, - editData: {}, + editData: { + fileResource: "local" + }, pageSize: 10, total: 0, headerSuggestions: REQUEST_HEADERS, @@ -215,6 +220,8 @@ handleClick: this.handleDeleteBatch, }, ], + validateRepositoryPath: "/repository/validate/exist", + showXpackCompnent: false, }; }, methods: { @@ -310,7 +317,7 @@ this.updateFiles(); let datas = []; this.variables.forEach(item => { - if(item.id === v.id){ + if (item.id === v.id) { item = v; } datas.push(item); @@ -347,7 +354,7 @@ this.$emit('setVariables', saveVariables, this.headers); }, addVariable() { - this.editData = {delimiter: ",", quotedData: 'false',files:[]}; + this.editData = {delimiter: ",", quotedData: 'false', files: [], fileResource: 'local', repositoryBranch: 'master'}; this.editData.type = this.selectType; this.showDelete = false; this.$refs.variableTable.cancelCurrentRow(); @@ -357,16 +364,53 @@ this.$warning("变量名不能为空"); return; } - // 更新场景,修改左边数据 - if(this.showDelete){ - this.updateParameters(this.editData); - }else{ - // 新增场景,往左边新加 - this.addParameters(this.editData); - this.addVariable(); - this.$refs.variableTable.cancelCurrentRow(); + if (this.showXpackCompnent) { + this.validateRepository(res => { + if (res) { + // 更新场景,修改左边数据 + if (this.showDelete) { + this.updateParameters(this.editData); + } else { + // 新增场景,往左边新加 + this.addParameters(this.editData); + this.addVariable(); + this.$refs.variableTable.cancelCurrentRow(); + } + this.$success(this.$t('commons.save_success')); + } + }); + } else { + // 更新场景,修改左边数据 + if (this.showDelete) { + this.updateParameters(this.editData); + } else { + // 新增场景,往左边新加 + this.addParameters(this.editData); + this.addVariable(); + this.$refs.variableTable.cancelCurrentRow(); + } + this.$success(this.$t('commons.save_success')); + } + }, + validateRepository(callback) { + // 校验所选的Git仓库、Git分支下有没有对应的文件 + if (this.editData.type === 'CSV' && this.editData.fileResource && this.editData.fileResource === 'repository') { + let param = { + repositoryId: this.editData.repositoryId, + repositoryBranch: this.editData.repositoryBranch, + repositoryFilePath: this.editData.repositoryFilePath, + }; + this.$post(this.validateRepositoryPath, param, response => { + if (!response.data.success) { + this.$error(response.data.message); + callback(false); + } else { + callback(true); + } + }); + } else { + callback(true); } - this.$success(this.$t('commons.save_success')); }, cancelVariable() { this.$refs.variableTable.cancelCurrentRow(); @@ -454,7 +498,7 @@ } else { item.hidden = undefined; } - if(this.searchType === 'ALL' && !((this.selectVariable && this.selectVariable != ""))){ + if (this.searchType === 'ALL' && !((this.selectVariable && this.selectVariable != ""))) { item.hidden = undefined; } datas.push(item); @@ -472,13 +516,18 @@ this.updateFiles(); this.showDelete = true; }, - updateFiles(){ + updateFiles() { this.variables.forEach(item => { - if(item.id === this.editData.id){ + if (item.id === this.editData.id) { this.editData.files = item.files } }); } + }, + created() { + if (requireComponent !== null && JSON.stringify(workspaceRepository) !== '{}') { + this.showXpackCompnent = true; + } } }; diff --git a/frontend/src/business/components/common/head/HeaderTopMenus.vue b/frontend/src/business/components/common/head/HeaderTopMenus.vue index 55ca002619..678ac36793 100644 --- a/frontend/src/business/components/common/head/HeaderTopMenus.vue +++ b/frontend/src/business/components/common/head/HeaderTopMenus.vue @@ -40,7 +40,7 @@ + 'WORKSPACE_SERVICE:READ', 'PROJECT_MESSAGE:READ', 'WORKSPACE_USER:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ', 'WORKSPACE_REPOSITORY:READ']"> {{ $t('commons.system_setting') }} diff --git a/frontend/src/business/components/settings/SettingMenu.vue b/frontend/src/business/components/settings/SettingMenu.vue index 46a272e2e4..93279be6eb 100644 --- a/frontend/src/business/components/settings/SettingMenu.vue +++ b/frontend/src/business/components/settings/SettingMenu.vue @@ -59,7 +59,7 @@ export default { ], workspacePermission: ['WORKSPACE_USER:READ', 'WORKSPACE_SERVICE:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', - 'WORKSPACE_OPERATING_LOG:READ'] + 'WORKSPACE_OPERATING_LOG:READ','WORKSPACE_REPOSITORY:READ'] }; }, methods: { diff --git a/frontend/src/business/components/settings/router.js b/frontend/src/business/components/settings/router.js index d097a770cd..878e77252f 100644 --- a/frontend/src/business/components/settings/router.js +++ b/frontend/src/business/components/settings/router.js @@ -92,5 +92,6 @@ export default { component: () => import('@/business/components/settings/plugin/PluginConfig'), meta: {system: true, title: 'plugin.title', permissions: ['SYSTEM_PLUGIN:READ']} }, + ...requireContext.keys().map(key => requireContext(key).repository), ] }; diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 8add0b0a2c..825408ce94 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 8add0b0a2cc869390734c0a04590f6a945e61cda +Subproject commit 825408ce94058dab7d1e24a273b49643bceac408 diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 6b53c79420..8eb3ffcdf3 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -439,7 +439,11 @@ export default { sync_other_info: "Copy other config", delete_current_version: 'Current version', delete_all_version: 'All versions', - change_password_tips: 'Your password is the initial system password, please change it as soon as possible' + change_password_tips: 'Your password is the initial system password, please change it as soon as possible', + git_repository: 'Git Repository', + repositoryUrl: 'Git Repository Url', + repositoryName: 'Git Repository Name', + repositoryUsername: 'User name' }, login: { normal_Login: "Normal Login", @@ -563,6 +567,7 @@ export default { template_manage: "Template Manage", case_template_manage: "Case Template", issue_template_manage: "Issue Template", + system_setting_git_repository: 'MS sets up git repositories at the system level', custom_filed: { input: 'Input', textarea: 'Textarea', @@ -831,6 +836,19 @@ export default { input_id_or_email: 'Please enter user ID, or user Email', no_such_user: 'Without this user information, please enter the correct user ID or user Email!', }, + repository: { + create: 'Add the repository', + modify: 'Modifying the repository', + delete_confirm: 'Are you sure you want to delete this repository?', + please_choose_repository: 'Select the repository', + search_by_name: 'Search by name', + modify_repository_info: 'Modify repository information', + input_repository_name: 'Please enter a repository name', + special_characters_are_not_supported: 'Special characters are not supported', + input_repository_url: 'Please enter the repository address', + input_username: 'Please enter a user name', + input_password: 'Please enter your password', + }, user: { id: 'User ID', create: 'Create', @@ -2633,6 +2651,14 @@ export default { delimiter: "Delimiter", format: "Output format", quoted_data: "Whether to allow quotes", + file_resource: "Source file", + local_file: "The local file", + git_repository: "Git repository", + git_branch: "Git branch", + git_branch_placeholder: "Git branch name, case sensitive", + git_file_path: "The file path", + git_file_path_placeholder: "Path to the CSV file in the repository", + choose_git_repository: "Select the Git repository" }, auth_source: { delete_prompt: 'This operation will delete the authentication source, do you want to continue? ', @@ -3068,7 +3094,14 @@ export default { performance: "Performance", project: "Project", report: "Report Statistics" - } + }, + workspace_repository: { + name: "Git repository", + read: "Querying the repository", + create: "Adding a repository", + edit: "Edit repository", + delete: "Deleting a repository", + }, }, env_options: { all_assertions: "Assertions" diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index fc4545c833..88f5be31a7 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -442,6 +442,10 @@ export default { delete_current_version: '列表版本', delete_all_version: '全部版本', change_password_tips: '您的密码是系统初始密码,请尽快修改密码', + git_repository: 'Git存储库', + repositoryUrl: 'Git存储库地址', + repositoryName: 'Git存储库名称', + repositoryUsername: '用户名' }, login: { normal_Login: "普通登录", @@ -565,6 +569,7 @@ export default { template_manage: "模版管理", case_template_manage: "用例模版", issue_template_manage: "缺陷模版", + system_setting_git_repository: 'MS在系统级别设置git仓库', custom_filed: { input: '输入框', textarea: '文本框', @@ -835,6 +840,19 @@ export default { input_id_or_email: '请输入用户 ID, 或者 用户邮箱', no_such_user: '无此用户信息, 请输入正确的用户 ID 或者 用户邮箱!', }, + repository: { + create: '添加存储库', + modify: '修改存储库', + delete_confirm: '确定要删除这个存储库吗?', + please_choose_repository: '请选择存储库', + search_by_name: '根据名称搜索', + modify_repository_info: '修改存储库信息', + input_repository_name: '请输入存储库名称', + special_characters_are_not_supported: '不支持特殊字符', + input_repository_url: '请输入存储库地址', + input_username: '请输入用户名', + input_password: '请输入密码', + }, user: { id: '用户ID', create: '创建用户', @@ -2636,6 +2654,14 @@ export default { delimiter: "分隔符", format: "输出格式", quoted_data: "是否允许带引号", + file_resource: "文件来源", + local_file: "本地文件", + git_repository: "Git存储库", + git_branch: "Git分支", + git_branch_placeholder: "Git分支名,区分大小写", + git_file_path: "文件路径", + git_file_path_placeholder: "存储库中的CSV文件的所在路径", + choose_git_repository: "请选择Git存储库" }, auth_source: { delete_prompt: '此操作会删除认证源,是否继续?', @@ -3072,7 +3098,14 @@ export default { performance: "性能测试", project: "项目设置", report: "报表统计", - } + }, + workspace_repository: { + name: "Git存储库", + read: "查询存储库", + create: "添加存储库", + edit: "编辑存储库", + delete: "删除存储库", + }, }, env_options: { all_assertions: "全局断言" diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 3d2bfc79b7..6669b7f738 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -442,6 +442,10 @@ export default { delete_current_version: '列表版本', delete_all_version: '全部版本', change_password_tips: '您的密碼是系統初始密碼,請盡快修改密碼', + git_repository: 'Git存儲庫', + repositoryUrl: 'Git存儲庫地址', + repositoryName: 'Git存儲庫名稱', + repositoryUsername: '用戶名' }, login: { normal_Login: "普通登錄", @@ -565,6 +569,7 @@ export default { template_manage: "模版管理", case_template_manage: "用例模版", issue_template_manage: "缺陷模版", + system_setting_git_repository: 'MS在系統級別設置git倉庫', custom_filed: { input: '輸入框', textarea: '文本框', @@ -835,6 +840,19 @@ export default { input_id_or_email: '請輸入用戶 ID, 或者 用戶郵箱', no_such_user: '無此用戶信息, 請輸入正確的用戶 ID 或者 用戶郵箱!', }, + repository: { + create: '添加存儲庫', + modify: '修改存儲庫', + delete_confirm: '確定要刪除這個存儲庫嗎?', + please_choose_repository: '請選擇存儲庫', + search_by_name: '根據名稱搜索', + modify_repository_info: '修改存儲庫信息', + input_repository_name: '請輸入存儲庫名稱', + special_characters_are_not_supported: '不支持特殊字符', + input_repository_url: '請輸入存儲庫地址', + input_username: '請輸入用戶名', + input_password: '請輸入密碼', + }, user: { id: '用戶ID', create: '創建用戶', @@ -2635,6 +2653,14 @@ export default { delimiter: "分隔符", format: "輸出格式", quoted_data: "是否允許帶引號", + file_resource: "文件來源", + local_file: "本地文件", + git_repository: "Git存儲庫", + git_branch: "Git分支", + git_branch_placeholder: "Git分支名,區分大小寫", + git_file_path: "文件路徑", + git_file_path_placeholder: "存儲庫中的CSV文件的所在路徑", + choose_git_repository: "請選擇Git存儲庫" }, auth_source: { delete_prompt: '此操作會刪除認證源,是否繼續?', @@ -3071,7 +3097,14 @@ export default { performance: "性能測試", project: "項目設置", report: "報表統計" - } + }, + workspace_repository: { + name: "Git存儲庫", + read: "查詢存儲庫", + create: "添加存儲庫", + edit: "編輯存儲庫", + delete: "刪除存儲庫", + }, }, env_options: { all_assertions: "全局斷言" diff --git a/frontend/src/login/Login.vue b/frontend/src/login/Login.vue index 5147a9ac88..f4af51ef44 100644 --- a/frontend/src/login/Login.vue +++ b/frontend/src/login/Login.vue @@ -231,7 +231,7 @@ export default { let redirectUrl = '/'; if (hasPermissions('PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_OPERATING_LOG:READ', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_CUSTOM_CODE:READ', 'PROJECT_MESSAGE:READ', 'PROJECT_TEMPLATE:READ')) { redirectUrl = '/project/home'; - } else if (hasPermissions('WORKSPACE_SERVICE:READ', 'WORKSPACE_USER:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ')) { + } else if (hasPermissions('WORKSPACE_SERVICE:READ', 'WORKSPACE_USER:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ', 'WORKSPACE_REPOSITORY:READ')) { redirectUrl = '/setting/project/:type'; } else if (hasPermissions('SYSTEM_USER:READ', 'SYSTEM_WORKSPACE:READ', 'SYSTEM_GROUP:READ', 'SYSTEM_TEST_POOL:READ', 'SYSTEM_SETTING:READ', 'SYSTEM_AUTH:READ', 'SYSTEM_QUOTA:READ', 'SYSTEM_OPERATING_LOG:READ')) { redirectUrl = '/setting';