feat(系统设置): 组织模板接口实现

--task=1012795 --user=陈建星 项目管理-模版管理-后台 https://www.tapd.cn/55049933/s/1413162
This commit is contained in:
AgAngle 2023-08-29 09:47:55 +08:00 committed by 刘瑞斌
parent e94beb9fbd
commit ac387b6fd0
82 changed files with 4181 additions and 3413 deletions

View File

@ -1,670 +0,0 @@
package io.metersphere.project.domain;
import java.util.ArrayList;
import java.util.List;
public class BugTemplateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BugTemplateExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> 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 andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andInternalIsNull() {
addCriterion("internal is null");
return (Criteria) this;
}
public Criteria andInternalIsNotNull() {
addCriterion("internal is not null");
return (Criteria) this;
}
public Criteria andInternalEqualTo(Boolean value) {
addCriterion("internal =", value, "internal");
return (Criteria) this;
}
public Criteria andInternalNotEqualTo(Boolean value) {
addCriterion("internal <>", value, "internal");
return (Criteria) this;
}
public Criteria andInternalGreaterThan(Boolean value) {
addCriterion("internal >", value, "internal");
return (Criteria) this;
}
public Criteria andInternalGreaterThanOrEqualTo(Boolean value) {
addCriterion("internal >=", value, "internal");
return (Criteria) this;
}
public Criteria andInternalLessThan(Boolean value) {
addCriterion("internal <", value, "internal");
return (Criteria) this;
}
public Criteria andInternalLessThanOrEqualTo(Boolean value) {
addCriterion("internal <=", value, "internal");
return (Criteria) this;
}
public Criteria andInternalIn(List<Boolean> values) {
addCriterion("internal in", values, "internal");
return (Criteria) this;
}
public Criteria andInternalNotIn(List<Boolean> values) {
addCriterion("internal not in", values, "internal");
return (Criteria) this;
}
public Criteria andInternalBetween(Boolean value1, Boolean value2) {
addCriterion("internal between", value1, value2, "internal");
return (Criteria) this;
}
public Criteria andInternalNotBetween(Boolean value1, Boolean value2) {
addCriterion("internal not between", value1, value2, "internal");
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<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> 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 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<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> 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 andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
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);
}
}
}

View File

@ -1,340 +0,0 @@
package io.metersphere.project.domain;
import java.util.ArrayList;
import java.util.List;
public class BugTemplateExtendExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BugTemplateExtendExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> 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 andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
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);
}
}
}

View File

@ -1,118 +0,0 @@
package io.metersphere.project.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;
@Data
public class FunctionalCaseTemplate implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{functional_case_template.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{functional_case_template.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "描述")
private String description;
@Schema(description = "是否是内置模板")
private Boolean internal;
@Schema(description = "创建时间")
private Long createTime;
@Schema(description = "创建人")
private String createUser;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_template.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{functional_case_template.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
description("description", "description", "VARCHAR", false),
internal("internal", "internal", "BIT", false),
createTime("create_time", "createTime", "BIGINT", false),
createUser("create_user", "createUser", "VARCHAR", false),
projectId("project_id", "projectId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";
private static final String ENDING_DELIMITER = "`";
private final String column;
private final boolean isColumnNameDelimited;
private final String javaProperty;
private final String jdbcType;
public String value() {
return this.column;
}
public String getValue() {
return this.column;
}
public String getJavaProperty() {
return this.javaProperty;
}
public String getJdbcType() {
return this.jdbcType;
}
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
public static Column[] all() {
return Column.values();
}
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
public String getAliasedEscapedColumnName() {
return this.getEscapedColumnName();
}
}
}

View File

@ -1,34 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.ApiTemplate;
import io.metersphere.project.domain.ApiTemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTemplateMapper {
long countByExample(ApiTemplateExample example);
int deleteByExample(ApiTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(ApiTemplate record);
int insertSelective(ApiTemplate record);
List<ApiTemplate> selectByExample(ApiTemplateExample example);
ApiTemplate selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiTemplate record, @Param("example") ApiTemplateExample example);
int updateByExample(@Param("record") ApiTemplate record, @Param("example") ApiTemplateExample example);
int updateByPrimaryKeySelective(ApiTemplate record);
int updateByPrimaryKey(ApiTemplate record);
int batchInsert(@Param("list") List<ApiTemplate> list);
int batchInsertSelective(@Param("list") List<ApiTemplate> list, @Param("selective") ApiTemplate.Column ... selective);
}

View File

@ -1,40 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.BugTemplateExtend;
import io.metersphere.project.domain.BugTemplateExtendExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface BugTemplateExtendMapper {
long countByExample(BugTemplateExtendExample example);
int deleteByExample(BugTemplateExtendExample example);
int deleteByPrimaryKey(String id);
int insert(BugTemplateExtend record);
int insertSelective(BugTemplateExtend record);
List<BugTemplateExtend> selectByExampleWithBLOBs(BugTemplateExtendExample example);
List<BugTemplateExtend> selectByExample(BugTemplateExtendExample example);
BugTemplateExtend selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") BugTemplateExtend record, @Param("example") BugTemplateExtendExample example);
int updateByExampleWithBLOBs(@Param("record") BugTemplateExtend record, @Param("example") BugTemplateExtendExample example);
int updateByExample(@Param("record") BugTemplateExtend record, @Param("example") BugTemplateExtendExample example);
int updateByPrimaryKeySelective(BugTemplateExtend record);
int updateByPrimaryKeyWithBLOBs(BugTemplateExtend record);
int updateByPrimaryKey(BugTemplateExtend record);
int batchInsert(@Param("list") List<BugTemplateExtend> list);
int batchInsertSelective(@Param("list") List<BugTemplateExtend> list, @Param("selective") BugTemplateExtend.Column ... selective);
}

View File

@ -1,34 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.BugTemplate;
import io.metersphere.project.domain.BugTemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface BugTemplateMapper {
long countByExample(BugTemplateExample example);
int deleteByExample(BugTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(BugTemplate record);
int insertSelective(BugTemplate record);
List<BugTemplate> selectByExample(BugTemplateExample example);
BugTemplate selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") BugTemplate record, @Param("example") BugTemplateExample example);
int updateByExample(@Param("record") BugTemplate record, @Param("example") BugTemplateExample example);
int updateByPrimaryKeySelective(BugTemplate record);
int updateByPrimaryKey(BugTemplate record);
int batchInsert(@Param("list") List<BugTemplate> list);
int batchInsertSelective(@Param("list") List<BugTemplate> list, @Param("selective") BugTemplate.Column ... selective);
}

View File

@ -1,40 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.CustomFieldTemplate;
import io.metersphere.project.domain.CustomFieldTemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface CustomFieldTemplateMapper {
long countByExample(CustomFieldTemplateExample example);
int deleteByExample(CustomFieldTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(CustomFieldTemplate record);
int insertSelective(CustomFieldTemplate record);
List<CustomFieldTemplate> selectByExampleWithBLOBs(CustomFieldTemplateExample example);
List<CustomFieldTemplate> selectByExample(CustomFieldTemplateExample example);
CustomFieldTemplate selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") CustomFieldTemplate record, @Param("example") CustomFieldTemplateExample example);
int updateByExampleWithBLOBs(@Param("record") CustomFieldTemplate record, @Param("example") CustomFieldTemplateExample example);
int updateByExample(@Param("record") CustomFieldTemplate record, @Param("example") CustomFieldTemplateExample example);
int updateByPrimaryKeySelective(CustomFieldTemplate record);
int updateByPrimaryKeyWithBLOBs(CustomFieldTemplate record);
int updateByPrimaryKey(CustomFieldTemplate record);
int batchInsert(@Param("list") List<CustomFieldTemplate> list);
int batchInsertSelective(@Param("list") List<CustomFieldTemplate> list, @Param("selective") CustomFieldTemplate.Column ... selective);
}

View File

@ -1,40 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.FunctionalCaseTemplateExtend;
import io.metersphere.project.domain.FunctionalCaseTemplateExtendExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FunctionalCaseTemplateExtendMapper {
long countByExample(FunctionalCaseTemplateExtendExample example);
int deleteByExample(FunctionalCaseTemplateExtendExample example);
int deleteByPrimaryKey(String id);
int insert(FunctionalCaseTemplateExtend record);
int insertSelective(FunctionalCaseTemplateExtend record);
List<FunctionalCaseTemplateExtend> selectByExampleWithBLOBs(FunctionalCaseTemplateExtendExample example);
List<FunctionalCaseTemplateExtend> selectByExample(FunctionalCaseTemplateExtendExample example);
FunctionalCaseTemplateExtend selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FunctionalCaseTemplateExtend record, @Param("example") FunctionalCaseTemplateExtendExample example);
int updateByExampleWithBLOBs(@Param("record") FunctionalCaseTemplateExtend record, @Param("example") FunctionalCaseTemplateExtendExample example);
int updateByExample(@Param("record") FunctionalCaseTemplateExtend record, @Param("example") FunctionalCaseTemplateExtendExample example);
int updateByPrimaryKeySelective(FunctionalCaseTemplateExtend record);
int updateByPrimaryKeyWithBLOBs(FunctionalCaseTemplateExtend record);
int updateByPrimaryKey(FunctionalCaseTemplateExtend record);
int batchInsert(@Param("list") List<FunctionalCaseTemplateExtend> list);
int batchInsertSelective(@Param("list") List<FunctionalCaseTemplateExtend> list, @Param("selective") FunctionalCaseTemplateExtend.Column ... selective);
}

View File

@ -1,348 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.FunctionalCaseTemplateExtendMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="case_name" jdbcType="VARCHAR" property="caseName" />
<result column="step_model" jdbcType="VARCHAR" property="stepModel" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
<result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" />
<result column="step_description" jdbcType="LONGVARCHAR" property="stepDescription" />
<result column="expected_result" jdbcType="LONGVARCHAR" property="expectedResult" />
<result column="actual_result" jdbcType="LONGVARCHAR" property="actualResult" />
<result column="steps" jdbcType="LONGVARCHAR" property="steps" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, case_name, step_model
</sql>
<sql id="Blob_Column_List">
prerequisite, step_description, expected_result, actual_result, steps
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from functional_case_template_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from functional_case_template_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from functional_case_template_extend
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from functional_case_template_extend
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample">
delete from functional_case_template_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
insert into functional_case_template_extend (id, case_name, step_model,
prerequisite, step_description,
expected_result, actual_result, steps
)
values (#{id,jdbcType=VARCHAR}, #{caseName,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR},
#{prerequisite,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR},
#{expectedResult,jdbcType=LONGVARCHAR}, #{actualResult,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
insert into functional_case_template_extend
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="caseName != null">
case_name,
</if>
<if test="stepModel != null">
step_model,
</if>
<if test="prerequisite != null">
prerequisite,
</if>
<if test="stepDescription != null">
step_description,
</if>
<if test="expectedResult != null">
expected_result,
</if>
<if test="actualResult != null">
actual_result,
</if>
<if test="steps != null">
steps,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="caseName != null">
#{caseName,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR},
</if>
<if test="prerequisite != null">
#{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
#{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
#{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="actualResult != null">
#{actualResult,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
#{steps,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultType="java.lang.Long">
select count(*) from functional_case_template_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update functional_case_template_extend
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.caseName != null">
case_name = #{record.caseName,jdbcType=VARCHAR},
</if>
<if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR},
</if>
<if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepDescription != null">
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="record.expectedResult != null">
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="record.actualResult != null">
actual_result = #{record.actualResult,jdbcType=LONGVARCHAR},
</if>
<if test="record.steps != null">
steps = #{record.steps,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update functional_case_template_extend
set id = #{record.id,jdbcType=VARCHAR},
case_name = #{record.caseName,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR},
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
actual_result = #{record.actualResult,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update functional_case_template_extend
set id = #{record.id,jdbcType=VARCHAR},
case_name = #{record.caseName,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
update functional_case_template_extend
<set>
<if test="caseName != null">
case_name = #{caseName,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR},
</if>
<if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="actualResult != null">
actual_result = #{actualResult,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
steps = #{steps,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
update functional_case_template_extend
set case_name = #{caseName,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
actual_result = #{actualResult,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
update functional_case_template_extend
set case_name = #{caseName,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into functional_case_template_extend
(id, case_name, step_model, prerequisite, step_description, expected_result, actual_result,
steps)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.caseName,jdbcType=VARCHAR}, #{item.stepModel,jdbcType=VARCHAR},
#{item.prerequisite,jdbcType=LONGVARCHAR}, #{item.stepDescription,jdbcType=LONGVARCHAR},
#{item.expectedResult,jdbcType=LONGVARCHAR}, #{item.actualResult,jdbcType=LONGVARCHAR},
#{item.steps,jdbcType=LONGVARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into functional_case_template_extend (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
)
values
<foreach collection="list" item="item" separator=",">
(
<foreach collection="selective" item="column" separator=",">
<if test="'id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR}
</if>
<if test="'case_name'.toString() == column.value">
#{item.caseName,jdbcType=VARCHAR}
</if>
<if test="'step_model'.toString() == column.value">
#{item.stepModel,jdbcType=VARCHAR}
</if>
<if test="'prerequisite'.toString() == column.value">
#{item.prerequisite,jdbcType=LONGVARCHAR}
</if>
<if test="'step_description'.toString() == column.value">
#{item.stepDescription,jdbcType=LONGVARCHAR}
</if>
<if test="'expected_result'.toString() == column.value">
#{item.expectedResult,jdbcType=LONGVARCHAR}
</if>
<if test="'actual_result'.toString() == column.value">
#{item.actualResult,jdbcType=LONGVARCHAR}
</if>
<if test="'steps'.toString() == column.value">
#{item.steps,jdbcType=LONGVARCHAR}
</if>
</foreach>
)
</foreach>
</insert>
</mapper>

View File

@ -1,34 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.FunctionalCaseTemplate;
import io.metersphere.project.domain.FunctionalCaseTemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FunctionalCaseTemplateMapper {
long countByExample(FunctionalCaseTemplateExample example);
int deleteByExample(FunctionalCaseTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(FunctionalCaseTemplate record);
int insertSelective(FunctionalCaseTemplate record);
List<FunctionalCaseTemplate> selectByExample(FunctionalCaseTemplateExample example);
FunctionalCaseTemplate selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FunctionalCaseTemplate record, @Param("example") FunctionalCaseTemplateExample example);
int updateByExample(@Param("record") FunctionalCaseTemplate record, @Param("example") FunctionalCaseTemplateExample example);
int updateByPrimaryKeySelective(FunctionalCaseTemplate record);
int updateByPrimaryKey(FunctionalCaseTemplate record);
int batchInsert(@Param("list") List<FunctionalCaseTemplate> list);
int batchInsertSelective(@Param("list") List<FunctionalCaseTemplate> list, @Param("selective") FunctionalCaseTemplate.Column ... selective);
}

View File

