mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 03:58:33 +08:00
feat(系统设置): 系统设置插件管理接口设计
--task=1012390 --user=陈建星 系统设置-系统-插件管理-后台 https://www.tapd.cn/55049933/s/1393426
This commit is contained in:
parent
197c020a59
commit
0e88e52214
@ -13,55 +13,43 @@ public class Plugin implements Serializable {
|
||||
@Size(min = 1, max = 50, message = "{plugin.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(title = "plugin name")
|
||||
@Schema(title = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 255, message = "{plugin.name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String name;
|
||||
|
||||
@Schema(title = "Plugin id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "插件ID(名称加版本号)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.plugin_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.plugin_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String pluginId;
|
||||
|
||||
@Schema(title = "Ui script id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.script_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.script_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String scriptId;
|
||||
@Schema(title = "文件名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.file_name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.file_name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String fileName;
|
||||
|
||||
@Schema(title = "Plugin clazzName", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.clazz_name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 500, message = "{plugin.clazz_name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String clazzName;
|
||||
|
||||
@Schema(title = "Jmeter base clazzName", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.jmeter_clazz.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.jmeter_clazz.length_range}", groups = {Created.class, Updated.class})
|
||||
private String jmeterClazz;
|
||||
|
||||
@Schema(title = "Plugin jar path", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.source_path.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.source_path.length_range}", groups = {Created.class, Updated.class})
|
||||
private String sourcePath;
|
||||
|
||||
@Schema(title = "Plugin jar name", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.source_name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.source_name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String sourceName;
|
||||
|
||||
@Schema(title = "plugin init entry class")
|
||||
private String execEntry;
|
||||
|
||||
@Schema(title = "")
|
||||
@Schema(title = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@Schema(title = "")
|
||||
@Schema(title = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@Schema(title = "")
|
||||
@Schema(title = "创建人")
|
||||
private String createUser;
|
||||
|
||||
@Schema(title = "Is xpack plugin")
|
||||
@Schema(title = "是否启用插件")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(title = "是否是全局插件")
|
||||
private Boolean global;
|
||||
|
||||
@Schema(title = "是否是企业版插件")
|
||||
private Boolean xpack;
|
||||
|
||||
@Schema(title = "Plugin usage scenarios", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "插件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(title = "插件使用场景PAI/PLATFORM", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.scenario.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
||||
private String scenario;
|
||||
|
@ -1,23 +0,0 @@
|
||||
package io.metersphere.system.domain;
|
||||
|
||||
import io.metersphere.validation.groups.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PluginBlob implements Serializable {
|
||||
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin_blob.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin_blob.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(title = "plugin form option")
|
||||
private byte[] formOption;
|
||||
|
||||
@Schema(title = "plugin form script")
|
||||
private byte[] formScript;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -314,423 +314,73 @@ public class PluginExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNull() {
|
||||
addCriterion("script_id is null");
|
||||
public Criteria andFileNameIsNull() {
|
||||
addCriterion("file_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNotNull() {
|
||||
addCriterion("script_id is not null");
|
||||
public Criteria andFileNameIsNotNull() {
|
||||
addCriterion("file_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdEqualTo(String value) {
|
||||
addCriterion("script_id =", value, "scriptId");
|
||||
public Criteria andFileNameEqualTo(String value) {
|
||||
addCriterion("file_name =", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotEqualTo(String value) {
|
||||
addCriterion("script_id <>", value, "scriptId");
|
||||
public Criteria andFileNameNotEqualTo(String value) {
|
||||
addCriterion("file_name <>", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThan(String value) {
|
||||
addCriterion("script_id >", value, "scriptId");
|
||||
public Criteria andFileNameGreaterThan(String value) {
|
||||
addCriterion("file_name >", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("script_id >=", value, "scriptId");
|
||||
public Criteria andFileNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("file_name >=", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThan(String value) {
|
||||
addCriterion("script_id <", value, "scriptId");
|
||||
public Criteria andFileNameLessThan(String value) {
|
||||
addCriterion("file_name <", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("script_id <=", value, "scriptId");
|
||||
public Criteria andFileNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("file_name <=", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLike(String value) {
|
||||
addCriterion("script_id like", value, "scriptId");
|
||||
public Criteria andFileNameLike(String value) {
|
||||
addCriterion("file_name like", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotLike(String value) {
|
||||
addCriterion("script_id not like", value, "scriptId");
|
||||
public Criteria andFileNameNotLike(String value) {
|
||||
addCriterion("file_name not like", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIn(List<String> values) {
|
||||
addCriterion("script_id in", values, "scriptId");
|
||||
public Criteria andFileNameIn(List<String> values) {
|
||||
addCriterion("file_name in", values, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotIn(List<String> values) {
|
||||
addCriterion("script_id not in", values, "scriptId");
|
||||
public Criteria andFileNameNotIn(List<String> values) {
|
||||
addCriterion("file_name not in", values, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdBetween(String value1, String value2) {
|
||||
addCriterion("script_id between", value1, value2, "scriptId");
|
||||
public Criteria andFileNameBetween(String value1, String value2) {
|
||||
addCriterion("file_name between", value1, value2, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotBetween(String value1, String value2) {
|
||||
addCriterion("script_id not between", value1, value2, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameIsNull() {
|
||||
addCriterion("clazz_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameIsNotNull() {
|
||||
addCriterion("clazz_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameEqualTo(String value) {
|
||||
addCriterion("clazz_name =", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameNotEqualTo(String value) {
|
||||
addCriterion("clazz_name <>", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameGreaterThan(String value) {
|
||||
addCriterion("clazz_name >", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("clazz_name >=", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameLessThan(String value) {
|
||||
addCriterion("clazz_name <", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("clazz_name <=", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameLike(String value) {
|
||||
addCriterion("clazz_name like", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameNotLike(String value) {
|
||||
addCriterion("clazz_name not like", value, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameIn(List<String> values) {
|
||||
addCriterion("clazz_name in", values, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameNotIn(List<String> values) {
|
||||
addCriterion("clazz_name not in", values, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameBetween(String value1, String value2) {
|
||||
addCriterion("clazz_name between", value1, value2, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameNotBetween(String value1, String value2) {
|
||||
addCriterion("clazz_name not between", value1, value2, "clazzName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzIsNull() {
|
||||
addCriterion("jmeter_clazz is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzIsNotNull() {
|
||||
addCriterion("jmeter_clazz is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzEqualTo(String value) {
|
||||
addCriterion("jmeter_clazz =", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzNotEqualTo(String value) {
|
||||
addCriterion("jmeter_clazz <>", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzGreaterThan(String value) {
|
||||
addCriterion("jmeter_clazz >", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("jmeter_clazz >=", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzLessThan(String value) {
|
||||
addCriterion("jmeter_clazz <", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzLessThanOrEqualTo(String value) {
|
||||
addCriterion("jmeter_clazz <=", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzLike(String value) {
|
||||
addCriterion("jmeter_clazz like", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzNotLike(String value) {
|
||||
addCriterion("jmeter_clazz not like", value, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzIn(List<String> values) {
|
||||
addCriterion("jmeter_clazz in", values, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzNotIn(List<String> values) {
|
||||
addCriterion("jmeter_clazz not in", values, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzBetween(String value1, String value2) {
|
||||
addCriterion("jmeter_clazz between", value1, value2, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andJmeterClazzNotBetween(String value1, String value2) {
|
||||
addCriterion("jmeter_clazz not between", value1, value2, "jmeterClazz");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathIsNull() {
|
||||
addCriterion("source_path is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathIsNotNull() {
|
||||
addCriterion("source_path is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathEqualTo(String value) {
|
||||
addCriterion("source_path =", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathNotEqualTo(String value) {
|
||||
addCriterion("source_path <>", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathGreaterThan(String value) {
|
||||
addCriterion("source_path >", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("source_path >=", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathLessThan(String value) {
|
||||
addCriterion("source_path <", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathLessThanOrEqualTo(String value) {
|
||||
addCriterion("source_path <=", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathLike(String value) {
|
||||
addCriterion("source_path like", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathNotLike(String value) {
|
||||
addCriterion("source_path not like", value, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathIn(List<String> values) {
|
||||
addCriterion("source_path in", values, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathNotIn(List<String> values) {
|
||||
addCriterion("source_path not in", values, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathBetween(String value1, String value2) {
|
||||
addCriterion("source_path between", value1, value2, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourcePathNotBetween(String value1, String value2) {
|
||||
addCriterion("source_path not between", value1, value2, "sourcePath");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameIsNull() {
|
||||
addCriterion("source_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameIsNotNull() {
|
||||
addCriterion("source_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameEqualTo(String value) {
|
||||
addCriterion("source_name =", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameNotEqualTo(String value) {
|
||||
addCriterion("source_name <>", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameGreaterThan(String value) {
|
||||
addCriterion("source_name >", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("source_name >=", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameLessThan(String value) {
|
||||
addCriterion("source_name <", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("source_name <=", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameLike(String value) {
|
||||
addCriterion("source_name like", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameNotLike(String value) {
|
||||
addCriterion("source_name not like", value, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameIn(List<String> values) {
|
||||
addCriterion("source_name in", values, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameNotIn(List<String> values) {
|
||||
addCriterion("source_name not in", values, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameBetween(String value1, String value2) {
|
||||
addCriterion("source_name between", value1, value2, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceNameNotBetween(String value1, String value2) {
|
||||
addCriterion("source_name not between", value1, value2, "sourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryIsNull() {
|
||||
addCriterion("exec_entry is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryIsNotNull() {
|
||||
addCriterion("exec_entry is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryEqualTo(String value) {
|
||||
addCriterion("exec_entry =", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryNotEqualTo(String value) {
|
||||
addCriterion("exec_entry <>", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryGreaterThan(String value) {
|
||||
addCriterion("exec_entry >", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("exec_entry >=", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryLessThan(String value) {
|
||||
addCriterion("exec_entry <", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryLessThanOrEqualTo(String value) {
|
||||
addCriterion("exec_entry <=", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryLike(String value) {
|
||||
addCriterion("exec_entry like", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryNotLike(String value) {
|
||||
addCriterion("exec_entry not like", value, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryIn(List<String> values) {
|
||||
addCriterion("exec_entry in", values, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryNotIn(List<String> values) {
|
||||
addCriterion("exec_entry not in", values, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryBetween(String value1, String value2) {
|
||||
addCriterion("exec_entry between", value1, value2, "execEntry");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecEntryNotBetween(String value1, String value2) {
|
||||
addCriterion("exec_entry not between", value1, value2, "execEntry");
|
||||
public Criteria andFileNameNotBetween(String value1, String value2) {
|
||||
addCriterion("file_name not between", value1, value2, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
@ -924,6 +574,126 @@ public class PluginExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNull() {
|
||||
addCriterion("`enable` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNotNull() {
|
||||
addCriterion("`enable` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableEqualTo(Boolean value) {
|
||||
addCriterion("`enable` =", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <>", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThan(Boolean value) {
|
||||
addCriterion("`enable` >", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` >=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThan(Boolean value) {
|
||||
addCriterion("`enable` <", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIn(List<Boolean> values) {
|
||||
addCriterion("`enable` in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotIn(List<Boolean> values) {
|
||||
addCriterion("`enable` not in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` not between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalIsNull() {
|
||||
addCriterion("`global` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalIsNotNull() {
|
||||
addCriterion("`global` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalEqualTo(Boolean value) {
|
||||
addCriterion("`global` =", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalNotEqualTo(Boolean value) {
|
||||
addCriterion("`global` <>", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalGreaterThan(Boolean value) {
|
||||
addCriterion("`global` >", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`global` >=", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalLessThan(Boolean value) {
|
||||
addCriterion("`global` <", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`global` <=", value, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalIn(List<Boolean> values) {
|
||||
addCriterion("`global` in", values, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalNotIn(List<Boolean> values) {
|
||||
addCriterion("`global` not in", values, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`global` between", value1, value2, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGlobalNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`global` not between", value1, value2, "global");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andXpackIsNull() {
|
||||
addCriterion("xpack is null");
|
||||
return (Criteria) this;
|
||||
@ -984,6 +754,76 @@ public class PluginExample {
|
||||
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 andScenarioIsNull() {
|
||||
addCriterion("scenario is null");
|
||||
return (Criteria) this;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package io.metersphere.system.domain;
|
||||
|
||||
import io.metersphere.validation.groups.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PluginFrontScript implements Serializable {
|
||||
@Schema(title = "插件的ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin_front_script.plugin_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin_front_script.plugin_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String pluginId;
|
||||
|
||||
@Schema(title = "插件中对应表单配置的ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin_front_script.script_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin_front_script.script_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String scriptId;
|
||||
|
||||
@Schema(title = "脚本内容")
|
||||
private String script;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -3,14 +3,14 @@ package io.metersphere.system.domain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginBlobExample {
|
||||
public class PluginFrontScriptExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public PluginBlobExample() {
|
||||
public PluginFrontScriptExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
@ -104,73 +104,143 @@ public class PluginBlobExample {
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
public Criteria andPluginIdIsNull() {
|
||||
addCriterion("plugin_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
public Criteria andPluginIdIsNotNull() {
|
||||
addCriterion("plugin_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
public Criteria andPluginIdEqualTo(String value) {
|
||||
addCriterion("plugin_id =", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
public Criteria andPluginIdNotEqualTo(String value) {
|
||||
addCriterion("plugin_id <>", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
public Criteria andPluginIdGreaterThan(String value) {
|
||||
addCriterion("plugin_id >", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
public Criteria andPluginIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("plugin_id >=", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
public Criteria andPluginIdLessThan(String value) {
|
||||
addCriterion("plugin_id <", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
public Criteria andPluginIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("plugin_id <=", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
public Criteria andPluginIdLike(String value) {
|
||||
addCriterion("plugin_id like", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
public Criteria andPluginIdNotLike(String value) {
|
||||
addCriterion("plugin_id not like", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
public Criteria andPluginIdIn(List<String> values) {
|
||||
addCriterion("plugin_id in", values, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
public Criteria andPluginIdNotIn(List<String> values) {
|
||||
addCriterion("plugin_id not in", values, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
public Criteria andPluginIdBetween(String value1, String value2) {
|
||||
addCriterion("plugin_id between", value1, value2, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
public Criteria andPluginIdNotBetween(String value1, String value2) {
|
||||
addCriterion("plugin_id not between", value1, value2, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNull() {
|
||||
addCriterion("script_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNotNull() {
|
||||
addCriterion("script_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdEqualTo(String value) {
|
||||
addCriterion("script_id =", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotEqualTo(String value) {
|
||||
addCriterion("script_id <>", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThan(String value) {
|
||||
addCriterion("script_id >", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("script_id >=", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThan(String value) {
|
||||
addCriterion("script_id <", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("script_id <=", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLike(String value) {
|
||||
addCriterion("script_id like", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotLike(String value) {
|
||||
addCriterion("script_id not like", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIn(List<String> values) {
|
||||
addCriterion("script_id in", values, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotIn(List<String> values) {
|
||||
addCriterion("script_id not in", values, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdBetween(String value1, String value2) {
|
||||
addCriterion("script_id between", value1, value2, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotBetween(String value1, String value2) {
|
||||
addCriterion("script_id not between", value1, value2, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package io.metersphere.system.domain;
|
||||
|
||||
import io.metersphere.validation.groups.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PluginOrganization implements Serializable {
|
||||
@Schema(title = "插件ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin_organization.plugin_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin_organization.plugin_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String pluginId;
|
||||
|
||||
@Schema(title = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin_organization.organization_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin_organization.organization_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String organizationId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,340 @@
|
||||
package io.metersphere.system.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginOrganizationExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public PluginOrganizationExample() {
|
||||
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 andPluginIdIsNull() {
|
||||
addCriterion("plugin_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdIsNotNull() {
|
||||
addCriterion("plugin_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdEqualTo(String value) {
|
||||
addCriterion("plugin_id =", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdNotEqualTo(String value) {
|
||||
addCriterion("plugin_id <>", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdGreaterThan(String value) {
|
||||
addCriterion("plugin_id >", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("plugin_id >=", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdLessThan(String value) {
|
||||
addCriterion("plugin_id <", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("plugin_id <=", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdLike(String value) {
|
||||
addCriterion("plugin_id like", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdNotLike(String value) {
|
||||
addCriterion("plugin_id not like", value, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdIn(List<String> values) {
|
||||
addCriterion("plugin_id in", values, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdNotIn(List<String> values) {
|
||||
addCriterion("plugin_id not in", values, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdBetween(String value1, String value2) {
|
||||
addCriterion("plugin_id between", value1, value2, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPluginIdNotBetween(String value1, String value2) {
|
||||
addCriterion("plugin_id not between", value1, value2, "pluginId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIsNull() {
|
||||
addCriterion("organization_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIsNotNull() {
|
||||
addCriterion("organization_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdEqualTo(String value) {
|
||||
addCriterion("organization_id =", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotEqualTo(String value) {
|
||||
addCriterion("organization_id <>", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdGreaterThan(String value) {
|
||||
addCriterion("organization_id >", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("organization_id >=", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLessThan(String value) {
|
||||
addCriterion("organization_id <", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("organization_id <=", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLike(String value) {
|
||||
addCriterion("organization_id like", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotLike(String value) {
|
||||
addCriterion("organization_id not like", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIn(List<String> values) {
|
||||
addCriterion("organization_id in", values, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotIn(List<String> values) {
|
||||
addCriterion("organization_id not in", values, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdBetween(String value1, String value2) {
|
||||
addCriterion("organization_id between", value1, value2, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
|
||||
addCriterion("organization_id not between", value1, value2, "organizationId");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package io.metersphere.system.mapper;
|
||||
|
||||
import io.metersphere.system.domain.PluginBlob;
|
||||
import io.metersphere.system.domain.PluginBlobExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface PluginBlobMapper {
|
||||
long countByExample(PluginBlobExample example);
|
||||
|
||||
int deleteByExample(PluginBlobExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(PluginBlob record);
|
||||
|
||||
int insertSelective(PluginBlob record);
|
||||
|
||||
List<PluginBlob> selectByExampleWithBLOBs(PluginBlobExample example);
|
||||
|
||||
List<PluginBlob> selectByExample(PluginBlobExample example);
|
||||
|
||||
PluginBlob selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PluginBlob record, @Param("example") PluginBlobExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") PluginBlob record, @Param("example") PluginBlobExample example);
|
||||
|
||||
int updateByExample(@Param("record") PluginBlob record, @Param("example") PluginBlobExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(PluginBlob record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(PluginBlob record);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package io.metersphere.system.mapper;
|
||||
|
||||
import io.metersphere.system.domain.PluginFrontScript;
|
||||
import io.metersphere.system.domain.PluginFrontScriptExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface PluginFrontScriptMapper {
|
||||
long countByExample(PluginFrontScriptExample example);
|
||||
|
||||
int deleteByExample(PluginFrontScriptExample example);
|
||||
|
||||
int deleteByPrimaryKey(@Param("pluginId") String pluginId, @Param("scriptId") String scriptId);
|
||||
|
||||
int insert(PluginFrontScript record);
|
||||
|
||||
int insertSelective(PluginFrontScript record);
|
||||
|
||||
List<PluginFrontScript> selectByExampleWithBLOBs(PluginFrontScriptExample example);
|
||||
|
||||
List<PluginFrontScript> selectByExample(PluginFrontScriptExample example);
|
||||
|
||||
PluginFrontScript selectByPrimaryKey(@Param("pluginId") String pluginId, @Param("scriptId") String scriptId);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PluginFrontScript record, @Param("example") PluginFrontScriptExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") PluginFrontScript record, @Param("example") PluginFrontScriptExample example);
|
||||
|
||||
int updateByExample(@Param("record") PluginFrontScript record, @Param("example") PluginFrontScriptExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(PluginFrontScript record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(PluginFrontScript record);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
<?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.PluginBlobMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.PluginBlob">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<mapper namespace="io.metersphere.system.mapper.PluginFrontScriptMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.PluginFrontScript">
|
||||
<id column="plugin_id" jdbcType="VARCHAR" property="pluginId" />
|
||||
<id column="script_id" jdbcType="VARCHAR" property="scriptId" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.PluginBlob">
|
||||
<result column="form_option" jdbcType="LONGVARBINARY" property="formOption" />
|
||||
<result column="form_script" jdbcType="LONGVARBINARY" property="formScript" />
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.PluginFrontScript">
|
||||
<result column="script" jdbcType="LONGVARCHAR" property="script" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -67,12 +67,12 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
plugin_id, script_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
form_option, form_script
|
||||
script
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.PluginBlobExample" resultMap="ResultMapWithBLOBs">
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.PluginFrontScriptExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
@ -80,7 +80,7 @@
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from plugin_blob
|
||||
from plugin_front_script
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
@ -88,13 +88,13 @@
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.PluginBlobExample" resultMap="BaseResultMap">
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.PluginFrontScriptExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from plugin_blob
|
||||
from plugin_front_script
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
@ -102,72 +102,74 @@
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
<select id="selectByPrimaryKey" parameterType="map" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from plugin_blob
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
from plugin_front_script
|
||||
where plugin_id = #{pluginId,jdbcType=VARCHAR}
|
||||
and script_id = #{scriptId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from plugin_blob
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
<delete id="deleteByPrimaryKey" parameterType="map">
|
||||
delete from plugin_front_script
|
||||
where plugin_id = #{pluginId,jdbcType=VARCHAR}
|
||||
and script_id = #{scriptId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.PluginBlobExample">
|
||||
delete from plugin_blob
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.PluginFrontScriptExample">
|
||||
delete from plugin_front_script
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.PluginBlob">
|
||||
insert into plugin_blob (id, form_option, form_script
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.PluginFrontScript">
|
||||
insert into plugin_front_script (plugin_id, script_id, script
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{formOption,jdbcType=LONGVARBINARY}, #{formScript,jdbcType=LONGVARBINARY}
|
||||
values (#{pluginId,jdbcType=VARCHAR}, #{scriptId,jdbcType=VARCHAR}, #{script,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.PluginBlob">
|
||||
insert into plugin_blob
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.PluginFrontScript">
|
||||
insert into plugin_front_script
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
<if test="pluginId != null">
|
||||
plugin_id,
|
||||
</if>
|
||||
<if test="formOption != null">
|
||||
form_option,
|
||||
<if test="scriptId != null">
|
||||
script_id,
|
||||
</if>
|
||||
<if test="formScript != null">
|
||||
form_script,
|
||||
<if test="script != null">
|
||||
script,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
<if test="pluginId != null">
|
||||
#{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="formOption != null">
|
||||
#{formOption,jdbcType=LONGVARBINARY},
|
||||
<if test="scriptId != null">
|
||||
#{scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="formScript != null">
|
||||
#{formScript,jdbcType=LONGVARBINARY},
|
||||
<if test="script != null">
|
||||
#{script,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.PluginBlobExample" resultType="java.lang.Long">
|
||||
select count(*) from plugin_blob
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.PluginFrontScriptExample" resultType="java.lang.Long">
|
||||
select count(*) from plugin_front_script
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update plugin_blob
|
||||
update plugin_front_script
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
<if test="record.pluginId != null">
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.formOption != null">
|
||||
form_option = #{record.formOption,jdbcType=LONGVARBINARY},
|
||||
<if test="record.scriptId != null">
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.formScript != null">
|
||||
form_script = #{record.formScript,jdbcType=LONGVARBINARY},
|
||||
<if test="record.script != null">
|
||||
script = #{record.script,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
@ -175,37 +177,36 @@
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update plugin_blob
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
form_option = #{record.formOption,jdbcType=LONGVARBINARY},
|
||||
form_script = #{record.formScript,jdbcType=LONGVARBINARY}
|
||||
update plugin_front_script
|
||||
set plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
script = #{record.script,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update plugin_blob
|
||||
set id = #{record.id,jdbcType=VARCHAR}
|
||||
update plugin_front_script
|
||||
set plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.PluginBlob">
|
||||
update plugin_blob
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.PluginFrontScript">
|
||||
update plugin_front_script
|
||||
<set>
|
||||
<if test="formOption != null">
|
||||
form_option = #{formOption,jdbcType=LONGVARBINARY},
|
||||
</if>
|
||||
<if test="formScript != null">
|
||||
form_script = #{formScript,jdbcType=LONGVARBINARY},
|
||||
<if test="script != null">
|
||||
script = #{script,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
where plugin_id = #{pluginId,jdbcType=VARCHAR}
|
||||
and script_id = #{scriptId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.PluginBlob">
|
||||
update plugin_blob
|
||||
set form_option = #{formOption,jdbcType=LONGVARBINARY},
|
||||
form_script = #{formScript,jdbcType=LONGVARBINARY}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.PluginFrontScript">
|
||||
update plugin_front_script
|
||||
set script = #{script,jdbcType=LONGVARCHAR}
|
||||
where plugin_id = #{pluginId,jdbcType=VARCHAR}
|
||||
and script_id = #{scriptId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
@ -5,16 +5,14 @@
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="plugin_id" jdbcType="VARCHAR" property="pluginId" />
|
||||
<result column="script_id" jdbcType="VARCHAR" property="scriptId" />
|
||||
<result column="clazz_name" jdbcType="VARCHAR" property="clazzName" />
|
||||
<result column="jmeter_clazz" jdbcType="VARCHAR" property="jmeterClazz" />
|
||||
<result column="source_path" jdbcType="VARCHAR" property="sourcePath" />
|
||||
<result column="source_name" jdbcType="VARCHAR" property="sourceName" />
|
||||
<result column="exec_entry" jdbcType="VARCHAR" property="execEntry" />
|
||||
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
|
||||
<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="enable" jdbcType="BIT" property="enable" />
|
||||
<result column="global" jdbcType="BIT" property="global" />
|
||||
<result column="xpack" jdbcType="BIT" property="xpack" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="scenario" jdbcType="VARCHAR" property="scenario" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
@ -76,8 +74,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, plugin_id, script_id, clazz_name, jmeter_clazz, source_path, source_name,
|
||||
exec_entry, create_time, update_time, create_user, xpack, scenario
|
||||
id, `name`, plugin_id, file_name, create_time, update_time, create_user, `enable`,
|
||||
`global`, xpack, description, scenario
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.PluginExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -111,15 +109,15 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.Plugin">
|
||||
insert into plugin (id, `name`, plugin_id,
|
||||
script_id, clazz_name, jmeter_clazz,
|
||||
source_path, source_name, exec_entry,
|
||||
create_time, update_time, create_user,
|
||||
xpack, scenario)
|
||||
file_name, create_time, update_time,
|
||||
create_user, `enable`, `global`,
|
||||
xpack, description, scenario
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pluginId,jdbcType=VARCHAR},
|
||||
#{scriptId,jdbcType=VARCHAR}, #{clazzName,jdbcType=VARCHAR}, #{jmeterClazz,jdbcType=VARCHAR},
|
||||
#{sourcePath,jdbcType=VARCHAR}, #{sourceName,jdbcType=VARCHAR}, #{execEntry,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
|
||||
#{xpack,jdbcType=BIT}, #{scenario,jdbcType=VARCHAR})
|
||||
#{fileName,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{createUser,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{global,jdbcType=BIT},
|
||||
#{xpack,jdbcType=BIT}, #{description,jdbcType=VARCHAR}, #{scenario,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.Plugin">
|
||||
insert into plugin
|
||||
@ -133,23 +131,8 @@
|
||||
<if test="pluginId != null">
|
||||
plugin_id,
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
script_id,
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
clazz_name,
|
||||
</if>
|
||||
<if test="jmeterClazz != null">
|
||||
jmeter_clazz,
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
source_path,
|
||||
</if>
|
||||
<if test="sourceName != null">
|
||||
source_name,
|
||||
</if>
|
||||
<if test="execEntry != null">
|
||||
exec_entry,
|
||||
<if test="fileName != null">
|
||||
file_name,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
@ -160,9 +143,18 @@
|
||||
<if test="createUser != null">
|
||||
create_user,
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`enable`,
|
||||
</if>
|
||||
<if test="global != null">
|
||||
`global`,
|
||||
</if>
|
||||
<if test="xpack != null">
|
||||
xpack,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="scenario != null">
|
||||
scenario,
|
||||
</if>
|
||||
@ -177,23 +169,8 @@
|
||||
<if test="pluginId != null">
|
||||
#{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
#{scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
#{clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jmeterClazz != null">
|
||||
#{jmeterClazz,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
#{sourcePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceName != null">
|
||||
#{sourceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="execEntry != null">
|
||||
#{execEntry,jdbcType=VARCHAR},
|
||||
<if test="fileName != null">
|
||||
#{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
@ -204,9 +181,18 @@
|
||||
<if test="createUser != null">
|
||||
#{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
#{enable,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="global != null">
|
||||
#{global,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="xpack != null">
|
||||
#{xpack,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenario != null">
|
||||
#{scenario,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -230,23 +216,8 @@
|
||||
<if test="record.pluginId != null">
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.scriptId != null">
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.clazzName != null">
|
||||
clazz_name = #{record.clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.jmeterClazz != null">
|
||||
jmeter_clazz = #{record.jmeterClazz,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.sourcePath != null">
|
||||
source_path = #{record.sourcePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.sourceName != null">
|
||||
source_name = #{record.sourceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.execEntry != null">
|
||||
exec_entry = #{record.execEntry,jdbcType=VARCHAR},
|
||||
<if test="record.fileName != null">
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
@ -257,9 +228,18 @@
|
||||
<if test="record.createUser != null">
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.enable != null">
|
||||
`enable` = #{record.enable,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.global != null">
|
||||
`global` = #{record.global,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.xpack != null">
|
||||
xpack = #{record.xpack,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.scenario != null">
|
||||
scenario = #{record.scenario,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -273,16 +253,14 @@
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{record.clazzName,jdbcType=VARCHAR},
|
||||
jmeter_clazz = #{record.jmeterClazz,jdbcType=VARCHAR},
|
||||
source_path = #{record.sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{record.sourceName,jdbcType=VARCHAR},
|
||||
exec_entry = #{record.execEntry,jdbcType=VARCHAR},
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
`enable` = #{record.enable,jdbcType=BIT},
|
||||
`global` = #{record.global,jdbcType=BIT},
|
||||
xpack = #{record.xpack,jdbcType=BIT},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
scenario = #{record.scenario,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -297,23 +275,8 @@
|
||||
<if test="pluginId != null">
|
||||
plugin_id = #{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
script_id = #{scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
clazz_name = #{clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jmeterClazz != null">
|
||||
jmeter_clazz = #{jmeterClazz,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceName != null">
|
||||
source_name = #{sourceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="execEntry != null">
|
||||
exec_entry = #{execEntry,jdbcType=VARCHAR},
|
||||
<if test="fileName != null">
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
@ -324,9 +287,18 @@
|
||||
<if test="createUser != null">
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`enable` = #{enable,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="global != null">
|
||||
`global` = #{global,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="xpack != null">
|
||||
xpack = #{xpack,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenario != null">
|
||||
scenario = #{scenario,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -337,16 +309,14 @@
|
||||
update plugin
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
plugin_id = #{pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{clazzName,jdbcType=VARCHAR},
|
||||
jmeter_clazz = #{jmeterClazz,jdbcType=VARCHAR},
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{sourceName,jdbcType=VARCHAR},
|
||||
exec_entry = #{execEntry,jdbcType=VARCHAR},
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
`enable` = #{enable,jdbcType=BIT},
|
||||
`global` = #{global,jdbcType=BIT},
|
||||
xpack = #{xpack,jdbcType=BIT},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
scenario = #{scenario,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -0,0 +1,24 @@
|
||||
package io.metersphere.system.mapper;
|
||||
|
||||
import io.metersphere.system.domain.PluginOrganization;
|
||||
import io.metersphere.system.domain.PluginOrganizationExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface PluginOrganizationMapper {
|
||||
long countByExample(PluginOrganizationExample example);
|
||||
|
||||
int deleteByExample(PluginOrganizationExample example);
|
||||
|
||||
int deleteByPrimaryKey(@Param("pluginId") String pluginId, @Param("organizationId") String organizationId);
|
||||
|
||||
int insert(PluginOrganization record);
|
||||
|
||||
int insertSelective(PluginOrganization record);
|
||||
|
||||
List<PluginOrganization> selectByExample(PluginOrganizationExample example);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PluginOrganization record, @Param("example") PluginOrganizationExample example);
|
||||
|
||||
int updateByExample(@Param("record") PluginOrganization record, @Param("example") PluginOrganizationExample example);
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
<?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.PluginOrganizationMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.PluginOrganization">
|
||||
<id column="plugin_id" jdbcType="VARCHAR" property="pluginId" />
|
||||
<id column="organization_id" jdbcType="VARCHAR" property="organizationId" />
|
||||
</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">
|
||||
plugin_id, organization_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.PluginOrganizationExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from plugin_organization
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="map">
|
||||
delete from plugin_organization
|
||||
where plugin_id = #{pluginId,jdbcType=VARCHAR}
|
||||
and organization_id = #{organizationId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.PluginOrganizationExample">
|
||||
delete from plugin_organization
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.PluginOrganization">
|
||||
insert into plugin_organization (plugin_id, organization_id)
|
||||
values (#{pluginId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.PluginOrganization">
|
||||
insert into plugin_organization
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="pluginId != null">
|
||||
plugin_id,
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
organization_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="pluginId != null">
|
||||
#{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
#{organizationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.PluginOrganizationExample" resultType="java.lang.Long">
|
||||
select count(*) from plugin_organization
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update plugin_organization
|
||||
<set>
|
||||
<if test="record.pluginId != null">
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.organizationId != null">
|
||||
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update plugin_organization
|
||||
set plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
organization_id = #{record.organizationId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
@ -141,24 +141,41 @@ CREATE INDEX idx_type ON operation_log(`type`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`name` VARCHAR(255) COMMENT 'plugin name',
|
||||
`plugin_id` VARCHAR(300) NOT NULL COMMENT 'Plugin id',
|
||||
`script_id` VARCHAR(300) NOT NULL COMMENT 'Ui script id',
|
||||
`clazz_name` VARCHAR(500) NOT NULL COMMENT 'Plugin clazzName',
|
||||
`jmeter_clazz` VARCHAR(300) NOT NULL COMMENT 'Jmeter base clazzName',
|
||||
`source_path` VARCHAR(300) NOT NULL COMMENT 'Plugin jar path',
|
||||
`source_name` VARCHAR(300) NOT NULL COMMENT 'Plugin jar name',
|
||||
`exec_entry` VARCHAR(300) COMMENT 'plugin init entry class',
|
||||
`create_time` BIGINT COMMENT '',
|
||||
`update_time` BIGINT COMMENT '',
|
||||
`create_user` VARCHAR(50) COMMENT '',
|
||||
`xpack` BIT COMMENT 'Is xpack plugin',
|
||||
`scenario` VARCHAR(50) NOT NULL COMMENT 'Plugin usage scenarios',
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
|
||||
`name` VARCHAR(255) NOT NULL COMMENT '插件名称' ,
|
||||
`plugin_id` VARCHAR(300) NOT NULL COMMENT '插件ID(名称加版本号)' ,
|
||||
`file_name` VARCHAR(300) NOT NULL COMMENT '文件名' ,
|
||||
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
|
||||
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
|
||||
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
|
||||
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用插件' ,
|
||||
`global` BIT NOT NULL DEFAULT 1 COMMENT '是否是全局插件' ,
|
||||
`xpack` BIT NOT NULL DEFAULT 0 COMMENT '是否是企业版插件' ,
|
||||
`description` VARCHAR(500) COMMENT '插件描述' ,
|
||||
`scenario` VARCHAR(50) NOT NULL COMMENT '插件使用场景PAI/PLATFORM' ,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '插件';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin_front_script
|
||||
(
|
||||
`plugin_id` VARCHAR(50) NOT NULL COMMENT '插件的ID' ,
|
||||
`script_id` VARCHAR(50) NOT NULL COMMENT '插件中对应表单配置的ID' ,
|
||||
`script` TEXT COMMENT '脚本内容' ,
|
||||
PRIMARY KEY (plugin_id,script_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '插件';
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '插件的前端配置脚本';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin_organization
|
||||
(
|
||||
`plugin_id` VARCHAR(50) NOT NULL COMMENT '插件ID' ,
|
||||
`organization_id` VARCHAR(50) NOT NULL COMMENT '组织ID' ,
|
||||
PRIMARY KEY (plugin_id,organization_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '插件和组织的关联表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS quota
|
||||
(
|
||||
@ -411,17 +428,6 @@ CREATE TABLE IF NOT EXISTS message_task_blob
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务大字段';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin_blob
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`form_option` LONGBLOB COMMENT 'plugin form option',
|
||||
`form_script` LONGBLOB COMMENT 'plugin form script',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '插件大字段';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS test_resource_pool_organization;
|
||||
CREATE TABLE test_resource_pool_organization(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT '测试资源池项目关系ID' ,
|
||||
|
@ -18,8 +18,6 @@ public class SystemInterceptor {
|
||||
configList.add(new MybatisInterceptorConfig(TestResourcePoolBlob.class, "configuration", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(AuthSource.class, "configuration", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(NoviceStatistics.class, "dataOption", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(PluginBlob.class, "formOption", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(PluginBlob.class, "formScript", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(ServiceIntegration.class, "configuration", CompressUtils.class, "zip", "unzip"));
|
||||
configList.add(new MybatisInterceptorConfig(UserExtend.class, "platformInfo", CompressUtils.class, "zip", "unzip"));
|
||||
|
||||
|
@ -34,6 +34,13 @@ public class PermissionConstants {
|
||||
public static final String ORGANIZATION_USER_ROLE_READ_DELETE = "ORGANIZATION_USER_ROLE:READ+DELETE";
|
||||
/*------ end: ORGANIZATION_USER_ROLE ------*/
|
||||
|
||||
/*------ start: SYSTEM_PLUGIN ------*/
|
||||
public static final String SYSTEM_PLUGIN_READ = "SYSTEM_PLUGIN_READ:READ";
|
||||
public static final String SYSTEM_PLUGIN_ADD = "SYSTEM_PLUGIN_READ:READ+ADD";
|
||||
public static final String SYSTEM_PLUGIN_UPDATE = "SYSTEM_PLUGIN_READ:READ+UPDATE";
|
||||
public static final String SYSTEM_PLUGIN_DELETE = "SYSTEM_PLUGIN_READ:READ+DELETE";
|
||||
/*------ end: SYSTEM_PLUGIN ------*/
|
||||
|
||||
public static final String SYSTEM_USER_READ = "SYSTEM_USER:READ";
|
||||
public static final String SYSTEM_USER_READ_ADD = "SYSTEM_USER:READ+ADD";
|
||||
public static final String SYSTEM_USER_READ_IMPORT = "SYSTEM_USER:READ+IMPORT";
|
||||
|
@ -0,0 +1,5 @@
|
||||
package io.metersphere.sdk.constants;
|
||||
|
||||
public enum PluginScenarioType {
|
||||
PAI, PLATFORM
|
||||
}
|
@ -28,7 +28,8 @@ public class ResultResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, Class<? extends HttpMessageConverter<?>> converterType, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
|
||||
// 处理空值
|
||||
if (o == null && StringHttpMessageConverter.class.isAssignableFrom(converterType)) {
|
||||
return null;
|
||||
serverHttpResponse.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
return JSON.toJSONString(ResultHolder.success(o));
|
||||
}
|
||||
|
||||
if (methodParameter.hasMethodAnnotation(NoResultHolder.class)) {
|
||||
@ -37,6 +38,7 @@ public class ResultResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
|
||||
if (!(o instanceof ResultHolder)) {
|
||||
if (o instanceof String) {
|
||||
serverHttpResponse.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
return JSON.toJSONString(ResultHolder.success(o));
|
||||
}
|
||||
return ResultHolder.success(o);
|
||||
|
@ -0,0 +1,20 @@
|
||||
package io.metersphere.sdk.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrganizationOptionDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "组织ID")
|
||||
private String id;
|
||||
|
||||
@Schema(title = "组织编号")
|
||||
private Long num;
|
||||
|
||||
@Schema(title = "组织名称")
|
||||
private String name;
|
||||
}
|
@ -33,7 +33,7 @@ public class UserRoleUpdateRequest implements Serializable {
|
||||
|
||||
@Schema(title = "所属类型 SYSTEM ORGANIZATION PROJECT", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{user_role.type.not_blank}", groups = {Created.class})
|
||||
@EnumValue(enumClass = UserRoleType.class, groups = {Created.class})
|
||||
@EnumValue(enumClass = UserRoleType.class, groups = {Created.class, Updated.class})
|
||||
@Size(min = 1, max = 20, message = "{user_role.type.length_range}", groups = {Created.class, Updated.class})
|
||||
private String type;
|
||||
}
|
||||
|
@ -54,21 +54,6 @@ operation_log_resource.operating_log_id.not_blank=Operating log resource operati
|
||||
operation_log_resource.operating_log_id.length_range=Operating log resource operating log id must be between {min} and {max} characters long
|
||||
operation_log_resource.source_id.not_blank=Operating log resource source id must not be blank
|
||||
operation_log_resource.source_id.length_range=Operating log resource source id must be between {min} and {max} characters long
|
||||
plugin.id.not_blank=Plugin id must not be blank
|
||||
plugin.plugin_id.not_blank=Plugin plugin id must not be blank
|
||||
plugin.plugin_id.length_range=Plugin plugin id must be between {min} and {max} characters long
|
||||
plugin.script_id.not_blank=Plugin script id must not be blank
|
||||
plugin.script_id.length_range=Plugin script id must be between {min} and {max} characters long
|
||||
plugin.clazz_name.not_blank=Plugin clazz name must not be blank
|
||||
plugin.clazz_name.length_range=Plugin clazz name must be between {min} and {max} characters long
|
||||
plugin.jmeter_clazz.not_blank=Plugin jmeter clazz must not be blank
|
||||
plugin.jmeter_clazz.length_range=Plugin jmeter clazz must be between {min} and {max} characters long
|
||||
plugin.source_path.not_blank=Plugin source path must not be blank
|
||||
plugin.source_path.length_range=Plugin source path must be between {min} and {max} characters long
|
||||
plugin.source_name.not_blank=Plugin source name must not be blank
|
||||
plugin.source_name.length_range=Plugin source name must be between {min} and {max} characters long
|
||||
plugin.scenario.not_blank=Plugin scenario must not be blank
|
||||
plugin.scenario.length_range=Plugin scenario must be between {min} and {max} characters long
|
||||
plugin_blob.id.not_blank=Plugin blob plugin id must not be blank
|
||||
quota.id.not_blank=Quota id must not be blank
|
||||
schedule.id.not_blank=Schedule id must not be blank
|
||||
@ -164,7 +149,24 @@ organization_user_role_permission_error=no organization user role permission
|
||||
user_role_exist=User role already exists
|
||||
user_role_not_exist=User role not exist
|
||||
user_role_not_edit=User role can not edit
|
||||
|
||||
# plugin
|
||||
plugin.id.not_blank=id cannot be empty
|
||||
plugin.id.length_range=id length must be between {min} and {max}
|
||||
plugin.name.not_blank=name cannot be empty
|
||||
plugin.name.length_range=name length must be between {min} and {max}
|
||||
plugin.plugin_id.not_blank=pluginId cannot be empty
|
||||
plugin.plugin_id.length_range=pluginId length must be between {min} and {max}
|
||||
plugin.file_name.not_blank=fileName cannot be empty
|
||||
plugin.file_name.length_range=fileName length must be between {min} and {max}
|
||||
plugin.create_user.not_blank=createUser cannot be empty
|
||||
plugin.create_user.length_range=createUser length must be between {min} and {max}
|
||||
plugin.scenario.not_blank=scenario cannot be empty
|
||||
plugin.scenario.length_range=scenario length must be between {min} and {max}
|
||||
permission.system_plugin.name=Plugin
|
||||
permission.system_plugin.read=READ
|
||||
permission.system_plugin.add=CREATE
|
||||
permission.system_plugin.edit=UPDATE
|
||||
permission.system_plugin.delete=DELETE
|
||||
|
||||
|
||||
|
||||
|
@ -54,21 +54,6 @@ operation_log_resource.operating_log_id.not_blank=操作日志资源操作日志
|
||||
operation_log_resource.operating_log_id.length_range=操作日志资源操作日志ID长度必须在{min}和{max}之间
|
||||
operation_log_resource.source_id.not_blank=操作日志资源来源ID不能为空
|
||||
operation_log_resource.source_id.length_range=操作日志资源来源ID长度必须在{min}和{max}之间
|
||||
plugin.id.not_blank=插件主键不能为空
|
||||
plugin.plugin_id.not_blank=插件ID不能为空
|
||||
plugin.plugin_id.length_range=插件ID长度必须在{min}和{max}之间
|
||||
plugin.script_id.not_blank=插件脚本ID不能为空
|
||||
plugin.script_id.length_range=插件脚本ID长度必须在{min}和{max}之间
|
||||
plugin.clazz_name.not_blank=插件类名不能为空
|
||||
plugin.clazz_name.length_range=插件类名长度必须在{min}和{max}之间
|
||||
plugin.jmeter_clazz.not_blank=插件jmeter类名不能为空
|
||||
plugin.jmeter_clazz.length_range=插件jmeter类名长度必须在{min}和{max}之间
|
||||
plugin.source_path.not_blank=插件源路径不能为空
|
||||
plugin.source_path.length_range=插件源路径长度必须在{min}和{max}之间
|
||||
plugin.source_name.not_blank=插件源名称不能为空
|
||||
plugin.source_name.length_range=插件源名称长度必须在{min}和{max}之间
|
||||
plugin.scenario.not_blank=插件场景不能为空
|
||||
plugin.scenario.length_range=插件场景长度必须在{min}和{max}之间
|
||||
plugin_blob.id.not_blank=插件ID不能为空
|
||||
quota.id.not_blank=配额ID不能为空
|
||||
schedule.id.not_blank=定时任务ID不能为空
|
||||
@ -163,3 +148,21 @@ organization_user_role_permission_error=没有权限操作非组织用户组
|
||||
user_role_exist=用户组已存在
|
||||
user_role_not_exist=用户组不存在
|
||||
user_role_not_edit=用户组无法编辑
|
||||
# plugin
|
||||
plugin.id.not_blank=ID不能为空
|
||||
plugin.id.length_range=ID长度必须在{min}和{max}之间
|
||||
plugin.name.not_blank=插件名称不能为空
|
||||
plugin.name.length_range=插件名称长度必须在{min}和{max}之间
|
||||
plugin.plugin_id.not_blank=插件ID(名称加版本号)不能为空
|
||||
plugin.plugin_id.length_range=插件ID(名称加版本号)长度必须在{min}和{max}之间
|
||||
plugin.file_name.not_blank=文件名不能为空
|
||||
plugin.file_name.length_range=文件名长度必须在{min}和{max}之间
|
||||
plugin.create_user.not_blank=创建人不能为空
|
||||
plugin.create_user.length_range=创建人长度必须在{min}和{max}之间
|
||||
plugin.scenario.not_blank=插件使用场景PAI/PLATFORM不能为空
|
||||
plugin.scenario.length_range=插件使用场景PAI/PLATFORM长度必须在{min}和{max}之间
|
||||
permission.system_plugin.name=插件
|
||||
permission.system_plugin.read=查看插件
|
||||
permission.system_plugin.add=创建插件
|
||||
permission.system_plugin.edit=更新插件
|
||||
permission.system_plugin.delete=删除插件
|
@ -54,21 +54,6 @@ operation_log_resource.operating_log_id.not_blank=操作日誌資源操作日誌
|
||||
operation_log_resource.operating_log_id.length_range=操作日誌資源操作日誌ID長度必須在{min}和{max}之間
|
||||
operation_log_resource.source_id.not_blank=操作日誌資源來源ID不能為空
|
||||
operation_log_resource.source_id.length_range=操作日誌資源來源ID長度必須在{min}和{max}之間
|
||||
plugin.id.not_blank=插件主鍵不能為空
|
||||
plugin.plugin_id.not_blank=插件ID不能為空
|
||||
plugin.plugin_id.length_range=插件ID長度必須在{min}和{max}之間
|
||||
plugin.script_id.not_blank=插件腳本ID不能為空
|
||||
plugin.script_id.length_range=插件腳本ID長度必須在{min}和{max}之間
|
||||
plugin.clazz_name.not_blank=插件類名不能為空
|
||||
plugin.clazz_name.length_range=插件類名長度必須在{min}和{max}之間
|
||||
plugin.jmeter_clazz.not_blank=插件jmeter類名不能為空
|
||||
plugin.jmeter_clazz.length_range=插件jmeter類名長度必須在{min}和{max}之間
|
||||
plugin.source_path.not_blank=插件源路徑不能為空
|
||||
plugin.source_path.length_range=插件源路徑長度必須在{min}和{max}之間
|
||||
plugin.source_name.not_blank=插件源名稱不能為空
|
||||
plugin.source_name.length_range=插件源名稱長度必須在{min}和{max}之間
|
||||
plugin.scenario.not_blank=插件場景不能為空
|
||||
plugin.scenario.length_range=插件場景長度必須在{min}和{max}之間
|
||||
plugin_blob.id.not_blank=插件ID不能為空
|
||||
quota.id.not_blank=配額ID不能為空
|
||||
schedule.id.not_blank=定時任務ID不能為空
|
||||
@ -162,4 +147,23 @@ global_user_role_relation_system_permission_error=沒有權限操作非系統級
|
||||
organization_user_role_permission_error=沒有權限操作非組織用戶組
|
||||
user_role_exist=用戶組已存在
|
||||
user_role_not_exist=用戶組不存在
|
||||
user_role_not_edit=用戶組無法編輯
|
||||
user_role_not_edit=用戶組無法編輯
|
||||
# plugin
|
||||
plugin.id.not_blank=ID不能為空
|
||||
plugin.id.length_range=ID長度必須在{min}和{max}之间
|
||||
plugin.name.not_blank=插件名称不能為空
|
||||
plugin.name.length_range=插件名称長度必須在{min}和{max}之间
|
||||
plugin.plugin_id.not_blank=插件ID(名称加版本号)不能為空
|
||||
plugin.plugin_id.length_range=插件ID(名称加版本号)長度必須在{min}和{max}之间
|
||||
plugin.file_name.not_blank=文件名不能為空
|
||||
plugin.file_name.length_range=文件名長度必須在{min}和{max}之间
|
||||
plugin.create_user.not_blank=创建人不能為空
|
||||
plugin.create_user.length_range=创建人長度必須在{min}和{max}之间
|
||||
plugin.scenario.not_blank=插件使用场景PAI/PLATFORM不能為空
|
||||
plugin.scenario.length_range=插件使用场景PAI/PLATFORM長度必須在{min}和{max}之间
|
||||
permission.system_plugin.name=插件
|
||||
permission.system_plugin.read=查看插件
|
||||
permission.system_plugin.add=創建插件
|
||||
permission.system_plugin.edit=更新插件
|
||||
permission.system_plugin.delete=刪除插件
|
||||
|
||||
|
@ -6,12 +6,12 @@ import com.jayway.jsonpath.JsonPath;
|
||||
import io.metersphere.sdk.constants.SessionConstants;
|
||||
import io.metersphere.sdk.constants.UserRoleType;
|
||||
import io.metersphere.sdk.controller.handler.result.IResultCode;
|
||||
import io.metersphere.sdk.domain.OperationLogExample;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.mapper.OperationLogMapper;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.domain.OperationLogExample;
|
||||
import io.metersphere.sdk.mapper.OperationLogMapper;
|
||||
import io.metersphere.system.domain.UserRolePermission;
|
||||
import io.metersphere.system.mapper.UserRolePermissionMapper;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
@ -27,12 +27,19 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -56,6 +63,12 @@ public abstract class BaseTest {
|
||||
@Resource
|
||||
private UserRolePermissionMapper userRolePermissionMapper;
|
||||
|
||||
protected static final String DEFAULT_LIST = "list";
|
||||
protected static final String DEFAULT_GET = "get/{0}";
|
||||
protected static final String DEFAULT_ADD = "add";
|
||||
protected static final String DEFAULT_UPDATE = "update";
|
||||
protected static final String DEFAULT_DELETE = "delete/{0}";
|
||||
|
||||
/**
|
||||
* 可以重写该方法定义 BASE_PATH
|
||||
*/
|
||||
@ -144,6 +157,74 @@ public abstract class BaseTest {
|
||||
return this.requestPostWithOk(url, param, uriVariables).andReturn();
|
||||
}
|
||||
|
||||
protected ResultActions requestMultipartWithOk(String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception {
|
||||
MockHttpServletRequestBuilder requestBuilder = getMultipartRequestBuilder(url, paramMap, uriVariables);
|
||||
return mockMvc.perform(requestBuilder)
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
protected MvcResult requestMultipartWithOkAndReturn(String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception {
|
||||
return this.requestMultipartWithOk(url, paramMap, uriVariables).andReturn();
|
||||
}
|
||||
private MockHttpServletRequestBuilder getPermissionMultipartRequestBuilder(String permissionId, String url,
|
||||
MultiValueMap<String, Object> paramMap,
|
||||
Object[] uriVariables) {
|
||||
AuthInfo authInfo = getPermissionAuthInfo(permissionId);
|
||||
return getMultipartRequestBuilderWithParam(url, paramMap, uriVariables)
|
||||
.header(SessionConstants.HEADER_TOKEN, authInfo.getSessionId())
|
||||
.header(SessionConstants.CSRF_TOKEN, authInfo.getCsrfToken());
|
||||
}
|
||||
|
||||
private MockHttpServletRequestBuilder getMultipartRequestBuilder(String url,
|
||||
MultiValueMap<String, Object> paramMap,
|
||||
Object[] uriVariables) {
|
||||
return getMultipartRequestBuilderWithParam(url, paramMap, uriVariables)
|
||||
.header(SessionConstants.HEADER_TOKEN, adminAuthInfo.getSessionId())
|
||||
.header(SessionConstants.CSRF_TOKEN, adminAuthInfo.getCsrfToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 multipart 带参数的请求
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @param uriVariables
|
||||
* @return
|
||||
*/
|
||||
private MockMultipartHttpServletRequestBuilder getMultipartRequestBuilderWithParam(String url, MultiValueMap<String, Object> paramMap, Object[] uriVariables) {
|
||||
MockMultipartHttpServletRequestBuilder requestBuilder =
|
||||
MockMvcRequestBuilders.multipart(getBasePath() + url, uriVariables);
|
||||
paramMap.forEach((key, value) -> {
|
||||
List list = value;
|
||||
for (Object o : list) {
|
||||
try {
|
||||
MockMultipartFile multipartFile;
|
||||
if (o instanceof File) {
|
||||
File file = (File) o;
|
||||
multipartFile = new MockMultipartFile(key, file.getName(),
|
||||
MediaType.APPLICATION_OCTET_STREAM_VALUE, Files.readAllBytes(file.toPath()));
|
||||
} else {
|
||||
multipartFile = new MockMultipartFile(key, null,
|
||||
MediaType.APPLICATION_JSON_VALUE, o.toString().getBytes());
|
||||
}
|
||||
|
||||
requestBuilder.file(multipartFile);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return requestBuilder;
|
||||
}
|
||||
|
||||
protected MultiValueMap<String, Object> getDefaultMultiPartParam(Object param, File file) {
|
||||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||
paramMap.add("file", file);
|
||||
paramMap.add("request", JSON.toJSONString(param));
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
protected <T> T getResultData(MvcResult mvcResult, Class<T> clazz) throws Exception {
|
||||
Object data = JSON.parseMap(mvcResult.getResponse().getContentAsString()).get("data");
|
||||
return JSON.parseObject(JSON.toJSONString(data), clazz);
|
||||
@ -250,17 +331,18 @@ public abstract class BaseTest {
|
||||
* 校验权限
|
||||
* 实现步骤
|
||||
* 1. 在 application.properties 配置权限的初始化 sql
|
||||
* spring.sql.init.mode=always
|
||||
* spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql
|
||||
* spring.sql.init.mode=always
|
||||
* spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql
|
||||
* 2. 在 init_permission_test.sql 中配置权限,
|
||||
* 初始化名称为 permissionId 前缀(SYSTEM, ORGANIZATION, PROJECT)的用户组和用户,并关联
|
||||
* 初始化名称为 permissionId 前缀(SYSTEM, ORGANIZATION, PROJECT)的用户组和用户,并关联
|
||||
* 3. 向该用户组中添加权限测试是否生效,删除权限测试是否可以访问
|
||||
*
|
||||
* @param permissionId
|
||||
* @param url
|
||||
* @param requestBuilderGetFunc 请求构造器,一个 builder 只能使用一次,需要重新生成
|
||||
* @throws Exception
|
||||
*/
|
||||
private void requestPermissionTest(String permissionId, String url, Supplier<MockHttpServletRequestBuilder> requestBuilderGetFunc) throws Exception {
|
||||
private void requestPermissionTest(String permissionId, String url, Supplier<MockHttpServletRequestBuilder> requestBuilderGetFunc) throws Exception {
|
||||
String roleId = permissionId.split("_")[0];
|
||||
// 先给初始化的用户组添加权限
|
||||
UserRolePermission userRolePermission = initUserRolePermission(roleId, permissionId);
|
||||
@ -297,6 +379,7 @@ public abstract class BaseTest {
|
||||
|
||||
/**
|
||||
* 调用 is-login 接口刷新权限
|
||||
*
|
||||
* @param permissionId
|
||||
* @throws Exception
|
||||
*/
|
||||
@ -312,8 +395,13 @@ public abstract class BaseTest {
|
||||
requestPermissionTest(permissionId, url, () -> getPermissionRequestBuilder(permissionId, url, uriVariables));
|
||||
}
|
||||
|
||||
protected void requestMultipartPermissionTest(String permissionId, String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception {
|
||||
requestPermissionTest(permissionId, url, () -> getPermissionMultipartRequestBuilder(permissionId, url, paramMap, uriVariables));
|
||||
}
|
||||
|
||||
/**
|
||||
* 给用户组绑定对应权限
|
||||
*
|
||||
* @param roleId
|
||||
* @param permissionId
|
||||
* @return
|
||||
|
@ -0,0 +1,86 @@
|
||||
package io.metersphere.system.controller;
|
||||
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
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.Plugin;
|
||||
import io.metersphere.system.dto.PluginDTO;
|
||||
import io.metersphere.system.dto.PluginListDTO;
|
||||
import io.metersphere.system.request.PluginUpdateRequest;
|
||||
import io.metersphere.system.service.PluginService;
|
||||
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.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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : jianxing
|
||||
* @date : 2023-7-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/plugin")
|
||||
@Tag(name = "插件")
|
||||
public class PluginController {
|
||||
|
||||
@Resource
|
||||
private PluginService pluginService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取插件列表")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_READ)
|
||||
public List<PluginListDTO> list() {
|
||||
return pluginService.list();
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "获取插件详情")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_READ)
|
||||
public PluginDTO get(@PathVariable String id) {
|
||||
return pluginService.get(id);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "创建插件")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_ADD)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.addLog(#request)", msClass = PluginService.class)
|
||||
public Plugin add(@Validated({Created.class}) @RequestPart(value = "request") PluginUpdateRequest request,
|
||||
@RequestPart(value = "file") MultipartFile file) {
|
||||
request.setCreateUser(SessionUtils.getUserId());
|
||||
return pluginService.add(request, file);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "更新插件")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_UPDATE)
|
||||
@Log(type = OperationLogType.ADD, expression = "#msClass.updateLog(#request)", msClass = PluginService.class)
|
||||
public Plugin update(@Validated({Updated.class}) @RequestPart(value = "request") PluginUpdateRequest request,
|
||||
@RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
Plugin plugin = new Plugin();
|
||||
BeanUtils.copyBean(plugin, request);
|
||||
return pluginService.update(request, file);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@Operation(summary = "删除插件")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_DELETE)
|
||||
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = PluginService.class)
|
||||
public String delete(@PathVariable String id) {
|
||||
return pluginService.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/script/get/{pluginId}/{scriptId}")
|
||||
@Operation(summary = "获取插件对应表单的脚本内容")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_READ)
|
||||
public String getScript(@PathVariable String pluginId, String scriptId) {
|
||||
return pluginService.getScript(pluginId, scriptId);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package io.metersphere.system.dto;
|
||||
|
||||
import io.metersphere.sdk.dto.OrganizationOptionDTO;
|
||||
import io.metersphere.system.domain.Plugin;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PluginDTO extends Plugin implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "关联的组织列表")
|
||||
private List<OrganizationOptionDTO> organizations;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package io.metersphere.system.dto;
|
||||
|
||||
import io.metersphere.system.domain.Plugin;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PluginListDTO extends Plugin implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "插件前端表单配置项列表")
|
||||
private List<PluginForm> pluginForms;
|
||||
|
||||
@Data
|
||||
class PluginForm {
|
||||
private String id;
|
||||
private String name;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package io.metersphere.system.dto.request;
|
||||
|
||||
import io.metersphere.sdk.dto.BasePageRequest;
|
||||
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;
|
||||
|
||||
import java.io.Serializable;
|
||||
@Data
|
||||
public class PluginQueryRequest extends BasePageRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(title = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 255, message = "{plugin.name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String name;
|
||||
|
||||
@Schema(title = "插件ID(名称加版本号)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.plugin_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.plugin_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String pluginId;
|
||||
|
||||
@Schema(title = "文件名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.file_name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 300, message = "{plugin.file_name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String fileName;
|
||||
|
||||
@Schema(title = "是否是全局插件")
|
||||
private Boolean global;
|
||||
|
||||
@Schema(title = "是否是企业版插件")
|
||||
private Boolean xpack;
|
||||
|
||||
@Schema(title = "插件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(title = "插件使用场景PAI/PLATFORM", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.scenario.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
||||
private String scenario;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package io.metersphere.system.request;
|
||||
|
||||
import io.metersphere.sdk.constants.PluginScenarioType;
|
||||
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.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PluginUpdateRequest {
|
||||
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(title = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.name.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 255, message = "{plugin.name.length_range}", groups = {Created.class, Updated.class})
|
||||
private String name;
|
||||
|
||||
@Schema(title = "是否启用插件, 默认启用")
|
||||
private Boolean enable = true;
|
||||
|
||||
@Schema(title = "是否是全局插件, 默认全局")
|
||||
private Boolean global = true;
|
||||
|
||||
@Schema(title = "插件描述")
|
||||
@Size(min = 1, max = 500, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
||||
private String description;
|
||||
|
||||
@Schema(title = "插件使用场景PAI/PLATFORM", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{plugin.scenario.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
||||
@EnumValue(enumClass = PluginScenarioType.class, groups = {Created.class, Updated.class})
|
||||
private String scenario;
|
||||
|
||||
@Schema(hidden = true)
|
||||
private String createUser;
|
||||
|
||||
@Schema(title = "关联的组织ID")
|
||||
private List<String> organizationIds;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package io.metersphere.system.service;
|
||||
|
||||
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.system.domain.Plugin;
|
||||
import io.metersphere.system.domain.PluginFrontScript;
|
||||
import io.metersphere.system.dto.PluginDTO;
|
||||
import io.metersphere.system.dto.PluginListDTO;
|
||||
import io.metersphere.system.mapper.PluginFrontScriptMapper;
|
||||
import io.metersphere.system.mapper.PluginMapper;
|
||||
import io.metersphere.system.request.PluginUpdateRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jianxing
|
||||
* @date : 2023-7-13
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PluginService {
|
||||
|
||||
@Resource
|
||||
private PluginMapper pluginMapper;
|
||||
@Resource
|
||||
private PluginFrontScriptMapper pluginFrontScriptMapper;
|
||||
|
||||
public List<PluginListDTO> list() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public PluginDTO get(String id) {
|
||||
Plugin plugin = pluginMapper.selectByPrimaryKey(id);
|
||||
PluginDTO pluginDTO = new PluginDTO();
|
||||
BeanUtils.copyBean(plugin, pluginDTO);
|
||||
return pluginDTO;
|
||||
}
|
||||
|
||||
public Plugin add(PluginUpdateRequest request, MultipartFile file) {
|
||||
Plugin plugin = new Plugin();
|
||||
BeanUtils.copyBean(plugin, request);
|
||||
plugin.setId(UUID.randomUUID().toString());
|
||||
plugin.setPluginId(UUID.randomUUID().toString());
|
||||
plugin.setFileName(file.getName());
|
||||
plugin.setCreateTime(System.currentTimeMillis());
|
||||
plugin.setUpdateTime(System.currentTimeMillis());
|
||||
plugin.setXpack(false);
|
||||
pluginMapper.insert(plugin);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public Plugin update(PluginUpdateRequest request, MultipartFile file) {
|
||||
Plugin plugin = new Plugin();
|
||||
BeanUtils.copyBean(plugin, request);
|
||||
plugin.setCreateTime(null);
|
||||
plugin.setUpdateTime(null);
|
||||
plugin.setCreateUser(null);
|
||||
pluginMapper.updateByPrimaryKeySelective(plugin);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public String delete(String id) {
|
||||
pluginMapper.deleteByPrimaryKey(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getScript(String pluginId, String scriptId) {
|
||||
PluginFrontScript frontScript = pluginFrontScriptMapper.selectByPrimaryKey(pluginId, scriptId);
|
||||
return frontScript == null ? null : frontScript.getScript();
|
||||
}
|
||||
}
|
@ -73,6 +73,26 @@
|
||||
"name": "permission.system_test_resource_pool.delete"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "SYSTEM_PLUGIN:READ",
|
||||
"name": "permission.system_plugin.read",
|
||||
"resourceId": "SYSTEM_PLUGIN"
|
||||
},
|
||||
{
|
||||
"id": "SYSTEM_PLUGIN:READ+ADD",
|
||||
"name": "permission.system_plugin.add",
|
||||
"resourceId": "SYSTEM_PLUGIN"
|
||||
},
|
||||
{
|
||||
"id": "SYSTEM_PLUGIN:READ+UPDATE",
|
||||
"name": "permission.system_plugin.edit",
|
||||
"resourceId": "SYSTEM_PLUGIN"
|
||||
},
|
||||
{
|
||||
"id": "SYSTEM_PLUGIN:READ+DELETE",
|
||||
"name": "permission.system_plugin.delete",
|
||||
"resourceId": "SYSTEM_PLUGIN"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -77,7 +77,8 @@
|
||||
<table tableName="operating_log"/>
|
||||
<table tableName="operating_log_resource"/>
|
||||
<table tableName="plugin"/>
|
||||
<table tableName="plugin_blob"/>
|
||||
<table tableName="plugin_front_script"/>
|
||||
<table tableName="plugin_organization"/>
|
||||
<table tableName="schedule"/>
|
||||
<table tableName="service_integration"/>
|
||||
<table tableName="system_parameter"/>
|
||||
|
@ -31,7 +31,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class AuthSourceControllerTest extends BaseTest {
|
||||
public class AuthSourceControllerTests extends BaseTest {
|
||||
|
||||
public static final String AUTH_SOURCE_ADD = "/system/authsource/add";
|
||||
|
@ -16,7 +16,7 @@ import java.util.Map;
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class CommonParamTest extends BaseTest {
|
||||
class CommonParamTests extends BaseTest {
|
||||
|
||||
/**
|
||||
* 校验 BasePageRequestDefinition 参数
|
||||
@ -24,7 +24,7 @@ class CommonParamTest extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
void testBasePageRequestDefinition() throws Exception {
|
||||
String url = GlobalUserRoleRelationControllerTest.BASE_URL + GlobalUserRoleRelationControllerTest.LIST;
|
||||
String url = GlobalUserRoleRelationControllerTests.BASE_URL + "list";
|
||||
paramValidateTest(BasePageRequestDefinition.class, url);
|
||||
BasePageRequestDefinition basePageRequestDefinition = new BasePageRequestDefinition();
|
||||
// @@校验 sort 字段 sql 防注入,有点复杂,手动写校验
|
@ -13,7 +13,7 @@ import org.springframework.mock.web.MockMultipartFile;
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class FileCenterTest {
|
||||
public class FileCenterTests {
|
||||
|
||||
@Resource
|
||||
private MinioRepository repository;
|
@ -35,7 +35,7 @@ import static io.metersphere.system.service.GlobalUserRoleService.GLOBAL_SCOPE;
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class GlobalUserRoleControllerTest extends BaseTest {
|
||||
class GlobalUserRoleControllerTests extends BaseTest {
|
||||
@Resource
|
||||
private UserRoleMapper userRoleMapper;
|
||||
@Resource
|
||||
@ -43,10 +43,6 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
@Resource
|
||||
private BaseUserRoleRelationService baseUserRoleRelationService;
|
||||
private static final String BASE_PATH = "/user/role/global/";
|
||||
private static final String LIST = "list";
|
||||
private static final String ADD = "add";
|
||||
private static final String UPDATE = "update";
|
||||
private static final String DELETE = "delete/{0}";
|
||||
private static final String PERMISSION_SETTING = "permission/setting/{0}";
|
||||
private static final String PERMISSION_UPDATE = "permission/update";
|
||||
|
||||
@ -60,7 +56,7 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
@Test
|
||||
void list() throws Exception {
|
||||
// @@请求成功
|
||||
MvcResult mvcResult = this.requestGetWithOk(LIST)
|
||||
MvcResult mvcResult = this.requestGetWithOk(DEFAULT_LIST)
|
||||
.andReturn();
|
||||
List<UserRole> userRoles = getResultDataArray(mvcResult, UserRole.class);
|
||||
|
||||
@ -75,7 +71,7 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
Assertions.assertTrue(CollectionUtils.isSubCollection(internalUserRoleIds, userRoleIds));
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_READ, LIST);
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_READ, DEFAULT_LIST);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -86,7 +82,7 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
request.setName("test");
|
||||
request.setType(UserRoleType.SYSTEM.name());
|
||||
request.setDescription("test desc");
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(ADD, request);
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(DEFAULT_ADD, request);
|
||||
UserRole resultData = getResultData(mvcResult, UserRole.class);
|
||||
UserRole userRole = userRoleMapper.selectByPrimaryKey(resultData.getId());
|
||||
// 校验请求成功数据
|
||||
@ -98,13 +94,13 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
checkLog(this.addUserRole.getId(), OperationLogType.ADD);
|
||||
|
||||
// @@重名校验异常
|
||||
assertErrorCode(this.requestPost(ADD, request), GLOBAL_USER_ROLE_EXIST);
|
||||
assertErrorCode(this.requestPost(DEFAULT_ADD, request), GLOBAL_USER_ROLE_EXIST);
|
||||
|
||||
// @@异常参数校验
|
||||
createdGroupParamValidateTest(UserRoleUpdateRequestDefinition.class, ADD);
|
||||
createdGroupParamValidateTest(UserRoleUpdateRequestDefinition.class, DEFAULT_ADD);
|
||||
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_ADD, ADD, request);
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_ADD, DEFAULT_ADD, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -116,7 +112,7 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
request.setName("test update");
|
||||
request.setType(UserRoleType.SYSTEM.name());
|
||||
request.setDescription("test desc !!!!");
|
||||
this.requestPostWithOk(UPDATE, request);
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, request);
|
||||
// 校验请求成功数据
|
||||
UserRole userRoleResult = userRoleMapper.selectByPrimaryKey(request.getId());
|
||||
Assertions.assertEquals(request.getName(), userRoleResult.getName());
|
||||
@ -128,23 +124,23 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
|
||||
// @@操作非全局用户组异常
|
||||
BeanUtils.copyBean(request, getNonGlobalUserRole());
|
||||
assertErrorCode(this.requestPost(UPDATE, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@操作内置用户组异常
|
||||
request.setId(ADMIN.getValue());
|
||||
request.setName(ADMIN.getValue());
|
||||
assertErrorCode(this.requestPost(UPDATE, request), INTERNAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), INTERNAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@重名校验异常
|
||||
request.setId(addUserRole.getId());
|
||||
request.setName("系统管理员");
|
||||
assertErrorCode(this.requestPost(UPDATE, request), GLOBAL_USER_ROLE_EXIST);
|
||||
assertErrorCode(this.requestPost(DEFAULT_UPDATE, request), GLOBAL_USER_ROLE_EXIST);
|
||||
|
||||
// @@异常参数校验
|
||||
updatedGroupParamValidateTest(UserRoleUpdateRequestDefinition.class, UPDATE);
|
||||
updatedGroupParamValidateTest(UserRoleUpdateRequestDefinition.class, DEFAULT_UPDATE);
|
||||
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, UPDATE, request);
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, DEFAULT_UPDATE, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -247,7 +243,7 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
@Order(3)
|
||||
void delete() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGet(DELETE, addUserRole.getId());
|
||||
this.requestGet(DEFAULT_DELETE, addUserRole.getId());
|
||||
// 校验请求成功数据
|
||||
Assertions.assertNull(userRoleMapper.selectByPrimaryKey(addUserRole.getId()));
|
||||
// 校验用户组与权限的关联关系是否删除
|
||||
@ -259,13 +255,13 @@ class GlobalUserRoleControllerTest extends BaseTest {
|
||||
checkLog(addUserRole.getId(), OperationLogType.DELETE);
|
||||
|
||||
// @@操作非全局用户组异常
|
||||
assertErrorCode(this.requestGet(DELETE, getNonGlobalUserRole().getId()), GLOBAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, getNonGlobalUserRole().getId()), GLOBAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@操作内置用户组异常
|
||||
assertErrorCode(this.requestGet(DELETE, ADMIN.getValue()), INTERNAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, ADMIN.getValue()), INTERNAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_DELETE, DELETE, addUserRole.getId());
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_DELETE, DEFAULT_DELETE, addUserRole.getId());
|
||||
}
|
||||
|
||||
/**
|
@ -35,11 +35,9 @@ import static io.metersphere.system.controller.result.SystemResultCode.*;
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
class GlobalUserRoleRelationControllerTests extends BaseTest {
|
||||
public static final String BASE_URL = "/user/role/relation/global/";
|
||||
public static final String LIST = "list";
|
||||
public static final String ADD = "add";
|
||||
public static final String DELETE = "delete/{0}";
|
||||
|
||||
// 保存创建的数据,方便之后的修改和删除测试使用
|
||||
private static UserRoleRelation addUserRoleRelation;
|
||||
@Resource
|
||||
@ -60,7 +58,7 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
request.setRoleId(ADMIN.getValue());
|
||||
|
||||
// @@正常请求
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(LIST, request);
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(DEFAULT_LIST, request);
|
||||
Pager<List<UserRoleRelationUserDTO>> pageResult = getPageResult(mvcResult, UserRoleRelationUserDTO.class);
|
||||
List<UserRoleRelationUserDTO> listRes = pageResult.getList();
|
||||
Set<String> userIdSet = listRes.stream()
|
||||
@ -77,18 +75,18 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
|
||||
// @@操作非系统级别用户组异常
|
||||
request.setRoleId(ORG_ADMIN.getValue());
|
||||
assertErrorCode(this.requestPost(LIST, request), GLOBAL_USER_ROLE_RELATION_SYSTEM_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_LIST, request), GLOBAL_USER_ROLE_RELATION_SYSTEM_PERMISSION);
|
||||
|
||||
// @@操作非全局用户组异常
|
||||
UserRole nonGlobalUserRole = getNonGlobalUserRole();
|
||||
request.setRoleId(nonGlobalUserRole.getId());
|
||||
assertErrorCode(this.requestPost(LIST, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_LIST, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@异常参数校验
|
||||
paramValidateTest(GlobalUserRoleRelationQueryRequestDefinition.class, LIST);
|
||||
paramValidateTest(GlobalUserRoleRelationQueryRequestDefinition.class, DEFAULT_LIST);
|
||||
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_READ, LIST, request);
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_READ, DEFAULT_LIST, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -102,7 +100,7 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
GlobalUserRoleRelationUpdateRequest request = new GlobalUserRoleRelationUpdateRequest();
|
||||
request.setUserId(ADMIN.getValue());
|
||||
request.setRoleId(nonInternalUserRole.getId());
|
||||
this.requestPostWithOk(ADD, request);
|
||||
this.requestPostWithOk(DEFAULT_ADD, request);
|
||||
UserRoleRelationExample example = new UserRoleRelationExample();
|
||||
example.createCriteria()
|
||||
.andRoleIdEqualTo(request.getRoleId())
|
||||
@ -116,31 +114,31 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
// @@重复添加校验
|
||||
request.setUserId(ADMIN.getValue());
|
||||
request.setRoleId(ADMIN.getValue());
|
||||
assertErrorCode(this.requestPost(ADD, request), USER_ROLE_RELATION_EXIST);
|
||||
assertErrorCode(this.requestPost(DEFAULT_ADD, request), USER_ROLE_RELATION_EXIST);
|
||||
|
||||
// @@操作非系统用户组异常
|
||||
request.setUserId(ADMIN.getValue());
|
||||
request.setRoleId(ORG_ADMIN.getValue());
|
||||
assertErrorCode(this.requestPost(ADD, request), GLOBAL_USER_ROLE_RELATION_SYSTEM_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_ADD, request), GLOBAL_USER_ROLE_RELATION_SYSTEM_PERMISSION);
|
||||
|
||||
// @@操作非全局用户组异常
|
||||
UserRole nonGlobalUserRole = getNonGlobalUserRole();
|
||||
request.setUserId(ADMIN.getValue());
|
||||
request.setRoleId(nonGlobalUserRole.getId());
|
||||
assertErrorCode(this.requestPost(ADD, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestPost(DEFAULT_ADD, request), GLOBAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@异常参数校验
|
||||
createdGroupParamValidateTest(GlobalUserRoleRelationUpdateRequestDefinition.class, ADD);
|
||||
createdGroupParamValidateTest(GlobalUserRoleRelationUpdateRequestDefinition.class, DEFAULT_ADD);
|
||||
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, ADD, request);
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, DEFAULT_ADD, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void delete() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGetWithOk(DELETE, addUserRoleRelation.getId());
|
||||
this.requestGetWithOk(DEFAULT_DELETE, addUserRoleRelation.getId());
|
||||
UserRoleRelation userRoleRelation = userRoleRelationMapper.selectByPrimaryKey(addUserRoleRelation.getId());
|
||||
Assertions.assertNull(userRoleRelation);
|
||||
|
||||
@ -148,11 +146,11 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
checkLog(addUserRoleRelation.getId(), OperationLogType.DELETE);
|
||||
|
||||
// @@操作非系统级别用户组异常
|
||||
assertErrorCode(this.requestGet(DELETE, getNonSystemUserRoleRelation().getId()),
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, getNonSystemUserRoleRelation().getId()),
|
||||
GLOBAL_USER_ROLE_RELATION_SYSTEM_PERMISSION);
|
||||
|
||||
// @@操作非全局用户组异常
|
||||
assertErrorCode(this.requestGet(DELETE, getNonGlobalUserRoleRelation().getId()), GLOBAL_USER_ROLE_PERMISSION);
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, getNonGlobalUserRoleRelation().getId()), GLOBAL_USER_ROLE_PERMISSION);
|
||||
|
||||
// @@删除admin系统管理员用户组异常
|
||||
UserRoleRelationExample example = new UserRoleRelationExample();
|
||||
@ -160,11 +158,11 @@ class GlobalUserRoleRelationControllerTest extends BaseTest {
|
||||
.andRoleIdEqualTo(ADMIN.getValue())
|
||||
.andUserIdEqualTo(ADMIN.getValue());
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example);
|
||||
assertErrorCode(this.requestGet(DELETE, userRoleRelations.get(0).getId()),
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, userRoleRelations.get(0).getId()),
|
||||
USER_ROLE_RELATION_REMOVE_ADMIN_USER_PERMISSION);
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, DELETE, addUserRoleRelation.getId());
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_USER_ROLE_UPDATE, DEFAULT_DELETE, addUserRoleRelation.getId());
|
||||
}
|
||||
|
||||
/**
|
@ -0,0 +1,129 @@
|
||||
package io.metersphere.system.controller;
|
||||
|
||||
import base.BaseTest;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.constants.PluginScenarioType;
|
||||
import io.metersphere.system.domain.Plugin;
|
||||
import io.metersphere.system.mapper.PluginMapper;
|
||||
import io.metersphere.system.request.PluginUpdateRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author jianxing
|
||||
* @date : 2023-7-14
|
||||
*/
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class PluginControllerTests extends BaseTest {
|
||||
private static final String BASE_PATH = "/plugin/";
|
||||
private static final String SCRIPT_GET = "script/get/{0}/{1}";
|
||||
@Resource
|
||||
private PluginMapper pluginMapper;
|
||||
private static Plugin addPlugin;
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return BASE_PATH;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void list() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGetWithOk(DEFAULT_LIST)
|
||||
.andReturn();
|
||||
// List<Plugin> pluginList = getResultDataArray(mvcResult, Plugin.class);
|
||||
// todo 校验数据是否正确
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_PLUGIN_READ, DEFAULT_LIST);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(0)
|
||||
public void add() throws Exception {
|
||||
// @@请求成功
|
||||
PluginUpdateRequest request = new PluginUpdateRequest();
|
||||
request.setName("test");
|
||||
request.setDescription("test desc");
|
||||
request.setScenario(PluginScenarioType.PAI.name());
|
||||
MultiValueMap<String, Object> multiValueMap = getDefaultMultiPartParam(request,
|
||||
new File("src/test/resources/application.properties"));
|
||||
MvcResult mvcResult = this.requestMultipartWithOkAndReturn(DEFAULT_ADD, multiValueMap);
|
||||
Plugin resultData = getResultData(mvcResult, Plugin.class);
|
||||
Plugin plugin = pluginMapper.selectByPrimaryKey(resultData.getId());
|
||||
this.addPlugin = plugin;
|
||||
// todo 校验请求成功数据
|
||||
// @@校验日志
|
||||
// checkLog(this.addPlugin.getId(), OperationLogType.ADD);
|
||||
// @@异常参数校验
|
||||
// createdGroupParamValidateTest(PluginUpdateRequestDefinition.class, ADD);
|
||||
// @@校验权限
|
||||
requestMultipartPermissionTest(PermissionConstants.SYSTEM_PLUGIN_ADD, DEFAULT_ADD, multiValueMap);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void get() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGetWithOk(DEFAULT_GET, this.addPlugin.getId())
|
||||
.andReturn();
|
||||
// Plugin plugin = getResultData(mvcResult, Plugin.class);
|
||||
// todo 校验数据是否正确
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_PLUGIN_READ, DEFAULT_GET, this.addPlugin.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void getScript() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGetWithOk(SCRIPT_GET, this.addPlugin.getId(), "script id")
|
||||
.andReturn();
|
||||
// Plugin plugin = getResultData(mvcResult, Plugin.class);
|
||||
// todo 校验数据是否正确
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_PLUGIN_READ, SCRIPT_GET, this.addPlugin.getId(), "script id");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void update() throws Exception {
|
||||
// @@请求成功
|
||||
PluginUpdateRequest request = new PluginUpdateRequest();
|
||||
request.setId(addPlugin.getId());
|
||||
request.setName("test update");
|
||||
|
||||
MultiValueMap<String, Object> multiValueMap = getDefaultMultiPartParam(request,
|
||||
new File("src/test/resources/application.properties"));
|
||||
this.requestMultipartWithOk(DEFAULT_UPDATE, multiValueMap);
|
||||
// 校验请求成功数据
|
||||
// Plugin plugin = pluginMapper.selectByPrimaryKey(request.getId());
|
||||
// todo 校验请求成功数据
|
||||
// @@校验日志
|
||||
// checkLog(request.getId(), OperationLogType.UPDATE);
|
||||
// @@异常参数校验
|
||||
// updatedGroupParamValidateTest(PluginUpdateRequestDefinition.class, UPDATE);
|
||||
// @@校验权限
|
||||
requestMultipartPermissionTest(PermissionConstants.SYSTEM_PLUGIN_UPDATE, DEFAULT_UPDATE, multiValueMap);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete() throws Exception {
|
||||
// @@请求成功
|
||||
this.requestGetWithOk(DEFAULT_DELETE, addPlugin.getId());
|
||||
// todo 校验请求成功数据
|
||||
// @@校验日志
|
||||
// checkLog(addPlugin.getId(), OperationLogType.DELETE);
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_PLUGIN_DELETE, DEFAULT_DELETE, addPlugin.getId());
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class SystemParameterControllerTest {
|
||||
public class SystemParameterControllerTests {
|
||||
|
||||
@Resource
|
||||
private MockMvc mockMvc;
|
@ -0,0 +1,25 @@
|
||||
package io.metersphere.system.controller.param;
|
||||
|
||||
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 PluginUpdateRequestDefinition {
|
||||
@NotBlank(message = "{plugin.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{plugin.id.length_range}", 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;
|
||||
|
||||
@Size(min = 1, max = 500, groups = {Created.class, Updated.class})
|
||||
private String description;
|
||||
|
||||
@NotBlank(groups = {Created.class})
|
||||
@Size(min = 1, max = 50, groups = {Created.class, Updated.class})
|
||||
private String scenario;
|
||||
}
|
@ -23,7 +23,7 @@ public class UserRoleUpdateRequestDefinition {
|
||||
private String name;
|
||||
|
||||
@NotBlank(groups = {Created.class})
|
||||
@EnumValue(enumClass = UserRoleType.class, groups = {Created.class})
|
||||
@EnumValue(enumClass = UserRoleType.class, groups = {Created.class, Updated.class})
|
||||
@Size(min = 1, max = 20, groups = {Created.class, Updated.class})
|
||||
private String type;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user