@ -1,288 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.FunctionalCaseTemplateMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.FunctionalCaseTemplate">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="internal" jdbcType="BIT" property="internal" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, description, internal, create_time, create_user, project_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from functional_case_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from functional_case_template
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from functional_case_template
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExample">
delete from functional_case_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.FunctionalCaseTemplate">
insert into functional_case_template (id, `name`, description,
internal, create_time, create_user,
project_id)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{internal,jdbcType=BIT}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplate">
insert into functional_case_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
</if>
<if test="internal != null">
internal,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="projectId != null">
project_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="internal != null">
#{internal,jdbcType=BIT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExample" resultType="java.lang.Long">
select count(*) from functional_case_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update functional_case_template
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.internal != null">
internal = #{record.internal,jdbcType=BIT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update functional_case_template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
internal = #{record.internal,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplate">
update functional_case_template
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="internal != null">
internal = #{internal,jdbcType=BIT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.FunctionalCaseTemplate">
update functional_case_template
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
internal = #{internal,jdbcType=BIT},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into functional_case_template
(id, `name`, description, internal, create_time, create_user, project_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR},
#{item.internal,jdbcType=BIT}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.projectId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into functional_case_template (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
)
values
<foreach collection="list" item="item" separator=",">
(
<foreach collection="selective" item="column" separator=",">
<if test="'id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR}
</if>
<if test="'name'.toString() == column.value">
#{item.name,jdbcType=VARCHAR}
</if>
<if test="'description'.toString() == column.value">
#{item.description,jdbcType=VARCHAR}
</if>
<if test="'internal'.toString() == column.value">
#{item.internal,jdbcType=BIT}
</if>
<if test="'create_time'.toString() == column.value">
#{item.createTime,jdbcType=BIGINT}
</if>
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>
<if test="'project_id'.toString() == column.value">
#{item.projectId,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>
</insert>
</mapper>

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -10,52 +10,51 @@ import lombok.Data;
@Data
public class CustomField implements Serializable {
@Schema(description = "自定义字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "自定义字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{custom_field.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "自定义字段名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "自定义字段名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{custom_field.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{custom_field.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
@Schema(description = "自定义字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "自定义字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{custom_field.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(description = "自定义字段备注")
@Schema(description = "自定义字段备注")
private String remark;
@Schema(description = "是否是系统字段")
private Boolean system;
@Schema(description = "是否是内置字段", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{custom_field.internal.not_blank}", groups = {Created.class})
private Boolean internal;
@Schema(description = "是否是全局字段")
private Boolean global;
@Schema(description = "组织或项目级别字段PROJECT, ORGANIZATION", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.scope_type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field.scope_type.length_range}", groups = {Created.class, Updated.class})
private String scopeType;
@Schema(description = "创建时间")
@Schema(description = "创建时间")
private Long createTime;
@Schema(description = "更新时间")
@Schema(description = "更新时间")
private Long updateTime;
@Schema(description = "创建人")
@Schema(description = "创建人")
private String createUser;
@Schema(description = "项目ID")
private String projectId;
@Schema(description = "是否关联第三方")
private Boolean thirdPart;
@Schema(description = "自定义字段选项")
private String options;
@Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field.scope_id.length_range}", groups = {Created.class, Updated.class})
private String scopeId;
private static final long serialVersionUID = 1L;
@ -65,14 +64,12 @@ public class CustomField implements Serializable {
scene("scene", "scene", "VARCHAR", false),
type("type", "type", "VARCHAR", true),
remark("remark", "remark", "VARCHAR", false),
system("system", "system", "BIT", true),
global("global", "global", "BIT", true),
internal("internal", "internal", "BIT", false),
scopeType("scope_type", "scopeType", "VARCHAR", false),
createTime("create_time", "createTime", "BIGINT", false),
updateTime("update_time", "updateTime", "BIGINT", false),
createUser("create_user", "createUser", "VARCHAR", false),
projectId("project_id", "projectId", "VARCHAR", false),
thirdPart("third_part", "thirdPart", "BIT", false),
options("options", "options", "LONGVARCHAR", true);
scopeId("scope_id", "scopeId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
@ -454,123 +454,133 @@ public class CustomFieldExample {
return (Criteria) this;
}
public Criteria andSystemIsNull() {
addCriterion("`system` is null");
public Criteria andInternalIsNull() {
addCriterion("internal is null");
return (Criteria) this;
}
public Criteria andSystemIsNotNull() {
addCriterion("`system` is not null");
public Criteria andInternalIsNotNull() {
addCriterion("internal is not null");
return (Criteria) this;
}
public Criteria andSystemEqualTo(Boolean value) {
addCriterion("`system` =", value, "system");
public Criteria andInternalEqualTo(Boolean value) {
addCriterion("internal =", value, "internal");
return (Criteria) this;
}
public Criteria andSystemNotEqualTo(Boolean value) {
addCriterion("`system` <>", value, "system");
public Criteria andInternalNotEqualTo(Boolean value) {
addCriterion("internal <>", value, "internal");
return (Criteria) this;
}
public Criteria andSystemGreaterThan(Boolean value) {
addCriterion("`system` >", value, "system");
public Criteria andInternalGreaterThan(Boolean value) {
addCriterion("internal >", value, "internal");
return (Criteria) this;
}
public Criteria andSystemGreaterThanOrEqualTo(Boolean value) {
addCriterion("`system` >=", value, "system");
public Criteria andInternalGreaterThanOrEqualTo(Boolean value) {
addCriterion("internal >=", value, "internal");
return (Criteria) this;
}
public Criteria andSystemLessThan(Boolean value) {
addCriterion("`system` <", value, "system");
public Criteria andInternalLessThan(Boolean value) {
addCriterion("internal <", value, "internal");
return (Criteria) this;
}
public Criteria andSystemLessThanOrEqualTo(Boolean value) {
addCriterion("`system` <=", value, "system");
public Criteria andInternalLessThanOrEqualTo(Boolean value) {
addCriterion("internal <=", value, "internal");
return (Criteria) this;
}
public Criteria andSystemIn(List<Boolean> values) {
addCriterion("`system` in", values, "system");
public Criteria andInternalIn(List<Boolean> values) {
addCriterion("internal in", values, "internal");
return (Criteria) this;
}
public Criteria andSystemNotIn(List<Boolean> values) {
addCriterion("`system` not in", values, "system");
public Criteria andInternalNotIn(List<Boolean> values) {
addCriterion("internal not in", values, "internal");
return (Criteria) this;
}
public Criteria andSystemBetween(Boolean value1, Boolean value2) {
addCriterion("`system` between", value1, value2, "system");
public Criteria andInternalBetween(Boolean value1, Boolean value2) {
addCriterion("internal between", value1, value2, "internal");
return (Criteria) this;
}
public Criteria andSystemNotBetween(Boolean value1, Boolean value2) {
addCriterion("`system` not between", value1, value2, "system");
public Criteria andInternalNotBetween(Boolean value1, Boolean value2) {
addCriterion("internal not between", value1, value2, "internal");
return (Criteria) this;
}
public Criteria andGlobalIsNull() {
addCriterion("`global` is null");
public Criteria andScopeTypeIsNull() {
addCriterion("scope_type is null");
return (Criteria) this;
}
public Criteria andGlobalIsNotNull() {
addCriterion("`global` is not null");
public Criteria andScopeTypeIsNotNull() {
addCriterion("scope_type is not null");
return (Criteria) this;
}
public Criteria andGlobalEqualTo(Boolean value) {
addCriterion("`global` =", value, "global");
public Criteria andScopeTypeEqualTo(String value) {
addCriterion("scope_type =", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalNotEqualTo(Boolean value) {
addCriterion("`global` <>", value, "global");
public Criteria andScopeTypeNotEqualTo(String value) {
addCriterion("scope_type <>", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalGreaterThan(Boolean value) {
addCriterion("`global` >", value, "global");
public Criteria andScopeTypeGreaterThan(String value) {
addCriterion("scope_type >", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalGreaterThanOrEqualTo(Boolean value) {
addCriterion("`global` >=", value, "global");
public Criteria andScopeTypeGreaterThanOrEqualTo(String value) {
addCriterion("scope_type >=", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalLessThan(Boolean value) {
addCriterion("`global` <", value, "global");
public Criteria andScopeTypeLessThan(String value) {
addCriterion("scope_type <", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalLessThanOrEqualTo(Boolean value) {
addCriterion("`global` <=", value, "global");
public Criteria andScopeTypeLessThanOrEqualTo(String value) {
addCriterion("scope_type <=", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalIn(List<Boolean> values) {
addCriterion("`global` in", values, "global");
public Criteria andScopeTypeLike(String value) {
addCriterion("scope_type like", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalNotIn(List<Boolean> values) {
addCriterion("`global` not in", values, "global");
public Criteria andScopeTypeNotLike(String value) {
addCriterion("scope_type not like", value, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalBetween(Boolean value1, Boolean value2) {
addCriterion("`global` between", value1, value2, "global");
public Criteria andScopeTypeIn(List<String> values) {
addCriterion("scope_type in", values, "scopeType");
return (Criteria) this;
}
public Criteria andGlobalNotBetween(Boolean value1, Boolean value2) {
addCriterion("`global` not between", value1, value2, "global");
public Criteria andScopeTypeNotIn(List<String> values) {
addCriterion("scope_type not in", values, "scopeType");
return (Criteria) this;
}
public Criteria andScopeTypeBetween(String value1, String value2) {
addCriterion("scope_type between", value1, value2, "scopeType");
return (Criteria) this;
}
public Criteria andScopeTypeNotBetween(String value1, String value2) {
addCriterion("scope_type not between", value1, value2, "scopeType");
return (Criteria) this;
}
@ -764,133 +774,73 @@ public class CustomFieldExample {
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
public Criteria andScopeIdIsNull() {
addCriterion("scope_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
public Criteria andScopeIdIsNotNull() {
addCriterion("scope_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
public Criteria andScopeIdEqualTo(String value) {
addCriterion("scope_id =", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
public Criteria andScopeIdNotEqualTo(String value) {
addCriterion("scope_id <>", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
public Criteria andScopeIdGreaterThan(String value) {
addCriterion("scope_id >", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
public Criteria andScopeIdGreaterThanOrEqualTo(String value) {
addCriterion("scope_id >=", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
public Criteria andScopeIdLessThan(String value) {
addCriterion("scope_id <", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
public Criteria andScopeIdLessThanOrEqualTo(String value) {
addCriterion("scope_id <=", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
public Criteria andScopeIdLike(String value) {
addCriterion("scope_id like", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
public Criteria andScopeIdNotLike(String value) {
addCriterion("scope_id not like", value, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
public Criteria andScopeIdIn(List<String> values) {
addCriterion("scope_id in", values, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
public Criteria andScopeIdNotIn(List<String> values) {
addCriterion("scope_id not in", values, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
public Criteria andScopeIdBetween(String value1, String value2) {
addCriterion("scope_id between", value1, value2, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andThirdPartIsNull() {
addCriterion("third_part is null");
return (Criteria) this;
}
public Criteria andThirdPartIsNotNull() {
addCriterion("third_part is not null");
return (Criteria) this;
}
public Criteria andThirdPartEqualTo(Boolean value) {
addCriterion("third_part =", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartNotEqualTo(Boolean value) {
addCriterion("third_part <>", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartGreaterThan(Boolean value) {
addCriterion("third_part >", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartGreaterThanOrEqualTo(Boolean value) {
addCriterion("third_part >=", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartLessThan(Boolean value) {
addCriterion("third_part <", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartLessThanOrEqualTo(Boolean value) {
addCriterion("third_part <=", value, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartIn(List<Boolean> values) {
addCriterion("third_part in", values, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartNotIn(List<Boolean> values) {
addCriterion("third_part not in", values, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartBetween(Boolean value1, Boolean value2) {
addCriterion("third_part between", value1, value2, "thirdPart");
return (Criteria) this;
}
public Criteria andThirdPartNotBetween(Boolean value1, Boolean value2) {
addCriterion("third_part not between", value1, value2, "thirdPart");
public Criteria andScopeIdNotBetween(String value1, String value2) {
addCriterion("scope_id not between", value1, value2, "scopeId");
return (Criteria) this;
}
}

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,44 +9,33 @@ import java.util.Arrays;
import lombok.Data;
@Data
public class FunctionalCaseTemplateExtend implements Serializable {
@Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_template_extend.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{functional_case_template_extend.id.length_range}", groups = {Created.class, Updated.class})
private String id;
public class CustomFieldOption implements Serializable {
@Schema(description = "自定义字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_option.field_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field_option.field_id.length_range}", groups = {Created.class, Updated.class})
private String fieldId;
@Schema(description = "用例名称模板")
private String caseName;
@Schema(description = "选项值", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_option.value.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field_option.value.length_range}", groups = {Created.class, Updated.class})
private String value;
@Schema(description = "编辑模式模板:步骤模式/文本模式")
private String stepModel;
@Schema(description = "选项值名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_option.text.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{custom_field_option.text.length_range}", groups = {Created.class, Updated.class})
private String text;
@Schema(description = "前置条件模板")
private String prerequisite;
@Schema(description = "步骤描述模板")
private String stepDescription;
@Schema(description = "预期结果模板")
private String expectedResult;
@Schema(description = "实际结果模板")
private String actualResult;
@Schema(description = "用例步骤")
private String steps;
@Schema(description = "是否内置", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{custom_field_option.internal.not_blank}", groups = {Created.class})
private Boolean internal;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
caseName("case_name", "caseName", "VARCHAR", false),
stepModel("step_model", "stepModel", "VARCHAR", false),
prerequisite("prerequisite", "prerequisite", "LONGVARCHAR", false),
stepDescription("step_description", "stepDescription", "LONGVARCHAR", false),
expectedResult("expected_result", "expectedResult", "LONGVARCHAR", false),
actualResult("actual_result", "actualResult", "LONGVARCHAR", false),
steps("steps", "steps", "LONGVARCHAR", false);
fieldId("field_id", "fieldId", "VARCHAR", false),
value("value", "value", "VARCHAR", true),
text("text", "text", "VARCHAR", true),
internal("internal", "internal", "BIT", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -0,0 +1,470 @@
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class CustomFieldOptionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CustomFieldOptionExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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 andFieldIdIsNull() {
addCriterion("field_id is null");
return (Criteria) this;
}
public Criteria andFieldIdIsNotNull() {
addCriterion("field_id is not null");
return (Criteria) this;
}
public Criteria andFieldIdEqualTo(String value) {
addCriterion("field_id =", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdNotEqualTo(String value) {
addCriterion("field_id <>", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdGreaterThan(String value) {
addCriterion("field_id >", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdGreaterThanOrEqualTo(String value) {
addCriterion("field_id >=", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdLessThan(String value) {
addCriterion("field_id <", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdLessThanOrEqualTo(String value) {
addCriterion("field_id <=", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdLike(String value) {
addCriterion("field_id like", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdNotLike(String value) {
addCriterion("field_id not like", value, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdIn(List<String> values) {
addCriterion("field_id in", values, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdNotIn(List<String> values) {
addCriterion("field_id not in", values, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdBetween(String value1, String value2) {
addCriterion("field_id between", value1, value2, "fieldId");
return (Criteria) this;
}
public Criteria andFieldIdNotBetween(String value1, String value2) {
addCriterion("field_id not between", value1, value2, "fieldId");
return (Criteria) this;
}
public Criteria andValueIsNull() {
addCriterion("`value` is null");
return (Criteria) this;
}
public Criteria andValueIsNotNull() {
addCriterion("`value` is not null");
return (Criteria) this;
}
public Criteria andValueEqualTo(String value) {
addCriterion("`value` =", value, "value");
return (Criteria) this;
}
public Criteria andValueNotEqualTo(String value) {
addCriterion("`value` <>", value, "value");
return (Criteria) this;
}
public Criteria andValueGreaterThan(String value) {
addCriterion("`value` >", value, "value");
return (Criteria) this;
}
public Criteria andValueGreaterThanOrEqualTo(String value) {
addCriterion("`value` >=", value, "value");
return (Criteria) this;
}
public Criteria andValueLessThan(String value) {
addCriterion("`value` <", value, "value");
return (Criteria) this;
}
public Criteria andValueLessThanOrEqualTo(String value) {
addCriterion("`value` <=", value, "value");
return (Criteria) this;
}
public Criteria andValueLike(String value) {
addCriterion("`value` like", value, "value");
return (Criteria) this;
}
public Criteria andValueNotLike(String value) {
addCriterion("`value` not like", value, "value");
return (Criteria) this;
}
public Criteria andValueIn(List<String> values) {
addCriterion("`value` in", values, "value");
return (Criteria) this;
}
public Criteria andValueNotIn(List<String> values) {
addCriterion("`value` not in", values, "value");
return (Criteria) this;
}
public Criteria andValueBetween(String value1, String value2) {
addCriterion("`value` between", value1, value2, "value");
return (Criteria) this;
}
public Criteria andValueNotBetween(String value1, String value2) {
addCriterion("`value` not between", value1, value2, "value");
return (Criteria) this;
}
public Criteria andTextIsNull() {
addCriterion("`text` is null");
return (Criteria) this;
}
public Criteria andTextIsNotNull() {
addCriterion("`text` is not null");
return (Criteria) this;
}
public Criteria andTextEqualTo(String value) {
addCriterion("`text` =", value, "text");
return (Criteria) this;
}
public Criteria andTextNotEqualTo(String value) {
addCriterion("`text` <>", value, "text");
return (Criteria) this;
}
public Criteria andTextGreaterThan(String value) {
addCriterion("`text` >", value, "text");
return (Criteria) this;
}
public Criteria andTextGreaterThanOrEqualTo(String value) {
addCriterion("`text` >=", value, "text");
return (Criteria) this;
}
public Criteria andTextLessThan(String value) {
addCriterion("`text` <", value, "text");
return (Criteria) this;
}
public Criteria andTextLessThanOrEqualTo(String value) {
addCriterion("`text` <=", value, "text");
return (Criteria) this;
}
public Criteria andTextLike(String value) {
addCriterion("`text` like", value, "text");
return (Criteria) this;
}
public Criteria andTextNotLike(String value) {
addCriterion("`text` not like", value, "text");
return (Criteria) this;
}
public Criteria andTextIn(List<String> values) {
addCriterion("`text` in", values, "text");
return (Criteria) this;
}
public Criteria andTextNotIn(List<String> values) {
addCriterion("`text` not in", values, "text");
return (Criteria) this;
}
public Criteria andTextBetween(String value1, String value2) {
addCriterion("`text` between", value1, value2, "text");
return (Criteria) this;
}
public Criteria andTextNotBetween(String value1, String value2) {
addCriterion("`text` not between", value1, value2, "text");
return (Criteria) this;
}
public Criteria andInternalIsNull() {
addCriterion("internal is null");
return (Criteria) this;
}
public Criteria andInternalIsNotNull() {
addCriterion("internal is not null");
return (Criteria) this;
}
public Criteria andInternalEqualTo(Boolean value) {
addCriterion("internal =", value, "internal");
return (Criteria) this;
}
public Criteria andInternalNotEqualTo(Boolean value) {
addCriterion("internal <>", value, "internal");
return (Criteria) this;
}
public Criteria andInternalGreaterThan(Boolean value) {
addCriterion("internal >", value, "internal");
return (Criteria) this;
}
public Criteria andInternalGreaterThanOrEqualTo(Boolean value) {
addCriterion("internal >=", value, "internal");
return (Criteria) this;
}
public Criteria andInternalLessThan(Boolean value) {
addCriterion("internal <", value, "internal");
return (Criteria) this;
}
public Criteria andInternalLessThanOrEqualTo(Boolean value) {
addCriterion("internal <=", value, "internal");
return (Criteria) this;
}
public Criteria andInternalIn(List<Boolean> values) {
addCriterion("internal in", values, "internal");
return (Criteria) this;
}
public Criteria andInternalNotIn(List<Boolean> values) {
addCriterion("internal not in", values, "internal");
return (Criteria) this;
}
public Criteria andInternalBetween(Boolean value1, Boolean value2) {
addCriterion("internal between", value1, value2, "internal");
return (Criteria) this;
}
public Criteria andInternalNotBetween(Boolean value1, Boolean value2) {
addCriterion("internal not between", value1, value2, "internal");
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);
}
}
}

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,24 +9,26 @@ import java.util.Arrays;
import lombok.Data;
@Data
public class BugTemplateExtend implements Serializable {
@Schema(description = "缺陷模板ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{bug_template_extend.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{bug_template_extend.id.length_range}", groups = {Created.class, Updated.class})
public class StatusDefinition implements Serializable {
@Schema(description = "状态ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_definition.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{status_definition.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "缺陷标题模板")
private String title;
@Schema(description = "状态ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_definition.status_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{status_definition.status_id.length_range}", groups = {Created.class, Updated.class})
private String statusId;
@Schema(description = "缺陷内容模板")
private String content;
@Schema(description = "状态定义ID")
private String definitionId;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
title("title", "title", "VARCHAR", false),
content("content", "content", "LONGVARCHAR", false);
statusId("status_id", "statusId", "VARCHAR", false),
definitionId("definition_id", "definitionId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -1,16 +1,16 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class FunctionalCaseTemplateExtendExample {
public class StatusDefinitionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FunctionalCaseTemplateExtendExample() {
public StatusDefinitionExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -174,143 +174,143 @@ public class FunctionalCaseTemplateExtendExample {
return (Criteria) this;
}
public Criteria andCaseNameIsNull() {
addCriterion("case_name is null");
public Criteria andStatusIdIsNull() {
addCriterion("status_id is null");
return (Criteria) this;
}
public Criteria andCaseNameIsNotNull() {
addCriterion("case_name is not null");
public Criteria andStatusIdIsNotNull() {
addCriterion("status_id is not null");
return (Criteria) this;
}
public Criteria andCaseNameEqualTo(String value) {
addCriterion("case_name =", value, "caseName");
public Criteria andStatusIdEqualTo(String value) {
addCriterion("status_id =", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameNotEqualTo(String value) {
addCriterion("case_name <>", value, "caseName");
public Criteria andStatusIdNotEqualTo(String value) {
addCriterion("status_id <>", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameGreaterThan(String value) {
addCriterion("case_name >", value, "caseName");
public Criteria andStatusIdGreaterThan(String value) {
addCriterion("status_id >", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameGreaterThanOrEqualTo(String value) {
addCriterion("case_name >=", value, "caseName");
public Criteria andStatusIdGreaterThanOrEqualTo(String value) {
addCriterion("status_id >=", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameLessThan(String value) {
addCriterion("case_name <", value, "caseName");
public Criteria andStatusIdLessThan(String value) {
addCriterion("status_id <", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameLessThanOrEqualTo(String value) {
addCriterion("case_name <=", value, "caseName");
public Criteria andStatusIdLessThanOrEqualTo(String value) {
addCriterion("status_id <=", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameLike(String value) {
addCriterion("case_name like", value, "caseName");
public Criteria andStatusIdLike(String value) {
addCriterion("status_id like", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameNotLike(String value) {
addCriterion("case_name not like", value, "caseName");
public Criteria andStatusIdNotLike(String value) {
addCriterion("status_id not like", value, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameIn(List<String> values) {
addCriterion("case_name in", values, "caseName");
public Criteria andStatusIdIn(List<String> values) {
addCriterion("status_id in", values, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameNotIn(List<String> values) {
addCriterion("case_name not in", values, "caseName");
public Criteria andStatusIdNotIn(List<String> values) {
addCriterion("status_id not in", values, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameBetween(String value1, String value2) {
addCriterion("case_name between", value1, value2, "caseName");
public Criteria andStatusIdBetween(String value1, String value2) {
addCriterion("status_id between", value1, value2, "statusId");
return (Criteria) this;
}
public Criteria andCaseNameNotBetween(String value1, String value2) {
addCriterion("case_name not between", value1, value2, "caseName");
public Criteria andStatusIdNotBetween(String value1, String value2) {
addCriterion("status_id not between", value1, value2, "statusId");
return (Criteria) this;
}
public Criteria andStepModelIsNull() {
addCriterion("step_model is null");
public Criteria andDefinitionIdIsNull() {
addCriterion("definition_id is null");
return (Criteria) this;
}
public Criteria andStepModelIsNotNull() {
addCriterion("step_model is not null");
public Criteria andDefinitionIdIsNotNull() {
addCriterion("definition_id is not null");
return (Criteria) this;
}
public Criteria andStepModelEqualTo(String value) {
addCriterion("step_model =", value, "stepModel");
public Criteria andDefinitionIdEqualTo(String value) {
addCriterion("definition_id =", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelNotEqualTo(String value) {
addCriterion("step_model <>", value, "stepModel");
public Criteria andDefinitionIdNotEqualTo(String value) {
addCriterion("definition_id <>", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelGreaterThan(String value) {
addCriterion("step_model >", value, "stepModel");
public Criteria andDefinitionIdGreaterThan(String value) {
addCriterion("definition_id >", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelGreaterThanOrEqualTo(String value) {
addCriterion("step_model >=", value, "stepModel");
public Criteria andDefinitionIdGreaterThanOrEqualTo(String value) {
addCriterion("definition_id >=", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelLessThan(String value) {
addCriterion("step_model <", value, "stepModel");
public Criteria andDefinitionIdLessThan(String value) {
addCriterion("definition_id <", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelLessThanOrEqualTo(String value) {
addCriterion("step_model <=", value, "stepModel");
public Criteria andDefinitionIdLessThanOrEqualTo(String value) {
addCriterion("definition_id <=", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelLike(String value) {
addCriterion("step_model like", value, "stepModel");
public Criteria andDefinitionIdLike(String value) {
addCriterion("definition_id like", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelNotLike(String value) {
addCriterion("step_model not like", value, "stepModel");
public Criteria andDefinitionIdNotLike(String value) {
addCriterion("definition_id not like", value, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelIn(List<String> values) {
addCriterion("step_model in", values, "stepModel");
public Criteria andDefinitionIdIn(List<String> values) {
addCriterion("definition_id in", values, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelNotIn(List<String> values) {
addCriterion("step_model not in", values, "stepModel");
public Criteria andDefinitionIdNotIn(List<String> values) {
addCriterion("definition_id not in", values, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelBetween(String value1, String value2) {
addCriterion("step_model between", value1, value2, "stepModel");
public Criteria andDefinitionIdBetween(String value1, String value2) {
addCriterion("definition_id between", value1, value2, "definitionId");
return (Criteria) this;
}
public Criteria andStepModelNotBetween(String value1, String value2) {
addCriterion("step_model not between", value1, value2, "stepModel");
public Criteria andDefinitionIdNotBetween(String value1, String value2) {
addCriterion("definition_id not between", value1, value2, "definitionId");
return (Criteria) this;
}
}

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,44 +9,49 @@ import java.util.Arrays;
import lombok.Data;
@Data
public class ApiTemplate implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{api_template.id.length_range}", groups = {Created.class, Updated.class})
public class StatusItem implements Serializable {
@Schema(description = "状态ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_item.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{status_item.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{api_template.name.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "状态名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_item.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{status_item.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "描述")
private String description;
@Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_item.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{status_item.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
@Schema(description = "是否是内置模板")
@Schema(description = "状态说明")
private String remark;
@Schema(description = "是否是内置字段", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{status_item.internal.not_blank}", groups = {Created.class})
private Boolean internal;
@Schema(description = "创建时间")
private Long createTime;
@Schema(description = "组织或项目级别字段PROJECT, ORGANIZATION", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_item.scope_type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{status_item.scope_type.length_range}", groups = {Created.class, Updated.class})
private String scopeType;
@Schema(description = "创建人")
private String createUser;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_template.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{api_template.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{status_item.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{status_item.scope_id.length_range}", groups = {Created.class, Updated.class})
private String scopeId;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
description("description", "description", "VARCHAR", false),
scene("scene", "scene", "VARCHAR", false),
remark("remark", "remark", "VARCHAR", false),
internal("internal", "internal", "BIT", false),
createTime("create_time", "createTime", "BIGINT", false),
createUser("create_user", "createUser", "VARCHAR", false),
projectId("project_id", "projectId", "VARCHAR", false);
scopeType("scope_type", "scopeType", "VARCHAR", false),
scopeId("scope_id", "scopeId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -1,16 +1,16 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiTemplateExample {
public class StatusItemExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiTemplateExample() {
public StatusItemExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -244,73 +244,143 @@ public class ApiTemplateExample {
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
public Criteria andSceneIsNull() {
addCriterion("scene is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
public Criteria andSceneIsNotNull() {
addCriterion("scene is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
public Criteria andSceneEqualTo(String value) {
addCriterion("scene =", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
public Criteria andSceneNotEqualTo(String value) {
addCriterion("scene <>", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
public Criteria andSceneGreaterThan(String value) {
addCriterion("scene >", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
public Criteria andSceneGreaterThanOrEqualTo(String value) {
addCriterion("scene >=", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
public Criteria andSceneLessThan(String value) {
addCriterion("scene <", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
public Criteria andSceneLessThanOrEqualTo(String value) {
addCriterion("scene <=", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
public Criteria andSceneLike(String value) {
addCriterion("scene like", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
public Criteria andSceneNotLike(String value) {
addCriterion("scene not like", value, "scene");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
public Criteria andSceneIn(List<String> values) {
addCriterion("scene in", values, "scene");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
public Criteria andSceneNotIn(List<String> values) {
addCriterion("scene not in", values, "scene");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
public Criteria andSceneBetween(String value1, String value2) {
addCriterion("scene between", value1, value2, "scene");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
public Criteria andSceneNotBetween(String value1, String value2) {
addCriterion("scene not between", value1, value2, "scene");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
@ -374,203 +444,143 @@ public class ApiTemplateExample {
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
public Criteria andScopeTypeIsNull() {
addCriterion("scope_type is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
public Criteria andScopeTypeIsNotNull() {
addCriterion("scope_type is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
public Criteria andScopeTypeEqualTo(String value) {
addCriterion("scope_type =", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
public Criteria andScopeTypeNotEqualTo(String value) {
addCriterion("scope_type <>", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
public Criteria andScopeTypeGreaterThan(String value) {
addCriterion("scope_type >", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
public Criteria andScopeTypeGreaterThanOrEqualTo(String value) {
addCriterion("scope_type >=", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
public Criteria andScopeTypeLessThan(String value) {
addCriterion("scope_type <", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
public Criteria andScopeTypeLessThanOrEqualTo(String value) {
addCriterion("scope_type <=", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
public Criteria andScopeTypeLike(String value) {
addCriterion("scope_type like", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
public Criteria andScopeTypeNotLike(String value) {
addCriterion("scope_type not like", value, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
public Criteria andScopeTypeIn(List<String> values) {
addCriterion("scope_type in", values, "scopeType");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
public Criteria andScopeTypeNotIn(List<String> values) {
addCriterion("scope_type not in", values, "scopeType");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
public Criteria andScopeTypeBetween(String value1, String value2) {
addCriterion("scope_type between", value1, value2, "scopeType");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
public Criteria andScopeTypeNotBetween(String value1, String value2) {
addCriterion("scope_type not between", value1, value2, "scopeType");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
public Criteria andScopeIdIsNull() {
addCriterion("scope_id is null");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
public Criteria andScopeIdIsNotNull() {
addCriterion("scope_id is not null");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
public Criteria andScopeIdEqualTo(String value) {
addCriterion("scope_id =", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
public Criteria andScopeIdNotEqualTo(String value) {
addCriterion("scope_id <>", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
public Criteria andScopeIdGreaterThan(String value) {
addCriterion("scope_id >", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
public Criteria andScopeIdGreaterThanOrEqualTo(String value) {
addCriterion("scope_id >=", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
public Criteria andScopeIdLessThan(String value) {
addCriterion("scope_id <", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
public Criteria andScopeIdLessThanOrEqualTo(String value) {
addCriterion("scope_id <=", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
public Criteria andScopeIdLike(String value) {
addCriterion("scope_id like", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
public Criteria andScopeIdNotLike(String value) {
addCriterion("scope_id not like", value, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
public Criteria andScopeIdIn(List<String> values) {
addCriterion("scope_id in", values, "scopeId");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
public Criteria andScopeIdNotIn(List<String> values) {
addCriterion("scope_id not in", values, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
public Criteria andScopeIdBetween(String value1, String value2) {
addCriterion("scope_id between", value1, value2, "scopeId");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
public Criteria andScopeIdNotBetween(String value1, String value2) {
addCriterion("scope_id not between", value1, value2, "scopeId");
return (Criteria) this;
}
}

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,44 +9,66 @@ import java.util.Arrays;
import lombok.Data;
@Data
public class BugTemplate implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{bug_template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{bug_template.id.length_range}", groups = {Created.class, Updated.class})
public class Template implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{template.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{bug_template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{bug_template.name.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{template.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "描述")
private String description;
@Schema(description = "备注")
private String remark;
@Schema(description = "是否是内置模板")
@Schema(description = "是否是内置模板", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{template.internal.not_blank}", groups = {Created.class})
private Boolean internal;
@Schema(description = "创建时间")
@Schema(description = "创建时间")
private Long updateTime;
@Schema(description = "创建时间")
private Long createTime;
@Schema(description = "创建人")
@Schema(description = "创建人")
private String createUser;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{bug_template.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{bug_template.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@Schema(description = "组织或项目级别字段PROJECT, ORGANIZATION", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scope_type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template.scope_type.length_range}", groups = {Created.class, Updated.class})
private String scopeType;
@Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template.scope_id.length_range}", groups = {Created.class, Updated.class})
private String scopeId;
@Schema(description = "是否开启api字段名配置", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{template.enable_third_part.not_blank}", groups = {Created.class})
private Boolean enableThirdPart;
@Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{template.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
description("description", "description", "VARCHAR", false),
remark("remark", "remark", "VARCHAR", false),
internal("internal", "internal", "BIT", false),
updateTime("update_time", "updateTime", "BIGINT", false),
createTime("create_time", "createTime", "BIGINT", false),
createUser("create_user", "createUser", "VARCHAR", false),
projectId("project_id", "projectId", "VARCHAR", false);
scopeType("scope_type", "scopeType", "VARCHAR", false),
scopeId("scope_id", "scopeId", "VARCHAR", false),
enableThirdPart("enable_third_part", "enableThirdPart", "BIT", false),
scene("scene", "scene", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -1,4 +1,4 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,41 +9,35 @@ import java.util.Arrays;
import lombok.Data;
@Data
public class CustomFieldTemplate implements Serializable {
@Schema(description = "自定义模版ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{custom_field_template.id.length_range}", groups = {Created.class, Updated.class})
public class TemplateCustomField implements Serializable {
@Schema(description = "自定义模版ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template_custom_field.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{template_custom_field.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(description = "自定义字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_template.field_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field_template.field_id.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template_custom_field.field_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template_custom_field.field_id.length_range}", groups = {Created.class, Updated.class})
private String fieldId;
@Schema(description = "模版ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_template.template_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field_template.template_id.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "模版ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template_custom_field.template_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template_custom_field.template_id.length_range}", groups = {Created.class, Updated.class})
private String templateId;
@Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_template.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{custom_field_template.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
@Schema(description = "是否必填")
@Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{template_custom_field.required.not_blank}", groups = {Created.class})
private Boolean required;
@Schema(description = "排序字段")
@Schema(description = "排序字段", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{template_custom_field.pos.not_blank}", groups = {Created.class})
private Integer pos;
@Schema(description = "自定义数据")
private String customData;
@Schema(description = "api字段名")
private String apiFieldId;
@Schema(description = "自定义表头")
private String key;
@Schema(description = "默认值")
private byte[] defaultValue;
@Schema(description = "默认值")
private String defaultValue;
private static final long serialVersionUID = 1L;
@ -51,12 +45,10 @@ public class CustomFieldTemplate implements Serializable {
id("id", "id", "VARCHAR", false),
fieldId("field_id", "fieldId", "VARCHAR", false),
templateId("template_id", "templateId", "VARCHAR", false),
scene("scene", "scene", "VARCHAR", false),
required("required", "required", "BIT", false),
pos("pos", "pos", "INTEGER", false),
customData("custom_data", "customData", "VARCHAR", false),
key("key", "key", "VARCHAR", true),
defaultValue("default_value", "defaultValue", "LONGVARBINARY", false);
apiFieldId("api_field_id", "apiFieldId", "VARCHAR", false),
defaultValue("default_value", "defaultValue", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -1,16 +1,16 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class CustomFieldTemplateExample {
public class TemplateCustomFieldExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CustomFieldTemplateExample() {
public TemplateCustomFieldExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -314,76 +314,6 @@ public class CustomFieldTemplateExample {
return (Criteria) this;
}
public Criteria andSceneIsNull() {
addCriterion("scene is null");
return (Criteria) this;
}
public Criteria andSceneIsNotNull() {
addCriterion("scene is not null");
return (Criteria) this;
}
public Criteria andSceneEqualTo(String value) {
addCriterion("scene =", value, "scene");
return (Criteria) this;
}
public Criteria andSceneNotEqualTo(String value) {
addCriterion("scene <>", value, "scene");
return (Criteria) this;
}
public Criteria andSceneGreaterThan(String value) {
addCriterion("scene >", value, "scene");
return (Criteria) this;
}
public Criteria andSceneGreaterThanOrEqualTo(String value) {
addCriterion("scene >=", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLessThan(String value) {
addCriterion("scene <", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLessThanOrEqualTo(String value) {
addCriterion("scene <=", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLike(String value) {
addCriterion("scene like", value, "scene");
return (Criteria) this;
}
public Criteria andSceneNotLike(String value) {
addCriterion("scene not like", value, "scene");
return (Criteria) this;
}
public Criteria andSceneIn(List<String> values) {
addCriterion("scene in", values, "scene");
return (Criteria) this;
}
public Criteria andSceneNotIn(List<String> values) {
addCriterion("scene not in", values, "scene");
return (Criteria) this;
}
public Criteria andSceneBetween(String value1, String value2) {
addCriterion("scene between", value1, value2, "scene");
return (Criteria) this;
}
public Criteria andSceneNotBetween(String value1, String value2) {
addCriterion("scene not between", value1, value2, "scene");
return (Criteria) this;
}
public Criteria andRequiredIsNull() {
addCriterion("required is null");
return (Criteria) this;
@ -504,143 +434,143 @@ public class CustomFieldTemplateExample {
return (Criteria) this;
}
public Criteria andCustomDataIsNull() {
addCriterion("custom_data is null");
public Criteria andApiFieldIdIsNull() {
addCriterion("api_field_id is null");
return (Criteria) this;
}
public Criteria andCustomDataIsNotNull() {
addCriterion("custom_data is not null");
public Criteria andApiFieldIdIsNotNull() {
addCriterion("api_field_id is not null");
return (Criteria) this;
}
public Criteria andCustomDataEqualTo(String value) {
addCriterion("custom_data =", value, "customData");
public Criteria andApiFieldIdEqualTo(String value) {
addCriterion("api_field_id =", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataNotEqualTo(String value) {
addCriterion("custom_data <>", value, "customData");
public Criteria andApiFieldIdNotEqualTo(String value) {
addCriterion("api_field_id <>", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataGreaterThan(String value) {
addCriterion("custom_data >", value, "customData");
public Criteria andApiFieldIdGreaterThan(String value) {
addCriterion("api_field_id >", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataGreaterThanOrEqualTo(String value) {
addCriterion("custom_data >=", value, "customData");
public Criteria andApiFieldIdGreaterThanOrEqualTo(String value) {
addCriterion("api_field_id >=", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataLessThan(String value) {
addCriterion("custom_data <", value, "customData");
public Criteria andApiFieldIdLessThan(String value) {
addCriterion("api_field_id <", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataLessThanOrEqualTo(String value) {
addCriterion("custom_data <=", value, "customData");
public Criteria andApiFieldIdLessThanOrEqualTo(String value) {
addCriterion("api_field_id <=", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataLike(String value) {
addCriterion("custom_data like", value, "customData");
public Criteria andApiFieldIdLike(String value) {
addCriterion("api_field_id like", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataNotLike(String value) {
addCriterion("custom_data not like", value, "customData");
public Criteria andApiFieldIdNotLike(String value) {
addCriterion("api_field_id not like", value, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataIn(List<String> values) {
addCriterion("custom_data in", values, "customData");
public Criteria andApiFieldIdIn(List<String> values) {
addCriterion("api_field_id in", values, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataNotIn(List<String> values) {
addCriterion("custom_data not in", values, "customData");
public Criteria andApiFieldIdNotIn(List<String> values) {
addCriterion("api_field_id not in", values, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataBetween(String value1, String value2) {
addCriterion("custom_data between", value1, value2, "customData");
public Criteria andApiFieldIdBetween(String value1, String value2) {
addCriterion("api_field_id between", value1, value2, "apiFieldId");
return (Criteria) this;
}
public Criteria andCustomDataNotBetween(String value1, String value2) {
addCriterion("custom_data not between", value1, value2, "customData");
public Criteria andApiFieldIdNotBetween(String value1, String value2) {
addCriterion("api_field_id not between", value1, value2, "apiFieldId");
return (Criteria) this;
}
public Criteria andKeyIsNull() {
addCriterion("`key` is null");
public Criteria andDefaultValueIsNull() {
addCriterion("default_value is null");
return (Criteria) this;
}
public Criteria andKeyIsNotNull() {
addCriterion("`key` is not null");
public Criteria andDefaultValueIsNotNull() {
addCriterion("default_value is not null");
return (Criteria) this;
}
public Criteria andKeyEqualTo(String value) {
addCriterion("`key` =", value, "key");
public Criteria andDefaultValueEqualTo(String value) {
addCriterion("default_value =", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyNotEqualTo(String value) {
addCriterion("`key` <>", value, "key");
public Criteria andDefaultValueNotEqualTo(String value) {
addCriterion("default_value <>", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyGreaterThan(String value) {
addCriterion("`key` >", value, "key");
public Criteria andDefaultValueGreaterThan(String value) {
addCriterion("default_value >", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyGreaterThanOrEqualTo(String value) {
addCriterion("`key` >=", value, "key");
public Criteria andDefaultValueGreaterThanOrEqualTo(String value) {
addCriterion("default_value >=", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyLessThan(String value) {
addCriterion("`key` <", value, "key");
public Criteria andDefaultValueLessThan(String value) {
addCriterion("default_value <", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyLessThanOrEqualTo(String value) {
addCriterion("`key` <=", value, "key");
public Criteria andDefaultValueLessThanOrEqualTo(String value) {
addCriterion("default_value <=", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyLike(String value) {
addCriterion("`key` like", value, "key");
public Criteria andDefaultValueLike(String value) {
addCriterion("default_value like", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyNotLike(String value) {
addCriterion("`key` not like", value, "key");
public Criteria andDefaultValueNotLike(String value) {
addCriterion("default_value not like", value, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyIn(List<String> values) {
addCriterion("`key` in", values, "key");
public Criteria andDefaultValueIn(List<String> values) {
addCriterion("default_value in", values, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyNotIn(List<String> values) {
addCriterion("`key` not in", values, "key");
public Criteria andDefaultValueNotIn(List<String> values) {
addCriterion("default_value not in", values, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyBetween(String value1, String value2) {
addCriterion("`key` between", value1, value2, "key");
public Criteria andDefaultValueBetween(String value1, String value2) {
addCriterion("default_value between", value1, value2, "defaultValue");
return (Criteria) this;
}
public Criteria andKeyNotBetween(String value1, String value2) {
addCriterion("`key` not between", value1, value2, "key");
public Criteria andDefaultValueNotBetween(String value1, String value2) {
addCriterion("default_value not between", value1, value2, "defaultValue");
return (Criteria) this;
}
}

View File

@ -1,16 +1,16 @@
package io.metersphere.project.domain;
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class FunctionalCaseTemplateExample {
public class TemplateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FunctionalCaseTemplateExample() {
public TemplateExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -244,73 +244,73 @@ public class FunctionalCaseTemplateExample {
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
@ -374,6 +374,66 @@ public class FunctionalCaseTemplateExample {
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<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> 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 andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
@ -504,73 +564,273 @@ public class FunctionalCaseTemplateExample {
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
public Criteria andScopeTypeIsNull() {
addCriterion("scope_type is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
public Criteria andScopeTypeIsNotNull() {
addCriterion("scope_type is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
public Criteria andScopeTypeEqualTo(String value) {
addCriterion("scope_type =", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
public Criteria andScopeTypeNotEqualTo(String value) {
addCriterion("scope_type <>", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
public Criteria andScopeTypeGreaterThan(String value) {
addCriterion("scope_type >", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
public Criteria andScopeTypeGreaterThanOrEqualTo(String value) {
addCriterion("scope_type >=", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
public Criteria andScopeTypeLessThan(String value) {
addCriterion("scope_type <", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
public Criteria andScopeTypeLessThanOrEqualTo(String value) {
addCriterion("scope_type <=", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
public Criteria andScopeTypeLike(String value) {
addCriterion("scope_type like", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
public Criteria andScopeTypeNotLike(String value) {
addCriterion("scope_type not like", value, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
public Criteria andScopeTypeIn(List<String> values) {
addCriterion("scope_type in", values, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
public Criteria andScopeTypeNotIn(List<String> values) {
addCriterion("scope_type not in", values, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
public Criteria andScopeTypeBetween(String value1, String value2) {
addCriterion("scope_type between", value1, value2, "scopeType");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
public Criteria andScopeTypeNotBetween(String value1, String value2) {
addCriterion("scope_type not between", value1, value2, "scopeType");
return (Criteria) this;
}
public Criteria andScopeIdIsNull() {
addCriterion("scope_id is null");
return (Criteria) this;
}
public Criteria andScopeIdIsNotNull() {
addCriterion("scope_id is not null");
return (Criteria) this;
}
public Criteria andScopeIdEqualTo(String value) {
addCriterion("scope_id =", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdNotEqualTo(String value) {
addCriterion("scope_id <>", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdGreaterThan(String value) {
addCriterion("scope_id >", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdGreaterThanOrEqualTo(String value) {
addCriterion("scope_id >=", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdLessThan(String value) {
addCriterion("scope_id <", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdLessThanOrEqualTo(String value) {
addCriterion("scope_id <=", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdLike(String value) {
addCriterion("scope_id like", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdNotLike(String value) {
addCriterion("scope_id not like", value, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdIn(List<String> values) {
addCriterion("scope_id in", values, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdNotIn(List<String> values) {
addCriterion("scope_id not in", values, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdBetween(String value1, String value2) {
addCriterion("scope_id between", value1, value2, "scopeId");
return (Criteria) this;
}
public Criteria andScopeIdNotBetween(String value1, String value2) {
addCriterion("scope_id not between", value1, value2, "scopeId");
return (Criteria) this;
}
public Criteria andEnableThirdPartIsNull() {
addCriterion("enable_third_part is null");
return (Criteria) this;
}
public Criteria andEnableThirdPartIsNotNull() {
addCriterion("enable_third_part is not null");
return (Criteria) this;
}
public Criteria andEnableThirdPartEqualTo(Boolean value) {
addCriterion("enable_third_part =", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartNotEqualTo(Boolean value) {
addCriterion("enable_third_part <>", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartGreaterThan(Boolean value) {
addCriterion("enable_third_part >", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartGreaterThanOrEqualTo(Boolean value) {
addCriterion("enable_third_part >=", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartLessThan(Boolean value) {
addCriterion("enable_third_part <", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartLessThanOrEqualTo(Boolean value) {
addCriterion("enable_third_part <=", value, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartIn(List<Boolean> values) {
addCriterion("enable_third_part in", values, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartNotIn(List<Boolean> values) {
addCriterion("enable_third_part not in", values, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartBetween(Boolean value1, Boolean value2) {
addCriterion("enable_third_part between", value1, value2, "enableThirdPart");
return (Criteria) this;
}
public Criteria andEnableThirdPartNotBetween(Boolean value1, Boolean value2) {
addCriterion("enable_third_part not between", value1, value2, "enableThirdPart");
return (Criteria) this;
}
public Criteria andSceneIsNull() {
addCriterion("scene is null");
return (Criteria) this;
}
public Criteria andSceneIsNotNull() {
addCriterion("scene is not null");
return (Criteria) this;
}
public Criteria andSceneEqualTo(String value) {
addCriterion("scene =", value, "scene");
return (Criteria) this;
}
public Criteria andSceneNotEqualTo(String value) {
addCriterion("scene <>", value, "scene");
return (Criteria) this;
}
public Criteria andSceneGreaterThan(String value) {
addCriterion("scene >", value, "scene");
return (Criteria) this;
}
public Criteria andSceneGreaterThanOrEqualTo(String value) {
addCriterion("scene >=", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLessThan(String value) {
addCriterion("scene <", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLessThanOrEqualTo(String value) {
addCriterion("scene <=", value, "scene");
return (Criteria) this;
}
public Criteria andSceneLike(String value) {
addCriterion("scene like", value, "scene");
return (Criteria) this;
}
public Criteria andSceneNotLike(String value) {
addCriterion("scene not like", value, "scene");
return (Criteria) this;
}
public Criteria andSceneIn(List<String> values) {
addCriterion("scene in", values, "scene");
return (Criteria) this;
}
public Criteria andSceneNotIn(List<String> values) {
addCriterion("scene not in", values, "scene");
return (Criteria) this;
}
public Criteria andSceneBetween(String value1, String value2) {
addCriterion("scene between", value1, value2, "scene");
return (Criteria) this;
}
public Criteria andSceneNotBetween(String value1, String value2) {
addCriterion("scene not between", value1, value2, "scene");
return (Criteria) this;
}
}

View File

@ -1,7 +1,7 @@
package io.metersphere.project.mapper;
package io.metersphere.system.mapper;
import io.metersphere.project.domain.CustomField;
import io.metersphere.project.domain.CustomFieldExample;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.CustomFieldExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@ -16,22 +16,16 @@ public interface CustomFieldMapper {
int insertSelective(CustomField record);
List<CustomField> selectByExampleWithBLOBs(CustomFieldExample example);
List<CustomField> selectByExample(CustomFieldExample example);
CustomField selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") CustomField record, @Param("example") CustomFieldExample example);
int updateByExampleWithBLOBs(@Param("record") CustomField record, @Param("example") CustomFieldExample example);
int updateByExample(@Param("record") CustomField record, @Param("example") CustomFieldExample example);
int updateByPrimaryKeySelective(CustomField record);
int updateByPrimaryKeyWithBLOBs(CustomField record);
int updateByPrimaryKey(CustomField record);
int batchInsert(@Param("list") List<CustomField> list);

View File

@ -1,22 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.CustomFieldMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.CustomField">
<mapper namespace="io.metersphere.system.mapper.CustomFieldMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.CustomField">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="scene" jdbcType="VARCHAR" property="scene" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="system" jdbcType="BIT" property="system" />
<result column="global" jdbcType="BIT" property="global" />
<result column="internal" jdbcType="BIT" property="internal" />
<result column="scope_type" jdbcType="VARCHAR" property="scopeType" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="third_part" jdbcType="BIT" property="thirdPart" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.CustomField">
<result column="options" jdbcType="LONGVARCHAR" property="options" />
<result column="scope_id" jdbcType="VARCHAR" property="scopeId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -77,29 +73,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, scene, `type`, remark, `system`, `global`, create_time, update_time,
create_user, project_id, third_part
id, `name`, scene, `type`, remark, internal, scope_type, create_time, update_time,
create_user, scope_id
</sql>
<sql id="Blob_Column_List">
`options`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.CustomFieldExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.project.domain.CustomFieldExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.system.domain.CustomFieldExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -113,11 +90,9 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from custom_field
where id = #{id,jdbcType=VARCHAR}
</select>
@ -125,25 +100,23 @@
delete from custom_field
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.CustomFieldExample">
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.CustomFieldExample">
delete from custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.CustomField">
<insert id="insert" parameterType="io.metersphere.system.domain.CustomField">
insert into custom_field (id, `name`, scene,
`type`, remark, `system`, `global`,
create_time, update_time, create_user,
project_id, third_part, `options`
)
`type`, remark, internal,
scope_type, create_time, update_time,
create_user, scope_id)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scene,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{system,jdbcType=BIT}, #{global,jdbcType=BIT},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{thirdPart,jdbcType=BIT}, #{options,jdbcType=LONGVARCHAR}
)
#{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{internal,jdbcType=BIT},
#{scopeType,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{scopeId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.CustomField">
<insert id="insertSelective" parameterType="io.metersphere.system.domain.CustomField">
insert into custom_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -161,11 +134,11 @@
<if test="remark != null">
remark,
</if>
<if test="system != null">
`system`,
<if test="internal != null">
internal,
</if>
<if test="global != null">
`global`,
<if test="scopeType != null">
scope_type,
</if>
<if test="createTime != null">
create_time,
@ -176,14 +149,8 @@
<if test="createUser != null">
create_user,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="thirdPart != null">
third_part,
</if>
<if test="options != null">
`options`,
<if test="scopeId != null">
scope_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -202,11 +169,11 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="system != null">
#{system,jdbcType=BIT},
<if test="internal != null">
#{internal,jdbcType=BIT},
</if>
<if test="global != null">
#{global,jdbcType=BIT},
<if test="scopeType != null">
#{scopeType,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
@ -217,18 +184,12 @@
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="thirdPart != null">
#{thirdPart,jdbcType=BIT},
</if>
<if test="options != null">
#{options,jdbcType=LONGVARCHAR},
<if test="scopeId != null">
#{scopeId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.CustomFieldExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="io.metersphere.system.domain.CustomFieldExample" resultType="java.lang.Long">
select count(*) from custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -252,11 +213,11 @@
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.system != null">
`system` = #{record.system,jdbcType=BIT},
<if test="record.internal != null">
internal = #{record.internal,jdbcType=BIT},
</if>
<if test="record.global != null">
`global` = #{record.global,jdbcType=BIT},
<if test="record.scopeType != null">
scope_type = #{record.scopeType,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
@ -267,39 +228,14 @@
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.thirdPart != null">
third_part = #{record.thirdPart,jdbcType=BIT},
</if>
<if test="record.options != null">
`options` = #{record.options,jdbcType=LONGVARCHAR},
<if test="record.scopeId != null">
scope_id = #{record.scopeId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update custom_field
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
scene = #{record.scene,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
`system` = #{record.system,jdbcType=BIT},
`global` = #{record.global,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
third_part = #{record.thirdPart,jdbcType=BIT},
`options` = #{record.options,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update custom_field
set id = #{record.id,jdbcType=VARCHAR},
@ -307,18 +243,17 @@
scene = #{record.scene,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
`system` = #{record.system,jdbcType=BIT},
`global` = #{record.global,jdbcType=BIT},
internal = #{record.internal,jdbcType=BIT},
scope_type = #{record.scopeType,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
third_part = #{record.thirdPart,jdbcType=BIT}
scope_id = #{record.scopeId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.CustomField">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.CustomField">
update custom_field
<set>
<if test="name != null">
@ -333,11 +268,11 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="system != null">
`system` = #{system,jdbcType=BIT},
<if test="internal != null">
internal = #{internal,jdbcType=BIT},
</if>
<if test="global != null">
`global` = #{global,jdbcType=BIT},
<if test="scopeType != null">
scope_type = #{scopeType,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
@ -348,60 +283,36 @@
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="thirdPart != null">
third_part = #{thirdPart,jdbcType=BIT},
</if>
<if test="options != null">
`options` = #{options,jdbcType=LONGVARCHAR},
<if test="scopeId != null">
scope_id = #{scopeId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.CustomField">
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.CustomField">
update custom_field
set `name` = #{name,jdbcType=VARCHAR},
scene = #{scene,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
`system` = #{system,jdbcType=BIT},
`global` = #{global,jdbcType=BIT},
internal = #{internal,jdbcType=BIT},
scope_type = #{scopeType,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
third_part = #{thirdPart,jdbcType=BIT},
`options` = #{options,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.CustomField">
update custom_field
set `name` = #{name,jdbcType=VARCHAR},
scene = #{scene,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
`system` = #{system,jdbcType=BIT},
`global` = #{global,jdbcType=BIT},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
third_part = #{thirdPart,jdbcType=BIT}
scope_id = #{scopeId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into custom_field
(id, `name`, scene, `type`, remark, `system`, `global`, create_time, update_time,
create_user, project_id, third_part, `options`)
(id, `name`, scene, `type`, remark, internal, scope_type, create_time, update_time,
create_user, scope_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.scene,jdbcType=VARCHAR},
#{item.type,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR}, #{item.system,jdbcType=BIT},
#{item.global,jdbcType=BIT}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.thirdPart,jdbcType=BIT},
#{item.options,jdbcType=LONGVARCHAR})
#{item.type,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR}, #{item.internal,jdbcType=BIT},
#{item.scopeType,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.scopeId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -429,11 +340,11 @@
<if test="'remark'.toString() == column.value">
#{item.remark,jdbcType=VARCHAR}
</if>
<if test="'system'.toString() == column.value">
#{item.system,jdbcType=BIT}
<if test="'internal'.toString() == column.value">
#{item.internal,jdbcType=BIT}
</if>
<if test="'global'.toString() == column.value">
#{item.global,jdbcType=BIT}
<if test="'scope_type'.toString() == column.value">
#{item.scopeType,jdbcType=VARCHAR}
</if>
<if test="'create_time'.toString() == column.value">
#{item.createTime,jdbcType=BIGINT}
@ -444,14 +355,8 @@
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>
<if test="'project_id'.toString() == column.value">
#{item.projectId,jdbcType=VARCHAR}
</if>
<if test="'third_part'.toString() == column.value">
#{item.thirdPart,jdbcType=BIT}
</if>
<if test="'options'.toString() == column.value">
#{item.options,jdbcType=LONGVARCHAR}
<if test="'scope_id'.toString() == column.value">
#{item.scopeId,jdbcType=VARCHAR}
</if>
</foreach>
)

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.CustomFieldOption;
import io.metersphere.system.domain.CustomFieldOptionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface CustomFieldOptionMapper {
long countByExample(CustomFieldOptionExample example);
int deleteByExample(CustomFieldOptionExample example);
int deleteByPrimaryKey(@Param("fieldId") String fieldId, @Param("value") String value);
int insert(CustomFieldOption record);
int insertSelective(CustomFieldOption record);
List<CustomFieldOption> selectByExample(CustomFieldOptionExample example);
CustomFieldOption selectByPrimaryKey(@Param("fieldId") String fieldId, @Param("value") String value);
int updateByExampleSelective(@Param("record") CustomFieldOption record, @Param("example") CustomFieldOptionExample example);
int updateByExample(@Param("record") CustomFieldOption record, @Param("example") CustomFieldOptionExample example);
int updateByPrimaryKeySelective(CustomFieldOption record);
int updateByPrimaryKey(CustomFieldOption record);
int batchInsert(@Param("list") List<CustomFieldOption> list);
int batchInsertSelective(@Param("list") List<CustomFieldOption> list, @Param("selective") CustomFieldOption.Column ... selective);
}

View File

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.system.mapper.CustomFieldOptionMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.CustomFieldOption">
<id column="field_id" jdbcType="VARCHAR" property="fieldId" />
<id column="value" jdbcType="VARCHAR" property="value" />
<result column="text" jdbcType="VARCHAR" property="text" />
<result column="internal" jdbcType="BIT" property="internal" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
field_id, `value`, `text`, internal
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.CustomFieldOptionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from custom_field_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_field_option
where field_id = #{fieldId,jdbcType=VARCHAR}
and `value` = #{value,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="map">
delete from custom_field_option
where field_id = #{fieldId,jdbcType=VARCHAR}
and `value` = #{value,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.CustomFieldOptionExample">
delete from custom_field_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.CustomFieldOption">
insert into custom_field_option (field_id, `value`, `text`,
internal)
values (#{fieldId,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR},
#{internal,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.CustomFieldOption">
insert into custom_field_option
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fieldId != null">
field_id,
</if>
<if test="value != null">
`value`,
</if>
<if test="text != null">
`text`,
</if>
<if test="internal != null">
internal,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fieldId != null">
#{fieldId,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
<if test="text != null">
#{text,jdbcType=VARCHAR},
</if>
<if test="internal != null">
#{internal,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.CustomFieldOptionExample" resultType="java.lang.Long">
select count(*) from custom_field_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update custom_field_option
<set>
<if test="record.fieldId != null">
field_id = #{record.fieldId,jdbcType=VARCHAR},
</if>
<if test="record.value != null">
`value` = #{record.value,jdbcType=VARCHAR},
</if>
<if test="record.text != null">
`text` = #{record.text,jdbcType=VARCHAR},
</if>
<if test="record.internal != null">
internal = #{record.internal,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update custom_field_option
set field_id = #{record.fieldId,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`text` = #{record.text,jdbcType=VARCHAR},
internal = #{record.internal,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.CustomFieldOption">
update custom_field_option
<set>
<if test="text != null">
`text` = #{text,jdbcType=VARCHAR},
</if>
<if test="internal != null">
internal = #{internal,jdbcType=BIT},
</if>
</set>
where field_id = #{fieldId,jdbcType=VARCHAR}
and `value` = #{value,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.CustomFieldOption">
update custom_field_option
set `text` = #{text,jdbcType=VARCHAR},
internal = #{internal,jdbcType=BIT}
where field_id = #{fieldId,jdbcType=VARCHAR}
and `value` = #{value,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into custom_field_option
(field_id, `value`, `text`, internal)
values
<foreach collection="list" item="item" separator=",">
(#{item.fieldId,jdbcType=VARCHAR}, #{item.value,jdbcType=VARCHAR}, #{item.text,jdbcType=VARCHAR},
#{item.internal,jdbcType=BIT})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into custom_field_option (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
)
values
<foreach collection="list" item="item" separator=",">
(
<foreach collection="selective" item="column" separator=",">
<if test="'field_id'.toString() == column.value">
#{item.fieldId,jdbcType=VARCHAR}
</if>
<if test="'value'.toString() == column.value">
#{item.value,jdbcType=VARCHAR}
</if>
<if test="'text'.toString() == column.value">
#{item.text,jdbcType=VARCHAR}
</if>
<if test="'internal'.toString() == column.value">
#{item.internal,jdbcType=BIT}
</if>
</foreach>
)
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.StatusDefinition;
import io.metersphere.system.domain.StatusDefinitionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface StatusDefinitionMapper {
long countByExample(StatusDefinitionExample example);
int deleteByExample(StatusDefinitionExample example);
int deleteByPrimaryKey(String id);
int insert(StatusDefinition record);
int insertSelective(StatusDefinition record);
List<StatusDefinition> selectByExample(StatusDefinitionExample example);
StatusDefinition selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") StatusDefinition record, @Param("example") StatusDefinitionExample example);
int updateByExample(@Param("record") StatusDefinition record, @Param("example") StatusDefinitionExample example);
int updateByPrimaryKeySelective(StatusDefinition record);
int updateByPrimaryKey(StatusDefinition record);
int batchInsert(@Param("list") List<StatusDefinition> list);
int batchInsertSelective(@Param("list") List<StatusDefinition> list, @Param("selective") StatusDefinition.Column ... selective);
}

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.BugTemplateExtendMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.BugTemplateExtend">
<mapper namespace="io.metersphere.system.mapper.StatusDefinitionMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.StatusDefinition">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.BugTemplateExtend">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
<result column="status_id" jdbcType="VARCHAR" property="statusId" />
<result column="definition_id" jdbcType="VARCHAR" property="definitionId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -67,20 +65,15 @@
</where>
</sql>
<sql id="Base_Column_List">
id, title
id, status_id, definition_id
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.BugTemplateExtendExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExample" parameterType="io.metersphere.system.domain.StatusDefinitionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from bug_template_extend
from status_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -88,143 +81,114 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.project.domain.BugTemplateExtendExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from bug_template_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from bug_template_extend
from status_definition
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from bug_template_extend
delete from status_definition
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.BugTemplateExtendExample">
delete from bug_template_extend
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.StatusDefinitionExample">
delete from status_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.BugTemplateExtend">
insert into bug_template_extend (id, title, content
<insert id="insert" parameterType="io.metersphere.system.domain.StatusDefinition">
insert into status_definition (id, status_id, definition_id
)
values (#{id,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
values (#{id,jdbcType=VARCHAR}, #{statusId,jdbcType=VARCHAR}, #{definitionId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.BugTemplateExtend">
insert into bug_template_extend
<insert id="insertSelective" parameterType="io.metersphere.system.domain.StatusDefinition">
insert into status_definition
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="title != null">
title,
<if test="statusId != null">
status_id,
</if>
<if test="content != null">
content,
<if test="definitionId != null">
definition_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
<if test="statusId != null">
#{statusId,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
<if test="definitionId != null">
#{definitionId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.BugTemplateExtendExample" resultType="java.lang.Long">
select count(*) from bug_template_extend
<select id="countByExample" parameterType="io.metersphere.system.domain.StatusDefinitionExample" resultType="java.lang.Long">
select count(*) from status_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update bug_template_extend
update status_definition
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
<if test="record.statusId != null">
status_id = #{record.statusId,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
<if test="record.definitionId != null">
definition_id = #{record.definitionId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update bug_template_extend
set id = #{record.id,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update bug_template_extend
update status_definition
set id = #{record.id,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR}
status_id = #{record.statusId,jdbcType=VARCHAR},
definition_id = #{record.definitionId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.BugTemplateExtend">
update bug_template_extend
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.StatusDefinition">
update status_definition
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
<if test="statusId != null">
status_id = #{statusId,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
<if test="definitionId != null">
definition_id = #{definitionId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.BugTemplateExtend">
update bug_template_extend
set title = #{title,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.BugTemplateExtend">
update bug_template_extend
set title = #{title,jdbcType=VARCHAR}
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.StatusDefinition">
update status_definition
set status_id = #{statusId,jdbcType=VARCHAR},
definition_id = #{definitionId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into bug_template_extend
(id, title, content)
insert into status_definition
(id, status_id, definition_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.title,jdbcType=VARCHAR}, #{item.content,jdbcType=LONGVARCHAR}
(#{item.id,jdbcType=VARCHAR}, #{item.statusId,jdbcType=VARCHAR}, #{item.definitionId,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into bug_template_extend (
insert into status_definition (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
@ -236,11 +200,11 @@
<if test="'id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR}
</if>
<if test="'title'.toString() == column.value">
#{item.title,jdbcType=VARCHAR}
<if test="'status_id'.toString() == column.value">
#{item.statusId,jdbcType=VARCHAR}
</if>
<if test="'content'.toString() == column.value">
#{item.content,jdbcType=LONGVARCHAR}
<if test="'definition_id'.toString() == column.value">
#{item.definitionId,jdbcType=VARCHAR}
</if>
</foreach>
)

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.StatusItem;
import io.metersphere.system.domain.StatusItemExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface StatusItemMapper {
long countByExample(StatusItemExample example);
int deleteByExample(StatusItemExample example);
int deleteByPrimaryKey(String id);
int insert(StatusItem record);
int insertSelective(StatusItem record);
List<StatusItem> selectByExample(StatusItemExample example);
StatusItem selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") StatusItem record, @Param("example") StatusItemExample example);
int updateByExample(@Param("record") StatusItem record, @Param("example") StatusItemExample example);
int updateByPrimaryKeySelective(StatusItem record);
int updateByPrimaryKey(StatusItem record);
int batchInsert(@Param("list") List<StatusItem> list);
int batchInsertSelective(@Param("list") List<StatusItem> list, @Param("selective") StatusItem.Column ... selective);
}

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.BugTemplateMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.BugTemplate">
<mapper namespace="io.metersphere.system.mapper.StatusItemMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.StatusItem">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="scene" jdbcType="VARCHAR" property="scene" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="internal" jdbcType="BIT" property="internal" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="scope_type" jdbcType="VARCHAR" property="scopeType" />
<result column="scope_id" jdbcType="VARCHAR" property="scopeId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -69,15 +69,15 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, description, internal, create_time, create_user, project_id
id, `name`, scene, remark, internal, scope_type, scope_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.project.domain.BugTemplateExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.system.domain.StatusItemExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from bug_template
from status_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -88,29 +88,29 @@
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from bug_template
from status_item
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from bug_template
delete from status_item
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.BugTemplateExample">
delete from bug_template
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.StatusItemExample">
delete from status_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.BugTemplate">
insert into bug_template (id, `name`, description,
internal, create_time, create_user,
project_id)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{internal,jdbcType=BIT}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR})
<insert id="insert" parameterType="io.metersphere.system.domain.StatusItem">
insert into status_item (id, `name`, scene,
remark, internal, scope_type,
scope_id)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scene,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{internal,jdbcType=BIT}, #{scopeType,jdbcType=VARCHAR},
#{scopeId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.BugTemplate">
insert into bug_template
<insert id="insertSelective" parameterType="io.metersphere.system.domain.StatusItem">
insert into status_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -118,20 +118,20 @@
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
<if test="scene != null">
scene,
</if>
<if test="remark != null">
remark,
</if>
<if test="internal != null">
internal,
</if>
<if test="createTime != null">
create_time,
<if test="scopeType != null">
scope_type,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="projectId != null">
project_id,
<if test="scopeId != null">
scope_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -141,31 +141,31 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
<if test="scene != null">
#{scene,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="internal != null">
#{internal,jdbcType=BIT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
<if test="scopeType != null">
#{scopeType,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
<if test="scopeId != null">
#{scopeId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.BugTemplateExample" resultType="java.lang.Long">
select count(*) from bug_template
<select id="countByExample" parameterType="io.metersphere.system.domain.StatusItemExample" resultType="java.lang.Long">
select count(*) from status_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update bug_template
update status_item
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -173,20 +173,20 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
<if test="record.scene != null">
scene = #{record.scene,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.internal != null">
internal = #{record.internal,jdbcType=BIT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
<if test="record.scopeType != null">
scope_type = #{record.scopeType,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
<if test="record.scopeId != null">
scope_id = #{record.scopeId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
@ -194,64 +194,64 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update bug_template
update status_item
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
scene = #{record.scene,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
internal = #{record.internal,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}
scope_type = #{record.scopeType,jdbcType=VARCHAR},
scope_id = #{record.scopeId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.BugTemplate">
update bug_template
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.StatusItem">
update status_item
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
<if test="scene != null">
scene = #{scene,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="internal != null">
internal = #{internal,jdbcType=BIT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
<if test="scopeType != null">
scope_type = #{scopeType,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
<if test="scopeId != null">
scope_id = #{scopeId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.BugTemplate">
update bug_template
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.StatusItem">
update status_item
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
scene = #{scene,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
internal = #{internal,jdbcType=BIT},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}
scope_type = #{scopeType,jdbcType=VARCHAR},
scope_id = #{scopeId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into bug_template
(id, `name`, description, internal, create_time, create_user, project_id)
insert into status_item
(id, `name`, scene, remark, internal, scope_type, scope_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR},
#{item.internal,jdbcType=BIT}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.projectId,jdbcType=VARCHAR})
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.scene,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR}, #{item.internal,jdbcType=BIT}, #{item.scopeType,jdbcType=VARCHAR},
#{item.scopeId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into bug_template (
insert into status_item (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
@ -266,20 +266,20 @@
<if test="'name'.toString() == column.value">
#{item.name,jdbcType=VARCHAR}
</if>
<if test="'description'.toString() == column.value">
#{item.description,jdbcType=VARCHAR}
<if test="'scene'.toString() == column.value">
#{item.scene,jdbcType=VARCHAR}
</if>
<if test="'remark'.toString() == column.value">
#{item.remark,jdbcType=VARCHAR}
</if>
<if test="'internal'.toString() == column.value">
#{item.internal,jdbcType=BIT}
</if>
<if test="'create_time'.toString() == column.value">
#{item.createTime,jdbcType=BIGINT}
<if test="'scope_type'.toString() == column.value">
#{item.scopeType,jdbcType=VARCHAR}
</if>
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>
<if test="'project_id'.toString() == column.value">
#{item.projectId,jdbcType=VARCHAR}
<if test="'scope_id'.toString() == column.value">
#{item.scopeId,jdbcType=VARCHAR}
</if>
</foreach>
)

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.TemplateCustomField;
import io.metersphere.system.domain.TemplateCustomFieldExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TemplateCustomFieldMapper {
long countByExample(TemplateCustomFieldExample example);
int deleteByExample(TemplateCustomFieldExample example);
int deleteByPrimaryKey(String id);
int insert(TemplateCustomField record);
int insertSelective(TemplateCustomField record);
List<TemplateCustomField> selectByExample(TemplateCustomFieldExample example);
TemplateCustomField selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TemplateCustomField record, @Param("example") TemplateCustomFieldExample example);
int updateByExample(@Param("record") TemplateCustomField record, @Param("example") TemplateCustomFieldExample example);
int updateByPrimaryKeySelective(TemplateCustomField record);
int updateByPrimaryKey(TemplateCustomField record);
int batchInsert(@Param("list") List<TemplateCustomField> list);
int batchInsertSelective(@Param("list") List<TemplateCustomField> list, @Param("selective") TemplateCustomField.Column ... selective);
}

View File

@ -1,18 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.CustomFieldTemplateMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.CustomFieldTemplate">
<mapper namespace="io.metersphere.system.mapper.TemplateCustomFieldMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.TemplateCustomField">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="field_id" jdbcType="VARCHAR" property="fieldId" />
<result column="template_id" jdbcType="VARCHAR" property="templateId" />
<result column="scene" jdbcType="VARCHAR" property="scene" />
<result column="required" jdbcType="BIT" property="required" />
<result column="pos" jdbcType="INTEGER" property="pos" />
<result column="custom_data" jdbcType="VARCHAR" property="customData" />
<result column="key" jdbcType="VARCHAR" property="key" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.CustomFieldTemplate">
<result column="default_value" jdbcType="LONGVARBINARY" property="defaultValue" />
<result column="api_field_id" jdbcType="VARCHAR" property="apiFieldId" />
<result column="default_value" jdbcType="VARCHAR" property="defaultValue" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -73,20 +69,15 @@
</where>
</sql>
<sql id="Base_Column_List">
id, field_id, template_id, scene, required, pos, custom_data, `key`
id, field_id, template_id, required, pos, api_field_id, default_value
</sql>
<sql id="Blob_Column_List">
default_value
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.CustomFieldTemplateExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExample" parameterType="io.metersphere.system.domain.TemplateCustomFieldExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from custom_field_template
from template_custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -94,48 +85,32 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.project.domain.CustomFieldTemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from custom_field_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from custom_field_template
from template_custom_field
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from custom_field_template
delete from template_custom_field
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.CustomFieldTemplateExample">
delete from custom_field_template
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.TemplateCustomFieldExample">
delete from template_custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.CustomFieldTemplate">
insert into custom_field_template (id, field_id, template_id,
scene, required, pos, custom_data,
`key`, default_value)
<insert id="insert" parameterType="io.metersphere.system.domain.TemplateCustomField">
insert into template_custom_field (id, field_id, template_id,
required, pos, api_field_id,
default_value)
values (#{id,jdbcType=VARCHAR}, #{fieldId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR},
#{scene,jdbcType=VARCHAR}, #{required,jdbcType=BIT}, #{pos,jdbcType=INTEGER}, #{customData,jdbcType=VARCHAR},
#{key,jdbcType=VARCHAR}, #{defaultValue,jdbcType=LONGVARBINARY})
#{required,jdbcType=BIT}, #{pos,jdbcType=INTEGER}, #{apiFieldId,jdbcType=VARCHAR},
#{defaultValue,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.CustomFieldTemplate">
insert into custom_field_template
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TemplateCustomField">
insert into template_custom_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -146,20 +121,14 @@
<if test="templateId != null">
template_id,
</if>
<if test="scene != null">
scene,
</if>
<if test="required != null">
required,
</if>
<if test="pos != null">
pos,
</if>
<if test="customData != null">
custom_data,
</if>
<if test="key != null">
`key`,
<if test="apiFieldId != null">
api_field_id,
</if>
<if test="defaultValue != null">
default_value,
@ -175,34 +144,28 @@
<if test="templateId != null">
#{templateId,jdbcType=VARCHAR},
</if>
<if test="scene != null">
#{scene,jdbcType=VARCHAR},
</if>
<if test="required != null">
#{required,jdbcType=BIT},
</if>
<if test="pos != null">
#{pos,jdbcType=INTEGER},
</if>
<if test="customData != null">
#{customData,jdbcType=VARCHAR},
</if>
<if test="key != null">
#{key,jdbcType=VARCHAR},
<if test="apiFieldId != null">
#{apiFieldId,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
#{defaultValue,jdbcType=LONGVARBINARY},
#{defaultValue,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.CustomFieldTemplateExample" resultType="java.lang.Long">
select count(*) from custom_field_template
<select id="countByExample" parameterType="io.metersphere.system.domain.TemplateCustomFieldExample" resultType="java.lang.Long">
select count(*) from template_custom_field
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update custom_field_template
update template_custom_field
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -213,60 +176,38 @@
<if test="record.templateId != null">
template_id = #{record.templateId,jdbcType=VARCHAR},
</if>
<if test="record.scene != null">
scene = #{record.scene,jdbcType=VARCHAR},
</if>
<if test="record.required != null">
required = #{record.required,jdbcType=BIT},
</if>
<if test="record.pos != null">
pos = #{record.pos,jdbcType=INTEGER},
</if>
<if test="record.customData != null">
custom_data = #{record.customData,jdbcType=VARCHAR},
</if>
<if test="record.key != null">
`key` = #{record.key,jdbcType=VARCHAR},
<if test="record.apiFieldId != null">
api_field_id = #{record.apiFieldId,jdbcType=VARCHAR},
</if>
<if test="record.defaultValue != null">
default_value = #{record.defaultValue,jdbcType=LONGVARBINARY},
default_value = #{record.defaultValue,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update custom_field_template
set id = #{record.id,jdbcType=VARCHAR},
field_id = #{record.fieldId,jdbcType=VARCHAR},
template_id = #{record.templateId,jdbcType=VARCHAR},
scene = #{record.scene,jdbcType=VARCHAR},
required = #{record.required,jdbcType=BIT},
pos = #{record.pos,jdbcType=INTEGER},
custom_data = #{record.customData,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR},
default_value = #{record.defaultValue,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update custom_field_template
update template_custom_field
set id = #{record.id,jdbcType=VARCHAR},
field_id = #{record.fieldId,jdbcType=VARCHAR},
template_id = #{record.templateId,jdbcType=VARCHAR},
scene = #{record.scene,jdbcType=VARCHAR},
required = #{record.required,jdbcType=BIT},
pos = #{record.pos,jdbcType=INTEGER},
custom_data = #{record.customData,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR}
api_field_id = #{record.apiFieldId,jdbcType=VARCHAR},
default_value = #{record.defaultValue,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.CustomFieldTemplate">
update custom_field_template
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.TemplateCustomField">
update template_custom_field
<set>
<if test="fieldId != null">
field_id = #{fieldId,jdbcType=VARCHAR},
@ -274,64 +215,43 @@
<if test="templateId != null">
template_id = #{templateId,jdbcType=VARCHAR},
</if>
<if test="scene != null">
scene = #{scene,jdbcType=VARCHAR},
</if>
<if test="required != null">
required = #{required,jdbcType=BIT},
</if>
<if test="pos != null">
pos = #{pos,jdbcType=INTEGER},
</if>
<if test="customData != null">
custom_data = #{customData,jdbcType=VARCHAR},
</if>
<if test="key != null">
`key` = #{key,jdbcType=VARCHAR},
<if test="apiFieldId != null">
api_field_id = #{apiFieldId,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
default_value = #{defaultValue,jdbcType=LONGVARBINARY},
default_value = #{defaultValue,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.CustomFieldTemplate">
update custom_field_template
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.TemplateCustomField">
update template_custom_field
set field_id = #{fieldId,jdbcType=VARCHAR},
template_id = #{templateId,jdbcType=VARCHAR},
scene = #{scene,jdbcType=VARCHAR},
required = #{required,jdbcType=BIT},
pos = #{pos,jdbcType=INTEGER},
custom_data = #{customData,jdbcType=VARCHAR},
`key` = #{key,jdbcType=VARCHAR},
default_value = #{defaultValue,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.CustomFieldTemplate">
update custom_field_template
set field_id = #{fieldId,jdbcType=VARCHAR},
template_id = #{templateId,jdbcType=VARCHAR},
scene = #{scene,jdbcType=VARCHAR},
required = #{required,jdbcType=BIT},
pos = #{pos,jdbcType=INTEGER},
custom_data = #{customData,jdbcType=VARCHAR},
`key` = #{key,jdbcType=VARCHAR}
api_field_id = #{apiFieldId,jdbcType=VARCHAR},
default_value = #{defaultValue,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into custom_field_template
(id, field_id, template_id, scene, required, pos, custom_data, `key`, default_value
)
insert into template_custom_field
(id, field_id, template_id, required, pos, api_field_id, default_value)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.fieldId,jdbcType=VARCHAR}, #{item.templateId,jdbcType=VARCHAR},
#{item.scene,jdbcType=VARCHAR}, #{item.required,jdbcType=BIT}, #{item.pos,jdbcType=INTEGER},
#{item.customData,jdbcType=VARCHAR}, #{item.key,jdbcType=VARCHAR}, #{item.defaultValue,jdbcType=LONGVARBINARY}
)
#{item.required,jdbcType=BIT}, #{item.pos,jdbcType=INTEGER}, #{item.apiFieldId,jdbcType=VARCHAR},
#{item.defaultValue,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into custom_field_template (
insert into template_custom_field (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
@ -349,23 +269,17 @@
<if test="'template_id'.toString() == column.value">
#{item.templateId,jdbcType=VARCHAR}
</if>
<if test="'scene'.toString() == column.value">
#{item.scene,jdbcType=VARCHAR}
</if>
<if test="'required'.toString() == column.value">
#{item.required,jdbcType=BIT}
</if>
<if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=INTEGER}
</if>
<if test="'custom_data'.toString() == column.value">
#{item.customData,jdbcType=VARCHAR}
</if>
<if test="'key'.toString() == column.value">
#{item.key,jdbcType=VARCHAR}
<if test="'api_field_id'.toString() == column.value">
#{item.apiFieldId,jdbcType=VARCHAR}
</if>
<if test="'default_value'.toString() == column.value">
#{item.defaultValue,jdbcType=LONGVARBINARY}
#{item.defaultValue,jdbcType=VARCHAR}
</if>
</foreach>
)

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.Template;
import io.metersphere.system.domain.TemplateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TemplateMapper {
long countByExample(TemplateExample example);
int deleteByExample(TemplateExample example);
int deleteByPrimaryKey(String id);
int insert(Template record);
int insertSelective(Template record);
List<Template> selectByExample(TemplateExample example);
Template selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Template record, @Param("example") TemplateExample example);
int updateByExample(@Param("record") Template record, @Param("example") TemplateExample example);
int updateByPrimaryKeySelective(Template record);
int updateByPrimaryKey(Template record);
int batchInsert(@Param("list") List<Template> list);
int batchInsertSelective(@Param("list") List<Template> list, @Param("selective") Template.Column ... selective);
}

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.ApiTemplateMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.ApiTemplate">
<mapper namespace="io.metersphere.system.mapper.TemplateMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.Template">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="internal" jdbcType="BIT" property="internal" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="scope_type" jdbcType="VARCHAR" property="scopeType" />
<result column="scope_id" jdbcType="VARCHAR" property="scopeId" />
<result column="enable_third_part" jdbcType="BIT" property="enableThirdPart" />
<result column="scene" jdbcType="VARCHAR" property="scene" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -69,15 +73,16 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, description, internal, create_time, create_user, project_id
id, `name`, remark, internal, update_time, create_time, create_user, scope_type,
scope_id, enable_third_part, scene
</sql>
<select id="selectByExample" parameterType="io.metersphere.project.domain.ApiTemplateExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.system.domain.TemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_template
from template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -88,29 +93,31 @@
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from api_template
from template
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_template
delete from template
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.ApiTemplateExample">
delete from api_template
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.TemplateExample">
delete from template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.project.domain.ApiTemplate">
insert into api_template (id, `name`, description,
internal, create_time, create_user,
project_id)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{internal,jdbcType=BIT}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR})
<insert id="insert" parameterType="io.metersphere.system.domain.Template">
insert into template (id, `name`, remark,
internal, update_time, create_time,
create_user, scope_type, scope_id,
enable_third_part, scene)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{internal,jdbcType=BIT}, #{updateTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{scopeType,jdbcType=VARCHAR}, #{scopeId,jdbcType=VARCHAR},
#{enableThirdPart,jdbcType=BIT}, #{scene,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.ApiTemplate">
insert into api_template
<insert id="insertSelective" parameterType="io.metersphere.system.domain.Template">
insert into template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -118,20 +125,32 @@
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
<if test="remark != null">
remark,
</if>
<if test="internal != null">
internal,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="projectId != null">
project_id,
<if test="scopeType != null">
scope_type,
</if>
<if test="scopeId != null">
scope_id,
</if>
<if test="enableThirdPart != null">
enable_third_part,
</if>
<if test="scene != null">
scene,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -141,31 +160,43 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="internal != null">
#{internal,jdbcType=BIT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
<if test="scopeType != null">
#{scopeType,jdbcType=VARCHAR},
</if>
<if test="scopeId != null">
#{scopeId,jdbcType=VARCHAR},
</if>
<if test="enableThirdPart != null">
#{enableThirdPart,jdbcType=BIT},
</if>
<if test="scene != null">
#{scene,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.ApiTemplateExample" resultType="java.lang.Long">
select count(*) from api_template
<select id="countByExample" parameterType="io.metersphere.system.domain.TemplateExample" resultType="java.lang.Long">
select count(*) from template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_template
update template
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -173,20 +204,32 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.internal != null">
internal = #{record.internal,jdbcType=BIT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
<if test="record.scopeType != null">
scope_type = #{record.scopeType,jdbcType=VARCHAR},
</if>
<if test="record.scopeId != null">
scope_id = #{record.scopeId,jdbcType=VARCHAR},
</if>
<if test="record.enableThirdPart != null">
enable_third_part = #{record.enableThirdPart,jdbcType=BIT},
</if>
<if test="record.scene != null">
scene = #{record.scene,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
@ -194,64 +237,86 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_template
update template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
internal = #{record.internal,jdbcType=BIT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}
scope_type = #{record.scopeType,jdbcType=VARCHAR},
scope_id = #{record.scopeId,jdbcType=VARCHAR},
enable_third_part = #{record.enableThirdPart,jdbcType=BIT},
scene = #{record.scene,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.ApiTemplate">
update api_template
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.Template">
update template
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="internal != null">
internal = #{internal,jdbcType=BIT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
<if test="scopeType != null">
scope_type = #{scopeType,jdbcType=VARCHAR},
</if>
<if test="scopeId != null">
scope_id = #{scopeId,jdbcType=VARCHAR},
</if>
<if test="enableThirdPart != null">
enable_third_part = #{enableThirdPart,jdbcType=BIT},
</if>
<if test="scene != null">
scene = #{scene,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.ApiTemplate">
update api_template
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.Template">
update template
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
internal = #{internal,jdbcType=BIT},
update_time = #{updateTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}
scope_type = #{scopeType,jdbcType=VARCHAR},
scope_id = #{scopeId,jdbcType=VARCHAR},
enable_third_part = #{enableThirdPart,jdbcType=BIT},
scene = #{scene,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into api_template
(id, `name`, description, internal, create_time, create_user, project_id)
insert into template
(id, `name`, remark, internal, update_time, create_time, create_user, scope_type,
scope_id, enable_third_part, scene)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR},
#{item.internal,jdbcType=BIT}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.projectId,jdbcType=VARCHAR})
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR},
#{item.internal,jdbcType=BIT}, #{item.updateTime,jdbcType=BIGINT}, #{item.createTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.scopeType,jdbcType=VARCHAR}, #{item.scopeId,jdbcType=VARCHAR},
#{item.enableThirdPart,jdbcType=BIT}, #{item.scene,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into api_template (
insert into template (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
@ -266,20 +331,32 @@
<if test="'name'.toString() == column.value">
#{item.name,jdbcType=VARCHAR}
</if>
<if test="'description'.toString() == column.value">
#{item.description,jdbcType=VARCHAR}
<if test="'remark'.toString() == column.value">
#{item.remark,jdbcType=VARCHAR}
</if>
<if test="'internal'.toString() == column.value">
#{item.internal,jdbcType=BIT}
</if>
<if test="'update_time'.toString() == column.value">
#{item.updateTime,jdbcType=BIGINT}
</if>
<if test="'create_time'.toString() == column.value">
#{item.createTime,jdbcType=BIGINT}
</if>
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>
<if test="'project_id'.toString() == column.value">
#{item.projectId,jdbcType=VARCHAR}
<if test="'scope_type'.toString() == column.value">
#{item.scopeType,jdbcType=VARCHAR}
</if>
<if test="'scope_id'.toString() == column.value">
#{item.scopeId,jdbcType=VARCHAR}
</if>
<if test="'enable_third_part'.toString() == column.value">
#{item.enableThirdPart,jdbcType=BIT}
</if>
<if test="'scene'.toString() == column.value">
#{item.scene,jdbcType=VARCHAR}
</if>
</foreach>
)

View File

@ -339,6 +339,110 @@ CREATE TABLE IF NOT EXISTS test_resource_pool_organization
CREATE INDEX idx_test_resource_pool_id ON test_resource_pool_organization(`test_resource_pool_id`);
CREATE INDEX idx_org_id ON test_resource_pool_organization(`org_id`);
CREATE TABLE IF NOT EXISTS custom_field(
`id` VARCHAR(50) NOT NULL COMMENT '自定义字段ID' ,
`name` VARCHAR(255) NOT NULL COMMENT '自定义字段名称' ,
`scene` VARCHAR(30) NOT NULL COMMENT '使用场景' ,
`type` VARCHAR(30) NOT NULL COMMENT '自定义字段类型' ,
`remark` VARCHAR(500) COMMENT '自定义字段备注' ,
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置字段' ,
`scope_type` VARCHAR(50) NOT NULL DEFAULT 0 COMMENT '组织或项目级别字段PROJECT, ORGANIZATION' ,
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`scope_id` VARCHAR(50) NOT NULL COMMENT '组织或项目ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '自定义字段';
CREATE INDEX idx_scope_id ON custom_field(scope_id);
CREATE TABLE IF NOT EXISTS custom_field_option(
`field_id` VARCHAR(50) NOT NULL COMMENT '自定义字段ID' ,
`value` VARCHAR(50) NOT NULL COMMENT '选项值' ,
`text` VARCHAR(255) NOT NULL COMMENT '选项值名称' ,
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否内置' ,
PRIMARY KEY (field_id,value)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '自定义字段选项';
CREATE TABLE IF NOT EXISTS template(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`name` VARCHAR(255) NOT NULL COMMENT '名称' ,
`remark` VARCHAR(500) COMMENT '备注' ,
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置模板' ,
`update_time` BIGINT NOT NULL COMMENT '创建时间' ,
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`scope_type` VARCHAR(50) NOT NULL COMMENT '组织或项目级别字段PROJECT, ORGANIZATION' ,
`scope_id` VARCHAR(50) NOT NULL COMMENT '组织或项目ID' ,
`enable_third_part` BIT NOT NULL DEFAULT 0 COMMENT '是否开启api字段名配置' ,
`scene` VARCHAR(30) NOT NULL COMMENT '使用场景' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT = '模版';
CREATE INDEX idx_scope_id ON template(scope_id);
CREATE TABLE IF NOT EXISTS template_custom_field(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`field_id` VARCHAR(50) NOT NULL COMMENT '字段ID' ,
`template_id` VARCHAR(50) NOT NULL COMMENT '模版ID' ,
`required` BIT NOT NULL DEFAULT 0 COMMENT '是否必填' ,
`pos` INT NOT NULL DEFAULT 0 COMMENT '排序字段' ,
`api_field_id` VARCHAR(255) COMMENT 'api字段名' ,
`default_value` VARCHAR(500) COMMENT '默认值' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT = '模板和字段的关联关系';
CREATE INDEX idx_template_id ON template_custom_field(template_id);
CREATE TABLE IF NOT EXISTS status_item(
`id` VARCHAR(50) NOT NULL COMMENT '状态ID' ,
`name` VARCHAR(255) NOT NULL COMMENT '状态名称' ,
`scene` VARCHAR(30) NOT NULL COMMENT '使用场景' ,
`remark` VARCHAR(500) COMMENT '状态说明' ,
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置字段' ,
`scope_type` VARCHAR(50) NOT NULL DEFAULT 0 COMMENT '组织或项目级别字段PROJECT, ORGANIZATION' ,
`scope_id` VARCHAR(50) NOT NULL COMMENT '组织或项目ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT = '状态流的状态项';
CREATE INDEX idx_scope_id ON status_item(scope_id);
CREATE TABLE IF NOT EXISTS status_definition(
`id` VARCHAR(50) NOT NULL COMMENT '状态ID' ,
`status_id` VARCHAR(50) NOT NULL COMMENT '状态ID' ,
`definition_id` VARCHAR(500) COMMENT '状态定义ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT = '状态定义';
CREATE INDEX idx_status_id ON status_definition(status_id);
CREATE TABLE IF NOT EXISTS status_flow(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`from_id` VARCHAR(50) NOT NULL COMMENT '起始状态ID' ,
`to_id` VARCHAR(50) NOT NULL COMMENT '目的状态ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
COMMENT = '状态流转';
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -1,55 +1,6 @@
-- set innodb lock wait timeout
SET SESSION innodb_lock_wait_timeout = 7200;
CREATE TABLE IF NOT EXISTS custom_field
(
`id` VARCHAR(50) NOT NULL COMMENT '自定义字段ID',
`name` VARCHAR(255) NOT NULL COMMENT '自定义字段名称',
`scene` VARCHAR(30) NOT NULL COMMENT '使用场景',
`type` VARCHAR(30) NOT NULL COMMENT '自定义字段类型',
`remark` VARCHAR(255) COMMENT '自定义字段备注',
`options` TEXT COMMENT '自定义字段选项',
`system` BIT DEFAULT 0 COMMENT '是否是系统字段',
`global` BIT DEFAULT 0 COMMENT '是否是全局字段',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`update_time` BIGINT NOT NULL COMMENT '更新时间',
`create_user` VARCHAR(50) COMMENT '创建人',
`project_id` VARCHAR(50) COMMENT '项目ID',
`third_part` BIT NOT NULL DEFAULT 0 COMMENT '是否关联第三方',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '自定义字段';
CREATE INDEX idx_global ON custom_field (global);
CREATE INDEX idx_name ON custom_field (name);
CREATE INDEX idx_scene ON custom_field (scene);
CREATE INDEX idx_create_time ON custom_field (create_time);
CREATE INDEX idx_update_time ON custom_field (update_time);
CREATE INDEX idx_create_user ON custom_field (create_user);
CREATE INDEX idx_project_id ON custom_field (project_id);
CREATE TABLE IF NOT EXISTS custom_field_template
(
`id` VARCHAR(50) NOT NULL COMMENT '自定义模版ID',
`field_id` VARCHAR(50) NOT NULL COMMENT '自定义字段ID',
`template_id` VARCHAR(50) NOT NULL COMMENT '模版ID',
`scene` VARCHAR(30) NOT NULL COMMENT '使用场景',
`required` BIT COMMENT '是否必填',
`pos` INT COMMENT '排序字段',
`default_value` LONGBLOB COMMENT '默认值',
`custom_data` VARCHAR(255) COMMENT '自定义数据',
`key` VARCHAR(1) COMMENT '自定义表头',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '自定义模版';
CREATE INDEX custom_field_template_field_id_index ON custom_field_template (field_id);
CREATE INDEX custom_field_template_template_id_index ON custom_field_template (template_id);
CREATE TABLE IF NOT EXISTS custom_function
(
`id` VARCHAR(50) NOT NULL COMMENT '',
@ -278,95 +229,6 @@ CREATE TABLE IF NOT EXISTS file_metadata_blob
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '文件基础信息大字段';
CREATE TABLE IF NOT EXISTS functional_case_template
(
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
`name` VARCHAR(255) NOT NULL COMMENT '名称',
`description` VARCHAR(500) COMMENT '描述',
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置模板',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '功能用例模版';
CREATE INDEX idx_name ON functional_case_template (name);
CREATE INDEX idx_system ON functional_case_template (internal);
CREATE INDEX idx_create_time ON functional_case_template (create_time);
CREATE INDEX idx_create_user ON functional_case_template (create_user);
CREATE INDEX idx_project_id ON functional_case_template (project_id);
CREATE TABLE IF NOT EXISTS functional_case_template_extend
(
`id` VARCHAR(50) NOT NULL COMMENT '模板ID',
`case_name` VARCHAR(255) COMMENT '用例名称模板',
`prerequisite` TEXT COMMENT '前置条件模板',
`step_description` TEXT COMMENT '步骤描述模板',
`expected_result` TEXT COMMENT '预期结果模板',
`actual_result` TEXT COMMENT '实际结果模板',
`step_model` VARCHAR(64) NOT NULL DEFAULT 'Step' COMMENT '编辑模式模板:步骤模式/文本模式',
`steps` TEXT COMMENT '用例步骤',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '功能用例模版扩展';
CREATE TABLE IF NOT EXISTS bug_template_extend
(
`id` VARCHAR(50) NOT NULL COMMENT '缺陷模板ID',
`title` VARCHAR(255) COMMENT '缺陷标题模板',
`content` TEXT COMMENT '缺陷内容模板',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '缺陷模板扩展';
CREATE TABLE IF NOT EXISTS bug_template
(
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
`name` VARCHAR(255) NOT NULL COMMENT '名称',
`description` VARCHAR(500) COMMENT '描述',
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置模板',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '缺陷模版';
CREATE INDEX idx_name ON bug_template (name);
CREATE INDEX idx_system ON bug_template (internal);
CREATE INDEX idx_create_time ON bug_template (create_time);
CREATE INDEX idx_create_user ON bug_template (create_user);
CREATE INDEX idx_project_id ON bug_template (project_id);
CREATE TABLE IF NOT EXISTS api_template
(
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
`name` VARCHAR(255) NOT NULL COMMENT '名称',
`description` VARCHAR(500) COMMENT '描述',
`internal` BIT NOT NULL DEFAULT 0 COMMENT '是否是内置模板',
`create_time` BIGINT NOT NULL COMMENT '创建时间',
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '接口定义模板';
CREATE INDEX idx_name ON api_template (name);
CREATE INDEX idx_system ON api_template (internal);
CREATE INDEX idx_create_time ON api_template (create_time);
CREATE INDEX idx_create_user ON api_template (create_user);
CREATE INDEX idx_project_id ON api_template (project_id);
CREATE TABLE IF NOT EXISTS message_task
(
`id` VARCHAR(50) NOT NULL COMMENT '',

View File

@ -105,6 +105,22 @@ INSERT into system_parameter values('base.prometheus.host', 'http://ms-prometheu
INSERT INTO test_resource_pool (id, name, type, description, enable, create_time, update_time, create_user, api_test, load_test, ui_test, all_org, deleted) VALUES ('a6374438-80fc-4a28-8848-96c492830af5', 'LOCAL', 'Node', '系统初始化资源池', true, 1690440108595, 1690440110182, 'admin', true, true, true, true, false);
INSERT INTO test_resource_pool_blob (id, configuration) VALUES ('a6374438-80fc-4a28-8848-96c492830af5', 0x504B03041400080808004F76FC56000000000000000000000000030000007A6970ED58C18EA33810FD1584E618266969B4D272A3136F9A9E8444408F76351921079CC413B09131D989A2FCFB96A1932604D3873DADB63941D5F3F3ABA2EC329CCC94E32424857433BC25A66D9A83ABE989E0BCB6309E9062460B69DADF4F265556898BBD254AC6880040CE05F8CCDF46A3113C659C51C905187E7FA80C316771290461D22BB3358CB0C17EFE31A8A85899A60353F23D619707863312E43826C5C572CF50DB739E843B41707245FEE4EB09D950504039109A38A7DF8828E0C136D658C6BBE1E161C5F69425B6F1CCD72B961189132CB1BD628691E235498BEAD6302424C1A280FB740A511046EEE4AC1C4A9DB23D2F1E23CF992330163989AB413916384D494A8BCC361E9445922C4FB124AF9C37B3A9EB66C69E590DE33A89BAF0A68AF1D81808B97098A4CEBD077C826C08E42F999482B26D10EF4852A670E76E19BF9AD12F12972A6F37630DC3AAB85F794322B296FF1A47405212C3ABEFF043E82AFBE8174829D4EB283A416AB23D39DA973474630C83E744603593E1321DE680D392E8A6A9A76AE7B879499EF3946F8F5F959C7D0955C708A8FA4CF970C70BA9CAA03DE86F42B73B096F7E34BAB8A07225A6B04C9A422C306719861A6C27BAD8B52D56DCB60C61DD592A3F9F6FD1841DEEF8EA620D42C70FA3D09DA3B6E22A47B6B1323F9DDE40E795D9CD33F51DEF65E6F86EF8570F5103A5657A9EA310F9918F960B3F0CA270B174C71A4A58691DE073376F850C964FC847D18B3FD352B6701A361F058B177F8CA040B44C0D8C86E5D1197F45DE249AB941883CE4F7A4AE0DD5E6EF71B10883D077965180FC6F108A56DF1D5217AB13BA8B1E69955FABA77E37D11FAEE7E8925E9134605AAED725A98DA87BC95E473FF9C89944DECBBC47C71B48ABE209394BAD04E5D4D64C15626FC5BC22FA1940E1EC9D25DB42F6BC9D4B8D7A13F4672F6113A8E59B2DA6EF2CD92B4213E3741C39B3A9AEDE600FA9FD37A3A93AA334F60377EE4CD13D6209E780254F690CDBB6BBF1B85C42C781934313588BF809DD98889B3E09079976C7B0DEF6F025B86D431D73466DE5B9E092C73C85021CDFD4CD81A76546E6BC641DCC99322FB1DCD9C650EDE86DD65A67D50B37342545DFF83A1A0B5A56370B38DA24FFB20F6D09535D985882A8C47DB4A33BDE8F76D4D6F7D18E3A747CB4231DE1FFA91DD5BBE87FA377400C120B7909CC2387B7465AABBEFDDE81AF60799C50F85E3B9DEF23EF12F9DE98862473A03EF31BBF31EA5F0109C9537EF4007DB194742A6862DAE64ECADC1E0E0BF85E65B4CCAC5DB9B6BFC0054C5B2A92F1DDEF862F03938BADABFE337CFF71FE07504B07081EC0585CBB03000038110000504B010214001400080808004F76FC561EC0585CBB030000381100000300000000000000000000000000000000007A6970504B0506000000000100010031000000EC0300000000);
-- 初始化内置自定义字段和模板
INSERT INTO custom_field(id, name, scene, `type`, remark, internal, scope_type, create_time, update_time, create_user, scope_id)
VALUES(uuid(), 'functional_priority', 'FUNCTIONAL', 'SELECT', '', 1, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'default_organization');
INSERT INTO custom_field_option (field_id,value,`text`,internal)
VALUES ((select id from custom_field where name = 'functional_priority'), 'P0', 'P0', 1);
INSERT INTO custom_field_option (field_id,value,`text`,internal)
VALUES ((select id from custom_field where name = 'functional_priority'), 'P1', 'P1', 1);
INSERT INTO custom_field_option (field_id,value,`text`,internal)
VALUES ((select id from custom_field where name = 'functional_priority'), 'P2', 'P2', 1);
INSERT INTO custom_field_option (field_id,value,`text`,internal)
VALUES ((select id from custom_field where name = 'functional_priority'), 'P3', 'P3', 1);
INSERT INTO template (id,name,remark,internal,update_time,create_time,create_user,scope_type,scope_id,enable_third_part,scene)
VALUES (uuid(), 'functional_default', '', 1, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'ORGANIZATION', 'default_organization', 0, 'FUNCTIONAL');
INSERT INTO template_custom_field(id, field_id, template_id, required, pos, api_field_id, default_value)
VALUES(uuid(), (select id from custom_field where name = 'functional_priority'), (select id from template where name = 'functional_default'), 1, 0, NULL, NULL);
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -5,7 +5,7 @@ import lombok.Data;
import java.io.Serializable;
@Data
public class CustomFieldDTO implements Serializable {
public class PlatformCustomFieldDTO implements Serializable {
private String id;
private String name;

View File

@ -5,7 +5,7 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=false)
public class PlatformCustomFieldItemDTO extends CustomFieldDTO {
public class PlatformCustomFieldItemDTO extends PlatformCustomFieldDTO {
private Object value;
private String key;
private String customData;

View File

@ -1,6 +1,5 @@
package io.metersphere.sdk.config.interceptor;
import io.metersphere.project.domain.CustomFieldTemplate;
import io.metersphere.project.domain.CustomFunctionBlob;
import io.metersphere.project.domain.FakeErrorBlob;
import io.metersphere.project.domain.FileMetadataBlob;
@ -24,7 +23,6 @@ public class ProjectInterceptor {
configList.add(new MybatisInterceptorConfig(CustomFunctionBlob.class, "script", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(CustomFunctionBlob.class, "result", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(CustomFunctionBlob.class, "params", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(CustomFieldTemplate.class, "defaultValue", CompressUtils.class, "zip", "unzip"));
return configList;
}

View File

@ -21,7 +21,6 @@ public class SystemInterceptor {
configList.add(new MybatisInterceptorConfig(ServiceIntegration.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(UserExtend.class, "platformInfo", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(PluginScript.class, "script", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(PluginScript.class, "script", CompressUtils.class, "zip", "unzip"));
return configList;
}

View File

@ -0,0 +1,40 @@
package io.metersphere.sdk.constants;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
public enum CustomFieldType {
INPUT( false),
TEXTAREA(false),
SELECT( true),
MULTIPLE_SELECT(true),
RADIO(true),
CHECKBOX(true),
MEMBER(true),
MULTIPLE_MEMBER(true),
DATE(false),
DATETIME(false),
INT(false),
FLOAT(false),
MULTIPLE_INPUT(false),
RICH_TEXT(false),
CASCADING_SELECT(false);
private Boolean hasOption;
CustomFieldType(Boolean hasOption) {
this.hasOption = hasOption;
}
public Boolean getHasOption() {
return this.hasOption;
}
public static Set<String> getHasOptionValueSet() {
return Arrays.stream(CustomFieldType.values())
.filter(CustomFieldType::getHasOption)
.map(CustomFieldType::name)
.collect(Collectors.toSet());
}
}

View File

@ -87,6 +87,20 @@ public class PermissionConstants {
/*------ end: SYSTEM_PARAMETER_SETTING ------*/
/*------ start: ORGANIZATION_CUSTOM_FIELD ------*/
public static final String ORGANIZATION_CUSTOM_FIELD_READ = "ORGANIZATION_CUSTOM_FIELD:READ";
public static final String ORGANIZATION_CUSTOM_FIELD_ADD = "ORGANIZATION_CUSTOM_FIELD:READ+ADD";
public static final String ORGANIZATION_CUSTOM_FIELD_UPDATE = "ORGANIZATION_CUSTOM_FIELD:READ+UPDATE";
public static final String ORGANIZATION_CUSTOM_FIELD_DELETE = "ORGANIZATION_CUSTOM_FIELD:READ+DELETE";
/*------ end: ORGANIZATION_CUSTOM_FIELD ------*/
/*------ start: ORGANIZATION_TEMPLATE ------*/
public static final String ORGANIZATION_TEMPLATE_READ = "ORGANIZATION_TEMPLATE:READ";
public static final String ORGANIZATION_TEMPLATE_ADD = "ORGANIZATION_TEMPLATE:READ+ADD";
public static final String ORGANIZATION_TEMPLATE_UPDATE = "ORGANIZATION_TEMPLATE:READ+UPDATE";
public static final String ORGANIZATION_TEMPLATE_DELETE = "ORGANIZATION_TEMPLATE:READ+DELETE";
/*------ end: ORGANIZATION_TEMPLATE ------*/
/**
* 项目成员权限
*/

View File

@ -0,0 +1,8 @@
package io.metersphere.sdk.constants;
public enum TemplateScene {
FUNCTIONAL,
ISSUE,
API,
UI
}

View File

@ -0,0 +1,6 @@
package io.metersphere.sdk.constants;
public enum TemplateScopeType {
ORGANIZATION,
PROJECT
}

View File

@ -16,7 +16,12 @@ public enum CommonResultCode implements IResultCode {
USER_ROLE_RELATION_REMOVE_ADMIN_USER_PERMISSION(100004, "user_role_relation_remove_admin_user_permission_error"),
FILE_NAME_ILLEGAL(100005, "file_name_illegal_error"),
PLUGIN_ENABLE(100006, "plugin_enable_error"),
PLUGIN_PERMISSION(100007, "plugin_permission_error");
PLUGIN_PERMISSION(100007, "plugin_permission_error"),
INTERNAL_CUSTOM_FIELD_PERMISSION(101008, "internal_custom_field_permission_error"),
INTERNAL_TEMPLATE_PERMISSION(101009, "internal_template_permission_error"),
TEMPLATE_SCENE_ILLEGAL(101010, "template_scene_illegal_error"),
CUSTOM_FIELD_EXIST(101012, "custom_field.exist"),
TEMPLATE_EXIST(101013, "template.exist");
private int code;
private String message;

View File

@ -0,0 +1,12 @@
package io.metersphere.sdk.dto;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.CustomFieldOption;
import lombok.Data;
import java.util.List;
@Data
public class CustomFieldDTO extends CustomField {
private List<CustomFieldOption> options;
}

View File

@ -0,0 +1,24 @@
package io.metersphere.sdk.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class TemplateCustomFieldDTO {
@Schema(title = "字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String fieldId;
@Schema(title = "字段名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String fieldName;
@Schema(title = "是否必填")
private Boolean required;
@Schema(title = "api字段名")
private String apiFieldId;
@Schema(title = "默认值")
private String defaultValue;
}

View File

@ -0,0 +1,11 @@
package io.metersphere.sdk.dto;
import io.metersphere.system.domain.Template;
import lombok.Data;
import java.util.List;
@Data
public class TemplateDTO extends Template {
List<TemplateCustomFieldDTO> customFields;
}

View File

@ -0,0 +1,21 @@
package io.metersphere.sdk.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class CustomFieldOptionRequest {
@Schema(title = "选项值", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_option.value.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field_option.value.length_range}", groups = {Created.class, Updated.class})
private String value;
@Schema(title = "选项值名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field_option.text.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{custom_field_option.text.length_range}", groups = {Created.class, Updated.class})
private String text;
}

View File

@ -0,0 +1,49 @@
package io.metersphere.sdk.dto.request;
import io.metersphere.sdk.constants.CustomFieldType;
import io.metersphere.sdk.valid.EnumValue;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
@Data
public class CustomFieldUpdateRequest {
@Schema(title = "自定义字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{custom_field.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "自定义字段名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{custom_field.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{custom_field.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
@Schema(title = "自定义字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.type.not_blank}", groups = {Created.class})
@EnumValue(enumClass = CustomFieldType.class, groups = {Created.class, Updated.class})
@Size(min = 1, max = 30, message = "{custom_field.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(title = "自定义字段备注")
private String remark;
@Schema(title = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{custom_field.scope_id.length_range}", groups = {Created.class})
private String scopeId;
@Valid
@Schema(title = "自定义字段选项")
private List<CustomFieldOptionRequest> options;
}

View File

@ -0,0 +1,26 @@
package io.metersphere.sdk.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class TemplateCustomFieldRequest {
@Schema(title = "字段ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{custom_field.id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template_custom_field.field_id.length_range}", groups = {Created.class, Updated.class})
private String fieldId;
@Schema(title = "是否必填")
private Boolean required;
@Schema(title = "api字段名")
private String apiFieldId;
@Schema(title = "默认值")
private String defaultValue;
}

View File

@ -0,0 +1,44 @@
package io.metersphere.sdk.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
@Data
public class TemplateUpdateRequest {
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{template.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{template.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "备注")
private String remark;
@Schema(title = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template.scope_id.length_range}", groups = {Created.class, Updated.class})
private String scopeId;
@Schema(title = "是否开启api字段名配置")
private Boolean enableThirdPart;
@Schema(title = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{template.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
@Valid
@Schema(title = "自定义字段Id列表")
private List<TemplateCustomFieldRequest> customFields;
}

View File

@ -72,6 +72,9 @@ public class OperationLogModule {
//系统设置-组织-项目
public static final String SETTING_ORGANIZATION_PROJECT = "SETTING_ORGANIZATION_PROJECT";
// 模板管理
public static final String SETTING_SYSTEM_ORGANIZATION_CUSTOM_FIELD = "SETTING_SYSTEM_ORGANIZATION_CUSTOM_FIELD";
public static final String SETTING_SYSTEM_ORGANIZATION_TEMPLATE = "SETTING_SYSTEM_ORGANIZATION_TEMPLATE";
//项目管理
public static final String PROJECT_MANAGEMENT = "PROJECT_MANAGEMENT"; // 项目管理

View File

@ -0,0 +1,76 @@
package io.metersphere.sdk.service;
import io.metersphere.sdk.dto.request.CustomFieldOptionRequest;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.system.domain.CustomFieldOption;
import io.metersphere.system.domain.CustomFieldOptionExample;
import io.metersphere.system.mapper.CustomFieldOptionMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianxing
* @date : 2023-8-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class BaseCustomFieldOptionService {
@Resource
private CustomFieldOptionMapper customFieldOptionMapper;
public void deleteByFieldId(String fieldId) {
CustomFieldOptionExample example = new CustomFieldOptionExample();
example.createCriteria().andFieldIdEqualTo(fieldId);
customFieldOptionMapper.deleteByExample(example);
}
public List<CustomFieldOption> getByFieldId(String fieldId) {
CustomFieldOptionExample example = new CustomFieldOptionExample();
example.createCriteria().andFieldIdEqualTo(fieldId);
return customFieldOptionMapper.selectByExample(example);
}
public void addByFieldId(String fieldId, List<CustomFieldOptionRequest> customFieldOptionRequests) {
if (CollectionUtils.isEmpty(customFieldOptionRequests)) {
return;
}
List<CustomFieldOption> customFieldOptions = customFieldOptionRequests.stream().map(item -> {
CustomFieldOption customFieldOption = new CustomFieldOption();
BeanUtils.copyBean(customFieldOption, item);
customFieldOption.setFieldId(fieldId);
customFieldOption.setInternal(false);
return customFieldOption;
}).toList();
customFieldOptionMapper.batchInsert(customFieldOptions);
}
public void updateByFieldId(String fieldId, List<CustomFieldOptionRequest> customFieldOptionRequests) {
List<CustomFieldOption> originOptions = getByFieldId(fieldId);
// 查询原有选项
Map<String, CustomFieldOption> optionMap =
originOptions.stream().collect(Collectors.toMap(CustomFieldOption::getValue, i -> i));
// 先删除选项再添加
deleteByFieldId(fieldId);
List<CustomFieldOption> customFieldOptions = customFieldOptionRequests.stream().map(item -> {
CustomFieldOption customFieldOption = new CustomFieldOption();
BeanUtils.copyBean(customFieldOption, item);
if (optionMap.get(item.getValue()) != null) {
// 保留选项是否是内置的选项
customFieldOption.setInternal(optionMap.get(item.getValue()).getInternal());
} else {
customFieldOption.setInternal(false);
}
customFieldOption.setFieldId(fieldId);
return customFieldOption;
}).toList();
customFieldOptionMapper.batchInsert(customFieldOptions);
}
}

View File

@ -0,0 +1,168 @@
package io.metersphere.sdk.service;
import io.metersphere.sdk.constants.TemplateScene;
import io.metersphere.sdk.dto.CustomFieldDTO;
import io.metersphere.sdk.dto.request.CustomFieldOptionRequest;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.ServiceUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.CustomFieldExample;
import io.metersphere.system.mapper.CustomFieldMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import io.metersphere.sdk.uid.UUID;
import static io.metersphere.sdk.controller.handler.result.CommonResultCode.*;
/**
* @author jianxing
* @date : 2023-8-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class BaseCustomFieldService {
@Resource
private CustomFieldMapper customFieldMapper;
@Resource
private BaseUserService baseUserService;
@Resource
private BaseCustomFieldOptionService baseCustomFieldOptionService;
public List<CustomField> list(String scopeId, String scene) {
checkScene(scene);
List<CustomField> customFields = getByScopeIdAndScene(scopeId, scene);
List<String> userIds = customFields.stream().map(CustomField::getCreateUser).toList();
Map<String, String> userNameMap = baseUserService.getUserNameMap(userIds);
customFields.forEach(item -> {
item.setCreateUser(userNameMap.get(item.getCreateUser()));
if (item.getInternal()) {
item.setName(translateInternalField(item.getName()));
}
});
return customFields;
}
/**
* 翻译内置字段
* @param filedName
* @return
*/
public String translateInternalField(String filedName) {
return Translator.get("custom_field." + filedName);
}
public List<CustomField> getByScopeIdAndScene(String scopeId, String scene) {
CustomFieldExample example = new CustomFieldExample();
example.createCriteria()
.andScopeIdEqualTo(scopeId)
.andSceneEqualTo(scene);
return customFieldMapper.selectByExample(example);
}
public CustomField getWithCheck(String id) {
checkResourceExist(id);
return customFieldMapper.selectByPrimaryKey(id);
}
public CustomFieldDTO getCustomFieldDTOWithCheck(String id) {
checkResourceExist(id);
CustomField customField = customFieldMapper.selectByPrimaryKey(id);
CustomFieldDTO customFieldDTO = new CustomFieldDTO();
BeanUtils.copyBean(customFieldDTO, customField);
customFieldDTO.setOptions(baseCustomFieldOptionService.getByFieldId(customFieldDTO.getId()));
if (customField.getInternal()) {
customField.setName(translateInternalField(customField.getName()));
}
return customFieldDTO;
}
public CustomField add(CustomField customField, List<CustomFieldOptionRequest> options) {
checkAddExist(customField);
customField.setId(UUID.randomUUID().toString());
customField.setCreateTime(System.currentTimeMillis());
customField.setUpdateTime(System.currentTimeMillis());
customField.setInternal(false);
customFieldMapper.insert(customField);
baseCustomFieldOptionService.addByFieldId(customField.getId(), options);
return customField;
}
public CustomField update(CustomField customField, List<CustomFieldOptionRequest> options) {
checkUpdateExist(customField);
checkResourceExist(customField.getId());
customField.setScopeId(null);
customField.setScene(null);
customField.setScopeType(null);
customField.setInternal(false);
customField.setCreateUser(null);
customField.setCreateTime(null);
customField.setUpdateTime(System.currentTimeMillis());
customFieldMapper.updateByPrimaryKeySelective(customField);
if (options != null) {
baseCustomFieldOptionService.updateByFieldId(customField.getId(), options);
}
return customField;
}
public CustomField checkResourceExist(String id) {
return ServiceUtils.checkResourceExist(customFieldMapper.selectByPrimaryKey(id), "permission.organization_custom_field.name");
}
public void checkScene(String scene) {
Arrays.stream(TemplateScene.values()).map(TemplateScene::name)
.filter(item -> item.equals(scene))
.findFirst()
.orElseThrow(() -> new MSException(TEMPLATE_SCENE_ILLEGAL));
}
public void delete(String id) {
customFieldMapper.deleteByPrimaryKey(id);
baseCustomFieldOptionService.deleteByFieldId(id);
}
protected void checkInternal(CustomField customField) {
if (customField.getInternal()) {
throw new MSException(INTERNAL_CUSTOM_FIELD_PERMISSION);
}
}
protected void checkAddExist(CustomField customField) {
CustomFieldExample example = new CustomFieldExample();
example.createCriteria()
.andScopeIdEqualTo(customField.getScopeId())
.andNameEqualTo(customField.getName());
if (CollectionUtils.isNotEmpty(customFieldMapper.selectByExample(example))) {
throw new MSException(CUSTOM_FIELD_EXIST);
}
}
protected void checkUpdateExist(CustomField customField) {
if (StringUtils.isBlank(customField.getName())) {
return;
}
CustomFieldExample example = new CustomFieldExample();
example.createCriteria()
.andScopeIdEqualTo(customField.getScopeId())
.andIdNotEqualTo(customField.getId())
.andNameEqualTo(customField.getName());
if (CollectionUtils.isNotEmpty(customFieldMapper.selectByExample(example))) {
throw new MSException(CUSTOM_FIELD_EXIST);
}
}
public List<CustomField> getByIds(List<String> fieldIds) {
if (CollectionUtils.isEmpty(fieldIds)) {
return new ArrayList<>(0);
}
CustomFieldExample example = new CustomFieldExample();
example.createCriteria()
.andIdIn(fieldIds);
return customFieldMapper.selectByExample(example);
}
}

View File

@ -0,0 +1,67 @@
package io.metersphere.sdk.service;
import io.metersphere.sdk.dto.request.TemplateCustomFieldRequest;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.TemplateCustomField;
import io.metersphere.system.domain.TemplateCustomFieldExample;
import io.metersphere.system.mapper.TemplateCustomFieldMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Set;
import io.metersphere.sdk.uid.UUID;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
* @author jianxing
* @date : 2023-8-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class BaseTemplateCustomFieldService {
@Resource
private TemplateCustomFieldMapper templateCustomFieldMapper;
@Resource
private BaseCustomFieldService baseCustomFieldService;
public void deleteByTemplateId(String templateId) {
TemplateCustomFieldExample example = new TemplateCustomFieldExample();
example.createCriteria().andTemplateIdEqualTo(templateId);
templateCustomFieldMapper.deleteByExample(example);
}
public void addByTemplateId(String id, List<TemplateCustomFieldRequest> customFieldRequests) {
if (CollectionUtils.isEmpty(customFieldRequests)) {
return;
}
AtomicReference<Integer> pos = new AtomicReference<>(0);
List<TemplateCustomField> templateCustomFields = customFieldRequests.stream().map(field -> {
TemplateCustomField templateCustomField = new TemplateCustomField();
templateCustomField.setId(UUID.randomUUID().toString());
BeanUtils.copyBean(templateCustomField, field);
templateCustomField.setTemplateId(id);
templateCustomField.setPos(pos.getAndSet(pos.get() + 1));
return templateCustomField;
}).toList();
// 过滤下不存在的字段
List<String> ids = templateCustomFields.stream().map(TemplateCustomField::getFieldId).toList();
Set<String> fieldIdSet = baseCustomFieldService.getByIds(ids).stream().map(CustomField::getId).collect(Collectors.toSet());
templateCustomFields = templateCustomFields.stream().filter(item -> fieldIdSet.contains(item.getFieldId())).toList();
if (templateCustomFields.size() > 0) {
templateCustomFieldMapper.batchInsert(templateCustomFields);
}
}
public List<TemplateCustomField> getByTemplateId(String id) {
TemplateCustomFieldExample example = new TemplateCustomFieldExample();
example.createCriteria().andTemplateIdEqualTo(id);
return templateCustomFieldMapper.selectByExample(example);
}
}

View File

@ -0,0 +1,183 @@
package io.metersphere.sdk.service;
import io.metersphere.sdk.constants.TemplateScene;
import io.metersphere.sdk.dto.TemplateCustomFieldDTO;
import io.metersphere.sdk.dto.TemplateDTO;
import io.metersphere.sdk.dto.request.TemplateCustomFieldRequest;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.ServiceUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.Template;
import io.metersphere.system.domain.TemplateCustomField;
import io.metersphere.system.domain.TemplateExample;
import io.metersphere.system.mapper.TemplateMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.metersphere.sdk.uid.UUID;
import java.util.stream.Collectors;
import static io.metersphere.sdk.controller.handler.result.CommonResultCode.*;
/**
* @author jianxing
* @date : 2023-8-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class BaseTemplateService {
@Resource
private TemplateMapper templateMapper;
@Resource
private BaseTemplateCustomFieldService baseTemplateCustomFieldService;
@Resource
private BaseUserService baseUserService;
@Resource
private BaseCustomFieldService baseCustomFieldService;
public List<Template> list(String scopeId, String scene) {
checkScene(scene);
List<Template> templates = getTemplates(scopeId, scene);
List<String> userIds = templates.stream().map(Template::getCreateUser).toList();
Map<String, String> userNameMap = baseUserService.getUserNameMap(userIds);
templates.forEach(item -> {
item.setCreateUser(userNameMap.get(item.getCreateUser()));
if (item.getInternal()) {
item.setName(translateInternalTemplate(item.getName()));
}
});
return templates;
}
public List<Template> getTemplates(String scopeId, String scene) {
TemplateExample example = new TemplateExample();
example.createCriteria()
.andScopeIdEqualTo(scopeId)
.andSceneEqualTo(scene);
List<Template> templates = templateMapper.selectByExample(example);
return templates;
}
public String translateInternalTemplate(String filedName) {
return Translator.get("template." + filedName);
}
public Template getWithCheck(String id) {
return checkResourceExist(id);
}
public TemplateDTO geDTOWithCheck(Template template) {
List<TemplateCustomField> templateCustomFields = baseTemplateCustomFieldService.getByTemplateId(template.getId());
// 查找字段名称
List<String> fieldIds = templateCustomFields.stream().map(TemplateCustomField::getFieldId).toList();
Map<String, String> fieldNameMap = baseCustomFieldService.getByIds(fieldIds)
.stream()
.collect(Collectors.toMap(CustomField::getId, i -> {
if (i.getInternal()) {
return baseCustomFieldService.translateInternalField(i.getName());
}
return i.getName();
}));
// 封装字段信息
List<TemplateCustomFieldDTO> fieldDTOS = templateCustomFields.stream().map(i -> {
TemplateCustomFieldDTO templateCustomFieldDTO = new TemplateCustomFieldDTO();
BeanUtils.copyBean(templateCustomFieldDTO, i);
templateCustomFieldDTO.setFieldName(fieldNameMap.get(i.getFieldId()));
return templateCustomFieldDTO;
}).toList();
TemplateDTO templateDTO = BeanUtils.copyBean(new TemplateDTO(), template);
templateDTO.setCustomFields(fieldDTOS);
return templateDTO;
}
public Template add(Template template, List<TemplateCustomFieldRequest> customFields) {
checkAddExist(template);
template.setId(UUID.randomUUID().toString());
template.setCreateTime(System.currentTimeMillis());
template.setUpdateTime(System.currentTimeMillis());
template.setInternal(false);
templateMapper.insert(template);
baseTemplateCustomFieldService.deleteByTemplateId(template.getId());
baseTemplateCustomFieldService.addByTemplateId(template.getId(), customFields);
return template;
}
public void checkScene(String scene) {
Arrays.stream(TemplateScene.values()).map(TemplateScene::name)
.filter(item -> item.equals(scene))
.findFirst()
.orElseThrow(() -> new MSException(TEMPLATE_SCENE_ILLEGAL));
}
public Template update(Template template, List<TemplateCustomFieldRequest> customFields) {
checkResourceExist(template.getId());
checkUpdateExist(template);
template.setUpdateTime(System.currentTimeMillis());
template.setInternal(null);
template.setScene(null);
template.setScopeType(null);
template.setScopeId(null);
template.setCreateUser(null);
template.setCreateTime(null);
// customFields null 则不修改
if (customFields != null) {
baseTemplateCustomFieldService.deleteByTemplateId(template.getId());
baseTemplateCustomFieldService.addByTemplateId(template.getId(), customFields);
}
templateMapper.updateByPrimaryKeySelective(template);
return template;
}
public void delete(String id) {
checkResourceExist(id);
templateMapper.deleteByPrimaryKey(id);
baseTemplateCustomFieldService.deleteByTemplateId(id);
}
protected void checkInternal(Template template) {
if (template.getInternal()) {
throw new MSException(INTERNAL_TEMPLATE_PERMISSION);
}
}
protected void checkAddExist(Template template) {
TemplateExample example = new TemplateExample();
example.createCriteria()
.andScopeIdEqualTo(template.getScopeId())
.andNameEqualTo(template.getName());
if (CollectionUtils.isNotEmpty(templateMapper.selectByExample(example))) {
throw new MSException(TEMPLATE_EXIST);
}
}
protected void checkUpdateExist(Template template) {
if (StringUtils.isBlank(template.getName())) {
return;
}
TemplateExample example = new TemplateExample();
example.createCriteria()
.andScopeIdEqualTo(template.getScopeId())
.andIdNotEqualTo(template.getId())
.andNameEqualTo(template.getName());
if (CollectionUtils.isNotEmpty(templateMapper.selectByExample(example))) {
throw new MSException(TEMPLATE_EXIST);
}
}
private Template checkResourceExist(String id) {
return ServiceUtils.checkResourceExist(templateMapper.selectByPrimaryKey(id), "permission.system_template.name");
}
}

View File

@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import io.metersphere.sdk.uid.UUID;
import java.util.stream.Collectors;
import static io.metersphere.sdk.controller.handler.result.CommonResultCode.INTERNAL_USER_ROLE_PERMISSION;

View File

@ -405,6 +405,10 @@ user_role_relation_exist_error=The user is already in the current user group
internal_user_role_permission_error=Internal user groups cannot be edited or deleted
user_role_relation_remove_admin_user_permission_error=Unable to delete the admin user from the system administrator user group
# customField
internal_custom_field_permission_error=System fields cannot be deleted
internal_template_permission_error=System template cannot be deleted
#result message
http_result_success=operate success
http_result_unknown_exception=system unknown exception
@ -434,8 +438,13 @@ permission.delete=Delete
permission.import=Import
permission.recover=Recover
file_name_illegal_error=File name is invalid
file_name_illegal_error=File name is illegal
plugin_enable_error=Plugin is not enabled
plugin_permission_error=No access to this plugin
scheduled_tasks=Scheduled Tasks
scheduled_tasks=Scheduled Tasks
template_scene_illegal_error=Scene is illegal
# 内置的模板或字段
custom_field.functional_priority=Priority
template.functional_default=Default

View File

@ -402,6 +402,9 @@ get_plugin_instance_error=获取插件接口实现类错误!
user_role_relation_exist_error=用户已在当前用户组!
internal_user_role_permission_error=内置用户组无法编辑与删除!
user_role_relation_remove_admin_user_permission_error=无法将 admin 用户将系统管理员用户组删除!
# customField
internal_custom_field_permission_error=系统字段或模板无法删除!
internal_template_permission_error=系统模板无法删除!
#result message
http_result_success=操作成功
@ -437,4 +440,8 @@ file_name_illegal_error=文件名不合法
plugin_enable_error=插件未启用
plugin_permission_error=没有该插件的访问权限
scheduled_tasks=定时任务
scheduled_tasks=定时任务
template_scene_illegal_error=使用场景不合法
# 内置的模板或字段
custom_field.functional_priority=优先级
template.functional_default=默认模板

View File

@ -401,6 +401,9 @@ get_plugin_instance_error=獲取插件接口實現類錯誤!
user_role_relation_exist_error=用戶已在當前用戶組!
internal_user_role_permission_error=內置用戶組無法編輯與刪除!
user_role_relation_remove_admin_user_permission_error=無法將 admin 用戶將系統管理員用戶組刪除!
# customField
internal_custom_field_permission_error=系統字段或模板無法刪除!
internal_template_permission_error=系統模板無法刪除!
#result message
http_result_success=操作成功
@ -435,4 +438,9 @@ file_name_illegal_error=文件名不合法
plugin_enable_error=插件未啟用
plugin_permission_error=沒有該插件的訪問權限
scheduled_tasks=定時任務
scheduled_tasks=定時任務
template_scene_illegal_error=使用場景不合法
# 内置的模板或字段
custom_field.functional_priority=優先級
template.functional_default=默認模板

View File

@ -194,6 +194,10 @@ service_integration.organization_id.not_blank=organizationId cannot be empty
service_integration.organization_id.length_range=organizationId length must be between {min} and {max}
service_integration_exist_error=Service integration configuration already exists
service_integration.configuration.not_blank=Service integration configuration cannot be empty
# customField
permission.system_custom_field.name=Custom Field
custom_field.exist=Custom Field already exists
template.exist=Template already exists
# permission
permission.system_plugin.name=Plugin
permission.system_organization_project.name=Organization Project
@ -217,9 +221,8 @@ permission.system_organization_project_member.add=Add member
permission.system_organization_project_member.delete=Delete member
permission.system_operation_log.name=Operation log
permission.organization_operation_log.name=Operation log
permission.organization_custom_field.name=Custom Field
permission.organization_template.name=Template

View File

@ -192,7 +192,11 @@ service_integration.plugin_id.length_range=插件的ID长度必须在{min}和{ma
service_integration.organization_id.not_blank=组织ID不能为空
service_integration.organization_id.length_range=组织ID长度必须在{min}和{max}之间
service_integration_exist_error=服务集成配置已存在
# customField
service_integration.configuration.not_blank=服务集成配置不能為空
permission.system_custom_field.name=自定义字段
custom_field.exist=自定义字段已存在
template.exist=模板已存在
# permission
permission.system_plugin.name=插件
permission.system_organization_project.name=组织与项目
@ -216,8 +220,6 @@ permission.system_organization_project_member.add=添加成员
permission.system_organization_project_member.delete=删除成员
permission.system_operation_log.name=日志
permission.organization_operation_log.name=日志
permission.organization_custom_field.name=自定义字段
permission.organization_template.name=模板

View File

@ -185,14 +185,18 @@ plugin.type.exist=插件類型已存在
plugin.script.exist=腳本id重複
plugin.script.format=腳本格式錯誤
# serviceIntegration
service_integration.id.not_blank=ID不能
service_integration.id.length_range=ID长度必须在{min}和{max}之间
service_integration.plugin_id.not_blank=插件的ID不能
service_integration.plugin_id.length_range=插件的ID长度必须在{min}和{max}之间
service_integration.organization_id.not_blank=组织ID不能为
service_integration.organization_id.length_range=组织ID长度必须在{min}和{max}之间
service_integration.id.not_blank=ID不能
service_integration.id.length_range=ID長度必須在{min}和{max}之間
service_integration.plugin_id.not_blank=插件的ID不能
service_integration.plugin_id.length_range=插件的ID長度必須在{min}和{max}之間
service_integration.organization_id.not_blank=組織ID不能為
service_integration.organization_id.length_range=組織ID長度必須在{min}和{max}之間
service_integration_exist_error=服務集成配置已存在
service_integration.configuration.not_blank=服务集成配置不能為空
# customField
permission.system_custom_field.name=自定義字段
custom_field.exist=自定義字段已存在
template.exist=模板已存在
# permission
permission.system_plugin.name=插件
permission.system_organization_project.name=組織與項目
@ -216,4 +220,5 @@ permission.system_organization_project_member.add=添加成员
permission.system_organization_project_member.delete=删除成员
permission.system_operation_log.name=日志
permission.organization_operation_log.name=日志
permission.organization_custom_field.name=自定義字段
permission.organization_template.name=模板

View File

@ -23,6 +23,7 @@ import io.metersphere.validation.groups.Updated;
import jakarta.annotation.Resource;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHeaders;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@ -52,6 +53,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@SpringBootTest
@ -120,17 +122,15 @@ public abstract class BaseTest {
}
protected MockHttpServletRequestBuilder getPostRequestBuilder(String url, Object param, Object... uriVariables) {
return MockMvcRequestBuilders.post(getBasePath() + url, uriVariables)
.header(SessionConstants.HEADER_TOKEN, adminAuthInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, adminAuthInfo.getCsrfToken())
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post(getBasePath() + url, uriVariables);
return setRequestBuilderHeader(requestBuilder, adminAuthInfo)
.content(JSON.toJSONString(param))
.contentType(MediaType.APPLICATION_JSON);
}
protected MockHttpServletRequestBuilder getRequestBuilder(String url, Object... uriVariables) {
return MockMvcRequestBuilders.get(getBasePath() + url, uriVariables)
.header(SessionConstants.HEADER_TOKEN, adminAuthInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, adminAuthInfo.getCsrfToken());
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(getBasePath() + url, uriVariables);
return setRequestBuilderHeader(requestBuilder, adminAuthInfo);
}
protected ResultActions requestPost(String url, Object param, Object... uriVariables) throws Exception {
@ -192,15 +192,15 @@ public abstract class BaseTest {
MultiValueMap<String, Object> paramMap,
Object[] uriVariables) {
AuthInfo authInfo = getPermissionAuthInfo(roleId);
return getMultipartRequestBuilderWithParam(url, paramMap, uriVariables)
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken());
MockMultipartHttpServletRequestBuilder requestBuilder = getMultipartRequestBuilderWithParam(url, paramMap, uriVariables);
return setRequestBuilderHeader(requestBuilder, authInfo);
}
private MockHttpServletRequestBuilder getMultipartRequestBuilder(String url,
MultiValueMap<String, Object> paramMap,
Object[] uriVariables) {
return getMultipartRequestBuilderWithParam(url, paramMap, uriVariables)
MockMultipartHttpServletRequestBuilder requestBuilder = getMultipartRequestBuilderWithParam(url, paramMap, uriVariables);
return setRequestBuilderHeader(requestBuilder, adminAuthInfo)
.header(SessionConstants.HEADER_TOKEN, adminAuthInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, adminAuthInfo.getCsrfToken());
}
@ -467,17 +467,15 @@ public abstract class BaseTest {
*/
private void refreshUserPermission(String roleId) throws Exception {
AuthInfo authInfo = getPermissionAuthInfo(roleId);
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/is-login")
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken());
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/is-login");
requestBuilder = setRequestBuilderHeader(requestBuilder, authInfo);
mockMvc.perform(requestBuilder);
}
private void refreshUserPermissionByRoleId(String roleId) throws Exception {
AuthInfo authInfo = getPermissionAuthInfo(roleId);
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/is-login")
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken());
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/is-login");
requestBuilder = setRequestBuilderHeader(requestBuilder, authInfo);
mockMvc.perform(requestBuilder);
}
@ -523,13 +521,19 @@ public abstract class BaseTest {
private MockHttpServletRequestBuilder getPermissionPostRequestBuilder(String roleId, String url, Object param, Object... uriVariables) {
AuthInfo authInfo = getPermissionAuthInfo(roleId);
return MockMvcRequestBuilders.post(getBasePath() + url, uriVariables)
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken())
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post(getBasePath() + url, uriVariables);
return setRequestBuilderHeader(requestBuilder, authInfo)
.content(JSON.toJSONString(param))
.contentType(MediaType.APPLICATION_JSON);
}
private MockHttpServletRequestBuilder setRequestBuilderHeader(MockHttpServletRequestBuilder requestBuilder, AuthInfo authInfo) {
return requestBuilder
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken())
.header(HttpHeaders.ACCEPT_LANGUAGE, "zh-CN");
}
private AuthInfo getPermissionAuthInfo(String roleId) {
AuthInfo authInfo = permissionAuthInfoMap.get(roleId);
if (authInfo == null) {
@ -540,9 +544,8 @@ public abstract class BaseTest {
private MockHttpServletRequestBuilder getPermissionRequestBuilder(String roleId, String url, Object... uriVariables) {
AuthInfo authInfo = getPermissionAuthInfo(roleId);
return MockMvcRequestBuilders.get(getBasePath() + url, uriVariables)
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken());
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(getBasePath() + url, uriVariables);
return setRequestBuilderHeader(requestBuilder, authInfo);
}
public String getSessionId() {

View File

@ -70,8 +70,6 @@
</javaClientGenerator>
<!--要生成的数据库表 -->
<table tableName="custom_field"/>
<table tableName="custom_field_template"/>
<table tableName="custom_function"/>
<table tableName="fake_error"/>
<table tableName="file_metadata"/>
@ -84,11 +82,6 @@
<table tableName="fake_error_blob"/>
<table tableName="file_metadata_blob"/>
<table tableName="project_extend"/>
<table tableName="functional_case_template"/>
<table tableName="functional_case_template_extend"/>
<table tableName="bug_template_extend"/>
<table tableName="bug_template"/>
<table tableName="api_template"/>
<table tableName="message_task"/>
<table tableName="message_task_blob"/>
<table tableName="notification"/>

View File

@ -0,0 +1,82 @@
package io.metersphere.system.controller;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.dto.CustomFieldDTO;
import io.metersphere.sdk.dto.request.CustomFieldUpdateRequest;
import io.metersphere.sdk.log.annotation.Log;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.SessionUtils;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.service.OrganizationCustomFieldLogService;
import io.metersphere.system.service.OrganizationCustomFieldService;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author jianxing
*/
@Tag(name = "系统设置-组织-自定义字段")
@RestController
@RequestMapping("/organization/custom/field")
public class OrganizationCustomFieldController {
@Resource
private OrganizationCustomFieldService organizationCustomFieldService;
@GetMapping("/list/{organizationId}/{scene}")
@Operation(summary = "获取自定义字段列表")
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_READ)
public List<CustomField> list(@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
@PathVariable String organizationId,
@Schema(description = "模板的使用场景FUNCTIONAL,ISSUE,API,UI", requiredMode = Schema.RequiredMode.REQUIRED)
@PathVariable String scene) {
return organizationCustomFieldService.list(organizationId, scene);
}
@GetMapping("/get/{id}")
@Operation(summary = "获取自定义字段详情")
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_READ)
public CustomFieldDTO get(@PathVariable String id) {
return organizationCustomFieldService.getCustomFieldDTOWithCheck(id);
}
@PostMapping("/add")
@Operation(summary = "创建自定义字段")
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_ADD)
@Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#request)", msClass = OrganizationCustomFieldLogService.class)
public CustomField add(@Validated({Created.class}) @RequestBody CustomFieldUpdateRequest request) {
CustomField customField = new CustomField();
BeanUtils.copyBean(customField, request);
customField.setCreateUser(SessionUtils.getUserId());
return organizationCustomFieldService.add(customField, request.getOptions());
}
@PostMapping("/update")
@Operation(summary = "更新自定义字段")
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#request)", msClass = OrganizationCustomFieldLogService.class)
public CustomField update(@Validated({Updated.class}) @RequestBody CustomFieldUpdateRequest request) {
CustomField customField = new CustomField();
BeanUtils.copyBean(customField, request);
return organizationCustomFieldService.update(customField, request.getOptions());
}
@GetMapping("/delete/{id}")
@Operation(summary = "删除自定义字段")
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_DELETE)
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = OrganizationCustomFieldLogService.class)
public void delete(@PathVariable String id) {
organizationCustomFieldService.delete(id);
}
}

View File

@ -0,0 +1,82 @@
package io.metersphere.system.controller;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.dto.TemplateDTO;
import io.metersphere.sdk.dto.request.TemplateUpdateRequest;
import io.metersphere.sdk.log.annotation.Log;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.SessionUtils;
import io.metersphere.system.domain.Template;
import io.metersphere.system.service.OrganizationTemplateLogService;
import io.metersphere.system.service.OrganizationTemplateService;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author : jianxing
* @date : 2023-8-30
*/
@RestController
@RequestMapping("/organization/template")
@Tag(name = "系统设置-组织-模版")
public class OrganizationTemplateController {
@Resource
private OrganizationTemplateService organizationTemplateservice;
@GetMapping("/list/{organizationId}/{scene}")
@Operation(summary = "获取模版列表")
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_READ)
public List<Template> list(@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
@PathVariable String organizationId,
@Schema(description = "模板的使用场景FUNCTIONAL,ISSUE,API,UI", requiredMode = Schema.RequiredMode.REQUIRED)
@PathVariable String scene) {
return organizationTemplateservice.list(organizationId, scene);
}
@GetMapping("/get/{id}")
@Operation(summary = "获取模版详情")
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_READ)
public TemplateDTO get(@PathVariable String id) {
return organizationTemplateservice.geDTOWithCheck(id);
}
@PostMapping("/add")
@Operation(summary = "创建模版")
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_ADD)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.addLog(#request)", msClass = OrganizationTemplateLogService.class)
public Template add(@Validated({Created.class}) @RequestBody TemplateUpdateRequest request) {
Template template = new Template();
BeanUtils.copyBean(template, request);
template.setCreateUser(SessionUtils.getUserId());
return organizationTemplateservice.add(template, request.getCustomFields());
}
@PostMapping("/update")
@Operation(summary = "更新模版")
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_UPDATE)
@Log(type = OperationLogType.ADD, expression = "#msClass.updateLog(#request)", msClass = OrganizationTemplateLogService.class)
public Template update(@Validated({Updated.class}) @RequestBody TemplateUpdateRequest request) {
Template template = new Template();
BeanUtils.copyBean(template, request);
return organizationTemplateservice.update(template, request.getCustomFields());
}
@GetMapping("/delete/{id}")
@Operation(summary = "删除模版")
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_DELETE)
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = OrganizationTemplateLogService.class)
public void delete(@PathVariable String id) {
organizationTemplateservice.delete(id);
}
}

View File

@ -0,0 +1,65 @@
package io.metersphere.system.service;
import io.metersphere.sdk.constants.OperationLogConstants;
import io.metersphere.sdk.dto.LogDTO;
import io.metersphere.sdk.dto.request.CustomFieldUpdateRequest;
import io.metersphere.sdk.log.constants.OperationLogModule;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.util.JSON;
import io.metersphere.system.domain.CustomField;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author jianxing
* @date : 2023-8-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrganizationCustomFieldLogService {
@Resource
private OrganizationCustomFieldService organizationCustomFieldService;
public LogDTO addLog(CustomFieldUpdateRequest request) {
LogDTO dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
null,
null,
OperationLogType.ADD.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_CUSTOM_FIELD,
request.getName());
dto.setOriginalValue(JSON.toJSONBytes(request));
return dto;
}
public LogDTO updateLog(CustomFieldUpdateRequest request) {
CustomField customField = organizationCustomFieldService.getWithCheck(request.getId());
LogDTO dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
customField.getId(),
null,
OperationLogType.UPDATE.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_CUSTOM_FIELD,
customField.getName());
dto.setOriginalValue(JSON.toJSONBytes(customField));
return dto;
}
public LogDTO deleteLog(String id) {
CustomField customField = organizationCustomFieldService.getWithCheck(id);
LogDTO dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
customField.getId(),
null,
OperationLogType.DELETE.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_CUSTOM_FIELD,
customField.getName());
dto.setOriginalValue(JSON.toJSONBytes(customField));
return dto;
}
}

View File

@ -0,0 +1,64 @@
package io.metersphere.system.service;
import io.metersphere.sdk.constants.TemplateScopeType;
import io.metersphere.sdk.dto.CustomFieldDTO;
import io.metersphere.sdk.dto.request.CustomFieldOptionRequest;
import io.metersphere.sdk.service.BaseCustomFieldService;
import io.metersphere.system.domain.CustomField;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author jianxing
* @date : 2023-8-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrganizationCustomFieldService extends BaseCustomFieldService {
@Resource
private OrganizationService organizationService;
@Override
public List<CustomField> list(String orgId, String scene) {
organizationService.checkResourceExist(orgId);
return super.list(orgId, scene);
}
@Override
public CustomFieldDTO getCustomFieldDTOWithCheck(String id) {
CustomFieldDTO customField = super.getCustomFieldDTOWithCheck(id);
organizationService.checkResourceExist(customField.getScopeId());
return customField;
}
@Override
public CustomField add(CustomField customField, List<CustomFieldOptionRequest> options) {
// todo 校验是否开启组织模板
// todo 同步创建项目级别模板
organizationService.checkResourceExist(customField.getScopeId());
customField.setScopeType(TemplateScopeType.ORGANIZATION.name());
return super.add(customField, options);
}
@Override
public CustomField update(CustomField customField, List<CustomFieldOptionRequest> options) {
// todo 校验是否开启组织模板
// todo 同步修改项目级别模板
CustomField originCustomField = getWithCheck(customField.getId());
customField.setScopeId(originCustomField.getScopeId());
organizationService.checkResourceExist(originCustomField.getScopeId());
return super.update(customField, options);
}
@Override
public void delete(String id) {
CustomField customField = getWithCheck(id);
checkInternal(customField);
organizationService.checkResourceExist(customField.getScopeId());
super.delete(id);
}
}

View File

@ -14,6 +14,7 @@ import io.metersphere.sdk.service.BaseUserService;
import io.metersphere.sdk.uid.UUID;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.ServiceUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.*;
import io.metersphere.sdk.dto.UserExtend;
@ -894,4 +895,8 @@ public class OrganizationService {
}
return total;
}
public Organization checkResourceExist(String id) {
return ServiceUtils.checkResourceExist(organizationMapper.selectByPrimaryKey(id), "permission.system_organization_project.name");
}
}

View File

@ -0,0 +1,67 @@
package io.metersphere.system.service;
import io.metersphere.sdk.constants.OperationLogConstants;
import io.metersphere.sdk.dto.LogDTO;
import io.metersphere.sdk.dto.request.TemplateUpdateRequest;
import io.metersphere.sdk.log.constants.OperationLogModule;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.util.JSON;
import io.metersphere.system.domain.Template;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author jianxing
* @date : 2023-8-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrganizationTemplateLogService {
@Resource
private OrganizationTemplateService organizationTemplateService;
public LogDTO addLog(TemplateUpdateRequest request) {
LogDTO dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
null,
null,
OperationLogType.ADD.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_TEMPLATE,
request.getName());
dto.setOriginalValue(JSON.toJSONBytes(request));
return dto;
}
public LogDTO updateLog(TemplateUpdateRequest request) {
Template template = organizationTemplateService.getWithCheck(request.getId());
LogDTO dto = null;
if (template != null) {
dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
template.getId(),
null,
OperationLogType.UPDATE.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_TEMPLATE,
template.getName());
dto.setOriginalValue(JSON.toJSONBytes(template));
}
return dto;
}
public LogDTO deleteLog(String id) {
Template template = organizationTemplateService.getWithCheck(id);
LogDTO dto = new LogDTO(
OperationLogConstants.ORGANIZATION,
null,
template.getId(),
null,
OperationLogType.DELETE.name(),
OperationLogModule.SETTING_SYSTEM_ORGANIZATION_TEMPLATE,
template.getName());
dto.setOriginalValue(JSON.toJSONBytes(template));
return dto;
}
}

View File

@ -0,0 +1,65 @@
package io.metersphere.system.service;
import io.metersphere.sdk.constants.TemplateScopeType;
import io.metersphere.sdk.dto.TemplateDTO;
import io.metersphere.sdk.dto.request.TemplateCustomFieldRequest;
import io.metersphere.sdk.service.BaseTemplateService;
import io.metersphere.system.domain.Template;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author jianxing
* @date : 2023-8-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrganizationTemplateService extends BaseTemplateService {
@Resource
private OrganizationService organizationService;
@Override
public List<Template> list(String organizationId, String scene) {
organizationService.checkResourceExist(organizationId);
return super.list(organizationId, scene);
}
public TemplateDTO geDTOWithCheck(String id) {
Template template = super.getWithCheck(id);
checkOrgResourceExist(template);
return super.geDTOWithCheck(template);
}
@Override
public Template add(Template template, List<TemplateCustomFieldRequest> customFields) {
checkOrgResourceExist(template);
// todo 校验是否开启组织模板
// todo 同步创建项目级别模板
template.setScopeType(TemplateScopeType.ORGANIZATION.name());
return super.add(template, customFields);
}
public void checkOrgResourceExist(Template template) {
organizationService.checkResourceExist(template.getScopeId());
}
@Override
public Template update(Template template, List<TemplateCustomFieldRequest> customFields) {
Template originTemplate = super.getWithCheck(template.getId());
template.setScopeId(originTemplate.getScopeId());
checkOrgResourceExist(originTemplate);
return super.update(template, customFields);
}
@Override
public void delete(String id) {
this.getWithCheck(id);
Template template = getWithCheck(id);
checkInternal(template);
super.delete(id);
}
}

View File

@ -258,6 +258,42 @@
]
},
{
"id": "ORGANIZATION_CUSTOM_FIELD",
"name": "permission.organization_custom_field.name",
"permissions": [
{
"id": "ORGANIZATION_CUSTOM_FIELD:READ"
},
{
"id": "ORGANIZATION_CUSTOM_FIELD:READ+ADD"
},
{
"id": "ORGANIZATION_CUSTOM_FIELD:READ+UPDATE"
},
{
"id": "ORGANIZATION_CUSTOM_FIELD:READ+DELETE"
}
]
},
{
"id": "ORGANIZATION_TEMPLATE",
"name": "permission.organization_template.name",
"permissions": [
{
"id": "ORGANIZATION_TEMPLATE:READ"
},
{
"id": "ORGANIZATION_TEMPLATE:READ+ADD"
},
{
"id": "ORGANIZATION_TEMPLATE:READ+UPDATE"
},
{
"id": "ORGANIZATION_TEMPLATE:READ+DELETE"
}
]
},
{
"id": "ORGANIZATION_LOG",
"name": "permission.organization_operation_log.name",

View File

@ -70,29 +70,36 @@
<!--要生成的数据库表 -->
<table tableName="user_invite"/>
<!-- <table tableName="auth_source"/>-->
<!-- <table tableName="license"/>-->
<!-- <table tableName="message_task"/>-->
<!-- <table tableName="message_task_blob"/>-->
<!-- <table tableName="notification"/>-->
<!-- <table tableName="novice_statistics"/>-->
<!-- <table tableName="operating_log"/>-->
<!-- <table tableName="operating_log_resource"/>-->
<!-- <table tableName="plugin"/>-->
<!-- <table tableName="plugin_script"/>-->
<!-- <table tableName="plugin_organization"/>-->
<!-- <table tableName="schedule"/>-->
<!-- <table tableName="service_integration"/>-->
<!-- <table tableName="system_parameter"/>-->
<!-- <table tableName="test_resource"/>-->
<!-- <table tableName="test_resource_pool"/>-->
<!-- <table tableName="user"/>-->
<!-- <table tableName="user_extend"/>-->
<!-- <table tableName="user_key"/>-->
<!-- <table tableName="user_role"/>-->
<!-- <table tableName="user_role_permission"/>-->
<!-- <table tableName="user_role_relation"/>-->
<!-- <table tableName="organization"/>-->
<table tableName="auth_source"/>
<table tableName="license"/>
<table tableName="message_task"/>
<table tableName="message_task_blob"/>
<table tableName="notification"/>
<table tableName="novice_statistics"/>
<table tableName="operating_log"/>
<table tableName="operating_log_resource"/>
<table tableName="plugin"/>
<table tableName="plugin_script"/>
<table tableName="plugin_organization"/>
<table tableName="schedule"/>
<table tableName="service_integration"/>
<table tableName="system_parameter"/>
<table tableName="test_resource"/>
<table tableName="test_resource_pool"/>
<table tableName="user"/>
<table tableName="user_extend"/>
<table tableName="user_key"/>
<table tableName="user_role"/>
<table tableName="user_role_permission"/>
<table tableName="user_role_relation"/>
<table tableName="organization"/>
<table tableName="custom_field"/>
<table tableName="custom_field_option"/>
<table tableName="template"/>
<table tableName="template_custom_field"/>
<table tableName="status_item"/>
<table tableName="status_definition"/>
<!-- 要忽略的字段-->
<!-- <table tableName="test_case">

View File

@ -0,0 +1,257 @@
package io.metersphere.system.controller;
import io.metersphere.sdk.base.BaseTest;
import io.metersphere.sdk.constants.CustomFieldType;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.constants.TemplateScene;
import io.metersphere.sdk.constants.TemplateScopeType;
import io.metersphere.sdk.dto.CustomFieldDTO;
import io.metersphere.sdk.dto.request.CustomFieldOptionRequest;
import io.metersphere.sdk.dto.request.CustomFieldUpdateRequest;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.service.BaseCustomFieldOptionService;
import io.metersphere.sdk.service.BaseCustomFieldService;
import io.metersphere.sdk.service.BaseUserService;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.system.controller.param.CustomFieldUpdateRequestDefinition;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.CustomFieldExample;
import io.metersphere.system.domain.CustomFieldOption;
import io.metersphere.system.mapper.CustomFieldMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.junit.jupiter.api.*;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MvcResult;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static io.metersphere.sdk.constants.InternalUserRole.ADMIN;
import static io.metersphere.sdk.controller.handler.result.CommonResultCode.*;
import static io.metersphere.sdk.controller.handler.result.MsHttpResultCode.NOT_FOUND;
/**
* @author jianxing
* @date : 2023-8-29
*/
@SpringBootTest
@AutoConfigureMockMvc
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class OrganizationCustomFieldControllerTests extends BaseTest {
private static final String BASE_PATH = "/organization/custom/field/";
private static final String LIST = "list/{0}/{1}";
@Resource
private CustomFieldMapper customFieldMapper;
@Resource
private BaseCustomFieldOptionService baseCustomFieldOptionService;
@Resource
private BaseCustomFieldService baseCustomFieldService;
@Resource
private BaseUserService baseUserService;
private static CustomField addCustomField;
private static CustomField anotherAddCustomField;
@Override
protected String getBasePath() {
return BASE_PATH;
}
@Test
@Order(0)
public void listEmpty() throws Exception {
// @@校验没有数据的情况
this.requestGetWithOk(LIST, DEFAULT_ORGANIZATION_ID, TemplateScene.UI.name());
}
@Test
@Order(1)
public void add() throws Exception {
// @@请求成功
CustomFieldUpdateRequest request = new CustomFieldUpdateRequest();
request.setScene(TemplateScene.FUNCTIONAL.name());
request.setName("test");
request.setType(CustomFieldType.SELECT.name());
request.setRemark("AAA");
request.setScopeId(DEFAULT_ORGANIZATION_ID);
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("1111");
customFieldOptionRequest.setText("test");
List<CustomFieldOptionRequest> optionRequests = Arrays.asList(customFieldOptionRequest);
request.setOptions(optionRequests);
MvcResult mvcResult = this.requestPostWithOkAndReturn(DEFAULT_ADD, request);
CustomField resultData = getResultData(mvcResult, CustomField.class);
CustomField customField = customFieldMapper.selectByPrimaryKey(resultData.getId());
this.addCustomField = customField;
// 校验请求成功数据
request.setOptions(null);
request.setId(customField.getId());
Assertions.assertEquals(request, BeanUtils.copyBean(new CustomFieldUpdateRequest(), customField));
Assertions.assertEquals(customField.getCreateUser(), ADMIN.getValue());
Assertions.assertEquals(customField.getInternal(), false);
Assertions.assertEquals(customField.getScopeType(), TemplateScopeType.ORGANIZATION.name());
List<CustomFieldOption> options = baseCustomFieldOptionService.getByFieldId(customField.getId());
for (int i = 0; i < options.size(); i++) {
CustomFieldOptionRequest optionRequestItem = optionRequests.get(i);
CustomFieldOption optionItem = options.get(i);
Assertions.assertEquals(optionRequestItem.getText(), optionItem.getText());
Assertions.assertEquals(optionRequestItem.getValue(), optionItem.getValue());
Assertions.assertEquals(false, optionItem.getInternal());
Assertions.assertEquals(customField.getId(), optionItem.getFieldId());
}
// @@重名校验异常
assertErrorCode(this.requestPost(DEFAULT_ADD, request), CUSTOM_FIELD_EXIST);
// @@校验组织是否存在
request.setScopeId("1111");
request.setName("test1");
assertErrorCode(this.requestPost(DEFAULT_ADD, request), NOT_FOUND);
// 插入另一条数据用户更新时重名校验
request.setScopeId(DEFAULT_ORGANIZATION_ID);
MvcResult anotherMvcResult = this.requestPostWithOkAndReturn(DEFAULT_ADD, request);
this.anotherAddCustomField = customFieldMapper.selectByPrimaryKey(getResultData(anotherMvcResult, CustomField.class).getId());
// @@校验日志
checkLog(this.addCustomField.getId(), OperationLogType.ADD);
// @@异常参数校验
createdGroupParamValidateTest(CustomFieldUpdateRequestDefinition.class, DEFAULT_ADD);
// @@校验权限
requestPostPermissionTest(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_ADD, DEFAULT_ADD, request);
}
@Test
@Order(2)
public void update() throws Exception {
// @@请求成功
CustomFieldUpdateRequest request = new CustomFieldUpdateRequest();
request.setId(addCustomField.getId());
request.setScene(TemplateScene.FUNCTIONAL.name());
request.setName("test2");
request.setType(CustomFieldType.SELECT.name());
request.setRemark("AAA1");
request.setScopeId("1111");
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("11112");
customFieldOptionRequest.setText("test1");
List<CustomFieldOptionRequest> optionRequests = Arrays.asList(customFieldOptionRequest);
request.setOptions(optionRequests);
this.requestPostWithOk(DEFAULT_UPDATE, request);
CustomField customField = customFieldMapper.selectByPrimaryKey(request.getId());
// 校验请求成功数据
request.setOptions(null);
request.setId(customField.getId());
request.setScopeId(DEFAULT_ORGANIZATION_ID);
Assertions.assertEquals(request, BeanUtils.copyBean(new CustomFieldUpdateRequest(), customField));
Assertions.assertEquals(customField.getCreateUser(), ADMIN.getValue());
Assertions.assertEquals(customField.getInternal(), false);
Assertions.assertEquals(customField.getScopeType(), TemplateScopeType.ORGANIZATION.name());
List<CustomFieldOption> options = baseCustomFieldOptionService.getByFieldId(customField.getId());
for (int i = 0; i < options.size(); i++) {
CustomFieldOptionRequest optionRequestItem = optionRequests.get(i);
CustomFieldOption optionItem = options.get(i);
Assertions.assertEquals(optionRequestItem.getText(), optionItem.getText());
Assertions.assertEquals(optionRequestItem.getValue(), optionItem.getValue());
Assertions.assertEquals(false, optionItem.getInternal());
Assertions.assertEquals(customField.getId(), optionItem.getFieldId());
}
// @@重名校验异常
request.setName(anotherAddCustomField.getName());
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), CUSTOM_FIELD_EXIST);
// @校验 NOT_FOUND 异常
request.setId("1111");
request.setName("1111");
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), NOT_FOUND);
// @@校验日志
checkLog(addCustomField.getId(), OperationLogType.UPDATE);
// @@异常参数校验
updatedGroupParamValidateTest(CustomFieldUpdateRequestDefinition.class, DEFAULT_UPDATE);
// @@校验权限
requestPostPermissionTest(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_UPDATE, DEFAULT_UPDATE, request);
}
@Test
@Order(3)
public void list() throws Exception {
String scene = TemplateScene.FUNCTIONAL.name();
// @@请求成功
MvcResult mvcResult = this.requestGetWithOk(LIST, DEFAULT_ORGANIZATION_ID, scene)
.andReturn();
// 校验数据是否正确
List<CustomField> resultList = getResultDataArray(mvcResult, CustomField.class);
List<CustomField> customFields = baseCustomFieldService.getByScopeIdAndScene(DEFAULT_ORGANIZATION_ID, scene);
List<String> userIds = customFields.stream().map(CustomField::getCreateUser).toList();
Map<String, String> userNameMap = baseUserService.getUserNameMap(userIds);
for (int i = 0; i < resultList.size(); i++) {
CustomField resultItem = resultList.get(i);
CustomField customField = customFields.get(i);
customField.setCreateUser(userNameMap.get(customField.getCreateUser()));
if (customField.getInternal()) {
// 校验内置用户名称是否翻译
customField.setName(baseCustomFieldService.translateInternalField(customField.getName()));
}
Assertions.assertEquals(customField, resultItem);
Assertions.assertEquals(resultItem.getScene(), scene);
}
// @@校验组织是否存在
assertErrorCode(this.requestGet(LIST, "1111", scene), NOT_FOUND);
// @@校验使用场景不合法
assertErrorCode(this.requestGet(LIST, DEFAULT_ORGANIZATION_ID, "111"), TEMPLATE_SCENE_ILLEGAL);
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_READ, LIST, DEFAULT_ORGANIZATION_ID, scene);
}
@Test
@Order(4)
public void get() throws Exception {
// @@请求成功
MvcResult mvcResult = this.requestGetWithOk(DEFAULT_GET, addCustomField.getId())
.andReturn();
// 校验数据是否正确
CustomFieldDTO customFieldDTO = getResultData(mvcResult, CustomFieldDTO.class);
List<CustomFieldOption> options = customFieldDTO.getOptions();
CustomField customField = customFieldMapper.selectByPrimaryKey(customFieldDTO.getId());
Assertions.assertEquals(customField, BeanUtils.copyBean(new CustomField(), customFieldDTO));
Assertions.assertEquals(options, baseCustomFieldOptionService.getByFieldId(customField.getId()));
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_READ, DEFAULT_GET, customFieldDTO.getId());
}
@Test
@Order(5)
public void delete() throws Exception {
// @@请求成功
this.requestGetWithOk(DEFAULT_DELETE, addCustomField.getId());
Assertions.assertNull(customFieldMapper.selectByPrimaryKey(addCustomField.getId()));
Assertions.assertTrue(CollectionUtils.isEmpty(baseCustomFieldOptionService.getByFieldId(addCustomField.getId())));
// @@校验内置字段删除异常
CustomFieldExample example = new CustomFieldExample();
example.createCriteria()
.andInternalEqualTo(true);
CustomField internalCustomField = customFieldMapper.selectByExample(example).get(0);
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION);
// @@校验 NOT_FOUND 异常
assertErrorCode(this.requestGet(DEFAULT_DELETE, "1111"), NOT_FOUND);
// @@校验日志
checkLog(addCustomField.getId(), OperationLogType.DELETE);
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_DELETE, DEFAULT_DELETE, addCustomField.getId());
}
}

View File

@ -0,0 +1,292 @@
package io.metersphere.system.controller;
import io.metersphere.sdk.base.BaseTest;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.constants.TemplateScene;
import io.metersphere.sdk.constants.TemplateScopeType;
import io.metersphere.sdk.dto.TemplateCustomFieldDTO;
import io.metersphere.sdk.dto.TemplateDTO;
import io.metersphere.sdk.dto.request.TemplateCustomFieldRequest;
import io.metersphere.sdk.dto.request.TemplateUpdateRequest;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.service.BaseCustomFieldService;
import io.metersphere.sdk.service.BaseTemplateCustomFieldService;
import io.metersphere.sdk.service.BaseTemplateService;
import io.metersphere.sdk.service.BaseUserService;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.system.controller.param.TemplateUpdateRequestDefinition;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.Template;
import io.metersphere.system.domain.TemplateCustomField;
import io.metersphere.system.domain.TemplateExample;
import io.metersphere.system.mapper.TemplateMapper;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.junit.jupiter.api.*;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MvcResult;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static io.metersphere.sdk.constants.InternalUserRole.ADMIN;
import static io.metersphere.sdk.controller.handler.result.CommonResultCode.*;
import static io.metersphere.sdk.controller.handler.result.MsHttpResultCode.NOT_FOUND;
/**
* @author jianxing
* @date : 2023-8-30
*/
@SpringBootTest
@AutoConfigureMockMvc
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class OrganizationTemplateControllerTests extends BaseTest {
private static final String BASE_PATH = "/organization/template/";
private static final String LIST = "list/{0}/{1}";
@Resource
private TemplateMapper templateMapper;
@Resource
private BaseTemplateService baseTemplateService;
@Resource
private BaseUserService baseUserService;
@Resource
private BaseCustomFieldService baseCustomFieldService;
@Resource
private BaseTemplateCustomFieldService baseTemplateCustomFieldService;
private static Template addTemplate;
private static Template anotherTemplateField;
@Override
protected String getBasePath() {
return BASE_PATH;
}
@Test
@Order(0)
public void listEmpty() throws Exception {
// @@校验没有数据的情况
this.requestGetWithOk(LIST, DEFAULT_ORGANIZATION_ID, TemplateScene.UI.name());
}
@Test
@Order(1)
public void add() throws Exception {
String scene = TemplateScene.FUNCTIONAL.name();
// @@请求成功
TemplateUpdateRequest request = new TemplateUpdateRequest();
TemplateCustomFieldRequest templateCustomFieldRequest = getTemplateCustomFieldRequest(scene);
request.setScene(scene);
request.setName("test");
request.setRemark("AAA");
request.setEnableThirdPart(true);
request.setScopeId(DEFAULT_ORGANIZATION_ID);
request.setCustomFields(List.of(templateCustomFieldRequest));
MvcResult mvcResult = this.requestPostWithOkAndReturn(DEFAULT_ADD, request);
Template resultData = getResultData(mvcResult, Template.class);
Template template = templateMapper.selectByPrimaryKey(resultData.getId());
this.addTemplate = template;
// 校验请求成功数据
request.setId(template.getId());
TemplateUpdateRequest copyRequest = BeanUtils.copyBean(new TemplateUpdateRequest(), request);
copyRequest.setCustomFields(null);
Assertions.assertEquals(copyRequest, BeanUtils.copyBean(new TemplateUpdateRequest(), template));
Assertions.assertEquals(template.getCreateUser(), ADMIN.getValue());
Assertions.assertEquals(template.getInternal(), false);
Assertions.assertEquals(template.getScopeType(), TemplateScopeType.ORGANIZATION.name());
asserTemplateCustomFields(request, template);
// @@重名校验异常
assertErrorCode(this.requestPost(DEFAULT_ADD, request), TEMPLATE_EXIST);
// @@校验组织是否存在
request.setScopeId("1111");
request.setName("test1");
assertErrorCode(this.requestPost(DEFAULT_ADD, request), NOT_FOUND);
// 插入另一条数据用户更新时重名校验
request.setScopeId(DEFAULT_ORGANIZATION_ID);
MvcResult anotherMvcResult = this.requestPostWithOkAndReturn(DEFAULT_ADD, request);
this.anotherTemplateField = templateMapper.selectByPrimaryKey(getResultData(anotherMvcResult, Template.class).getId());
// @@校验日志
checkLog(this.addTemplate.getId(), OperationLogType.ADD);
// @@异常参数校验
createdGroupParamValidateTest(TemplateUpdateRequestDefinition.class, DEFAULT_ADD);
// @@校验权限
requestPostPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_ADD, DEFAULT_ADD, request);
}
private void asserTemplateCustomFields(TemplateUpdateRequest request, Template template) {
List<TemplateCustomField> templateCustomFields = baseTemplateCustomFieldService.getByTemplateId(template.getId());
Assertions.assertEquals(templateCustomFields.size(), request.getCustomFields().size());
for (int i = 0; i < templateCustomFields.size(); i++) {
TemplateCustomField templateCustomField = templateCustomFields.get(i);
TemplateCustomFieldRequest customFieldRequest = request.getCustomFields().get(i);
Assertions.assertEquals(templateCustomField.getFieldId(), customFieldRequest.getFieldId());
Assertions.assertEquals(templateCustomField.getTemplateId(), template.getId());
Assertions.assertEquals(templateCustomField.getRequired(), customFieldRequest.getRequired());
Assertions.assertEquals(templateCustomField.getApiFieldId(), customFieldRequest.getApiFieldId());
Assertions.assertEquals(templateCustomField.getDefaultValue(), customFieldRequest.getDefaultValue());
}
}
private TemplateCustomFieldRequest getTemplateCustomFieldRequest(String scene) {
List<CustomField> customFields = baseCustomFieldService.getByScopeIdAndScene(DEFAULT_ORGANIZATION_ID, scene);
CustomField customField = customFields.stream()
.filter(item -> item.getName().equals("functional_priority"))
.findFirst()
.get();
TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest();
BeanUtils.copyBean(templateCustomFieldRequest, customField);
templateCustomFieldRequest.setFieldId(customField.getId());
templateCustomFieldRequest.setRequired(true);
templateCustomFieldRequest.setApiFieldId("aaa");
templateCustomFieldRequest.setDefaultValue("P0");
return templateCustomFieldRequest;
}
@Test
@Order(2)
public void update() throws Exception {
// @@请求成功
String scene = TemplateScene.FUNCTIONAL.name();
TemplateUpdateRequest request = new TemplateUpdateRequest();
request.setId(addTemplate.getId());
request.setScene(scene);
request.setName("test2");
request.setRemark("AAA1");
request.setScopeId("1111");
request.setScene(TemplateScene.UI.name());
request.setEnableThirdPart(true);
request.setCustomFields(new ArrayList<>(0));
this.requestPostWithOk(DEFAULT_UPDATE, request);
Template template = templateMapper.selectByPrimaryKey(request.getId());
// 校验请求成功数据
Assertions.assertEquals(template.getName(), request.getName());
Assertions.assertEquals(template.getRemark(), request.getRemark());
Assertions.assertEquals(template.getScopeId(), DEFAULT_ORGANIZATION_ID);
Assertions.assertEquals(template.getCreateUser(), ADMIN.getValue());
Assertions.assertEquals(template.getInternal(), false);
Assertions.assertEquals(template.getScopeType(), TemplateScopeType.ORGANIZATION.name());
Assertions.assertEquals(template.getScene(), scene);
Assertions.assertEquals(template.getEnableThirdPart(), request.getEnableThirdPart());
asserTemplateCustomFields(request, template);
// 带字段的更新
TemplateCustomFieldRequest templateCustomFieldRequest = getTemplateCustomFieldRequest(scene);
request.setCustomFields(List.of(templateCustomFieldRequest));
this.requestPostWithOk(DEFAULT_UPDATE, request);
asserTemplateCustomFields(request, template);
// 不更新字段
request.setCustomFields(null);
this.requestPostWithOk(DEFAULT_UPDATE, request);
Assertions.assertEquals(baseTemplateCustomFieldService.getByTemplateId(template.getId()).size(), 1);
// @@重名校验异常
request.setName(anotherTemplateField.getName());
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), TEMPLATE_EXIST);
// @校验 NOT_FOUND 异常
request.setId("1111");
request.setName("1111");
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), NOT_FOUND);
// @@校验日志
checkLog(addTemplate.getId(), OperationLogType.UPDATE);
// @@异常参数校验
updatedGroupParamValidateTest(TemplateUpdateRequestDefinition.class, DEFAULT_UPDATE);
// @@校验权限
requestPostPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_UPDATE, DEFAULT_UPDATE, request);
}
@Test
@Order(3)
public void list() throws Exception {
String scene = TemplateScene.FUNCTIONAL.name();
// @@请求成功
MvcResult mvcResult = this.requestGetWithOk(LIST, DEFAULT_ORGANIZATION_ID, scene)
.andReturn();
// 校验数据是否正确
List<Template> resultList = getResultDataArray(mvcResult, Template.class);
List<Template> Templates = baseTemplateService.getTemplates(DEFAULT_ORGANIZATION_ID, scene);
List<String> userIds = Templates.stream().map(Template::getCreateUser).toList();
Map<String, String> userNameMap = baseUserService.getUserNameMap(userIds);
for (int i = 0; i < resultList.size(); i++) {
Template resultItem = resultList.get(i);
Template template = Templates.get(i);
template.setCreateUser(userNameMap.get(template.getCreateUser()));
if (template.getInternal()) {
// 校验内置用户名称是否翻译
template.setName(baseTemplateService.translateInternalTemplate(template.getName()));
}
Assertions.assertEquals(template, resultItem);
Assertions.assertEquals(resultItem.getScene(), scene);
}
// @@校验组织是否存在
assertErrorCode(this.requestGet(LIST, "1111", scene), NOT_FOUND);
// @@校验使用场景不合法
assertErrorCode(this.requestGet(LIST, DEFAULT_ORGANIZATION_ID, "111"), TEMPLATE_SCENE_ILLEGAL);
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_READ, LIST, DEFAULT_ORGANIZATION_ID, scene);
}
@Test
@Order(4)
public void get() throws Exception {
// @@请求成功
MvcResult mvcResult = this.requestGetWithOk(DEFAULT_GET, addTemplate.getId())
.andReturn();
// 校验数据是否正确
TemplateDTO templateDTO = getResultData(mvcResult, TemplateDTO.class);
Template template = templateMapper.selectByPrimaryKey(templateDTO.getId());
Assertions.assertEquals(template, BeanUtils.copyBean(new Template(), templateDTO));
List<TemplateCustomFieldDTO> customFields = templateDTO.getCustomFields();
List<TemplateCustomField> templateCustomFields = baseTemplateCustomFieldService.getByTemplateId(template.getId());
for (int i = 0; i < customFields.size(); i++) {
TemplateCustomFieldDTO customFieldDTO = customFields.get(i);
TemplateCustomField templateCustomField = templateCustomFields.get(i);
Assertions.assertEquals(customFieldDTO.getFieldId(), templateCustomField.getFieldId());
Assertions.assertEquals(customFieldDTO.getApiFieldId(), templateCustomField.getApiFieldId());
Assertions.assertEquals(customFieldDTO.getRequired(), templateCustomField.getRequired());
Assertions.assertEquals(templateCustomField.getTemplateId(), template.getId());
Assertions.assertEquals(customFieldDTO.getFieldName(), "优先级");
}
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_READ, DEFAULT_GET, templateDTO.getId());
}
@Test
@Order(5)
public void delete() throws Exception {
// @@请求成功
this.requestGetWithOk(DEFAULT_DELETE, addTemplate.getId());
Assertions.assertNull(templateMapper.selectByPrimaryKey(addTemplate.getId()));
Assertions.assertTrue(CollectionUtils.isEmpty(baseTemplateCustomFieldService.getByTemplateId(addTemplate.getId())));
// @@校验内置模板删除异常
TemplateExample example = new TemplateExample();
example.createCriteria()
.andInternalEqualTo(true);
Template internalTemplate = templateMapper.selectByExample(example).get(0);
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalTemplate.getId()), INTERNAL_TEMPLATE_PERMISSION);
// @@校验 NOT_FOUND 异常
assertErrorCode(this.requestGet(DEFAULT_DELETE, "1111"), NOT_FOUND);
// @@校验日志
checkLog(addTemplate.getId(), OperationLogType.DELETE);
// @@校验权限
requestGetPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_DELETE, DEFAULT_DELETE, addTemplate.getId());
}
}

View File

@ -0,0 +1,33 @@
package io.metersphere.system.controller.param;
import io.metersphere.sdk.constants.CustomFieldType;
import io.metersphere.sdk.valid.EnumValue;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class CustomFieldUpdateRequestDefinition {
@NotBlank(groups = {Updated.class})
@Size(min = 1, max = 50, groups = {Created.class, Updated.class})
private String id;
@NotBlank(groups = {Created.class})
@Size(min = 1, max = 255, groups = {Created.class, Updated.class})
private String name;
@NotBlank(groups = {Created.class})
@Size(min = 1, max = 30, groups = {Created.class, Updated.class})
private String scene;
@NotBlank(groups = {Created.class})
@EnumValue(enumClass = CustomFieldType.class, groups = {Created.class, Updated.class})
@Size(min = 1, max = 30, groups = {Created.class, Updated.class})
private String type;
@NotBlank(groups = {Created.class})
@Size(min = 1, max = 50, groups = {Created.class})
private String scopeId;
}

View File

@ -0,0 +1,52 @@
package io.metersphere.system.controller.param;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class TemplateUpdateRequestDefinition {
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{template.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{template.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "备注")
private String remark;
@Schema(title = "是否是内置模板")
private Boolean internal;
@Schema(title = "创建时间")
private Long updateTime;
@Schema(title = "创建时间")
private Long createTime;
@Schema(title = "创建人")
private String createUser;
@Schema(title = "组织或项目级别字段PROJECT, ORGANIZATION")
private String scopeType;
@Schema(title = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scope_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{template.scope_id.length_range}", groups = {Created.class, Updated.class})
private String scopeId;
@Schema(title = "是否开启api字段名配置")
private Boolean enableThirdPart;
@Schema(title = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{template.scene.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{template.scene.length_range}", groups = {Created.class, Updated.class})
private String scene;
}

View File

@ -15,7 +15,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.nio.charset.StandardCharsets;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ -80,7 +79,6 @@ public class UserRequestUtils {
.header(SessionConstants.CSRF_TOKEN, csrfToken)
.content(JSON.toJSONString(param))
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(resultMatcher)
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}