diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenario.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenario.java index 54225c170a..271442babb 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenario.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenario.java @@ -21,9 +21,9 @@ public class ApiScenario implements Serializable { private String name; @Schema(description = "场景级别/P0/P1等", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_scenario.level.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 10, message = "{api_scenario.level.length_range}", groups = {Created.class, Updated.class}) - private String level; + @NotBlank(message = "{api_scenario.priority.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 10, message = "{api_scenario.priority.length_range}", groups = {Created.class, Updated.class}) + private String priority; @Schema(description = "场景状态/未规划/已完成 等", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{api_scenario.status.not_blank}", groups = {Created.class}) @@ -50,7 +50,7 @@ public class ApiScenario implements Serializable { private String lastReportId; @Schema(description = "编号") - private Integer num; + private Long num; @Schema(description = "自定义id") private String customNum; @@ -78,7 +78,7 @@ public class ApiScenario implements Serializable { private String projectId; @Schema(description = "场景模块fk") - private String apiScenarioModuleId; + private String moduleId; @Schema(description = "描述信息") private String description; @@ -113,14 +113,14 @@ public class ApiScenario implements Serializable { public enum Column { id("id", "id", "VARCHAR", false), name("name", "name", "VARCHAR", true), - level("level", "level", "VARCHAR", true), + priority("priority", "priority", "VARCHAR", false), status("status", "status", "VARCHAR", true), principal("principal", "principal", "VARCHAR", false), stepTotal("step_total", "stepTotal", "INTEGER", false), passRate("pass_rate", "passRate", "BIGINT", false), lastReportStatus("last_report_status", "lastReportStatus", "VARCHAR", false), lastReportId("last_report_id", "lastReportId", "VARCHAR", false), - num("num", "num", "INTEGER", false), + num("num", "num", "BIGINT", false), customNum("custom_num", "customNum", "VARCHAR", false), deleted("deleted", "deleted", "BIT", false), pos("pos", "pos", "BIGINT", false), @@ -128,7 +128,7 @@ public class ApiScenario implements Serializable { refId("ref_id", "refId", "VARCHAR", false), latest("latest", "latest", "BIT", false), projectId("project_id", "projectId", "VARCHAR", false), - apiScenarioModuleId("api_scenario_module_id", "apiScenarioModuleId", "VARCHAR", false), + moduleId("module_id", "moduleId", "VARCHAR", false), description("description", "description", "VARCHAR", false), tags("tags", "tags", "VARCHAR", false), grouped("grouped", "grouped", "BIT", false), diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioExample.java index 7a0b4f62d2..7ea4f20f99 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioExample.java @@ -244,73 +244,73 @@ public class ApiScenarioExample { return (Criteria) this; } - public Criteria andLevelIsNull() { - addCriterion("`level` is null"); + public Criteria andPriorityIsNull() { + addCriterion("priority is null"); return (Criteria) this; } - public Criteria andLevelIsNotNull() { - addCriterion("`level` is not null"); + public Criteria andPriorityIsNotNull() { + addCriterion("priority is not null"); return (Criteria) this; } - public Criteria andLevelEqualTo(String value) { - addCriterion("`level` =", value, "level"); + public Criteria andPriorityEqualTo(String value) { + addCriterion("priority =", value, "priority"); return (Criteria) this; } - public Criteria andLevelNotEqualTo(String value) { - addCriterion("`level` <>", value, "level"); + public Criteria andPriorityNotEqualTo(String value) { + addCriterion("priority <>", value, "priority"); return (Criteria) this; } - public Criteria andLevelGreaterThan(String value) { - addCriterion("`level` >", value, "level"); + public Criteria andPriorityGreaterThan(String value) { + addCriterion("priority >", value, "priority"); return (Criteria) this; } - public Criteria andLevelGreaterThanOrEqualTo(String value) { - addCriterion("`level` >=", value, "level"); + public Criteria andPriorityGreaterThanOrEqualTo(String value) { + addCriterion("priority >=", value, "priority"); return (Criteria) this; } - public Criteria andLevelLessThan(String value) { - addCriterion("`level` <", value, "level"); + public Criteria andPriorityLessThan(String value) { + addCriterion("priority <", value, "priority"); return (Criteria) this; } - public Criteria andLevelLessThanOrEqualTo(String value) { - addCriterion("`level` <=", value, "level"); + public Criteria andPriorityLessThanOrEqualTo(String value) { + addCriterion("priority <=", value, "priority"); return (Criteria) this; } - public Criteria andLevelLike(String value) { - addCriterion("`level` like", value, "level"); + public Criteria andPriorityLike(String value) { + addCriterion("priority like", value, "priority"); return (Criteria) this; } - public Criteria andLevelNotLike(String value) { - addCriterion("`level` not like", value, "level"); + public Criteria andPriorityNotLike(String value) { + addCriterion("priority not like", value, "priority"); return (Criteria) this; } - public Criteria andLevelIn(List values) { - addCriterion("`level` in", values, "level"); + public Criteria andPriorityIn(List values) { + addCriterion("priority in", values, "priority"); return (Criteria) this; } - public Criteria andLevelNotIn(List values) { - addCriterion("`level` not in", values, "level"); + public Criteria andPriorityNotIn(List values) { + addCriterion("priority not in", values, "priority"); return (Criteria) this; } - public Criteria andLevelBetween(String value1, String value2) { - addCriterion("`level` between", value1, value2, "level"); + public Criteria andPriorityBetween(String value1, String value2) { + addCriterion("priority between", value1, value2, "priority"); return (Criteria) this; } - public Criteria andLevelNotBetween(String value1, String value2) { - addCriterion("`level` not between", value1, value2, "level"); + public Criteria andPriorityNotBetween(String value1, String value2) { + addCriterion("priority not between", value1, value2, "priority"); return (Criteria) this; } @@ -724,52 +724,52 @@ public class ApiScenarioExample { return (Criteria) this; } - public Criteria andNumEqualTo(Integer value) { + public Criteria andNumEqualTo(Long value) { addCriterion("num =", value, "num"); return (Criteria) this; } - public Criteria andNumNotEqualTo(Integer value) { + public Criteria andNumNotEqualTo(Long value) { addCriterion("num <>", value, "num"); return (Criteria) this; } - public Criteria andNumGreaterThan(Integer value) { + public Criteria andNumGreaterThan(Long value) { addCriterion("num >", value, "num"); return (Criteria) this; } - public Criteria andNumGreaterThanOrEqualTo(Integer value) { + public Criteria andNumGreaterThanOrEqualTo(Long value) { addCriterion("num >=", value, "num"); return (Criteria) this; } - public Criteria andNumLessThan(Integer value) { + public Criteria andNumLessThan(Long value) { addCriterion("num <", value, "num"); return (Criteria) this; } - public Criteria andNumLessThanOrEqualTo(Integer value) { + public Criteria andNumLessThanOrEqualTo(Long value) { addCriterion("num <=", value, "num"); return (Criteria) this; } - public Criteria andNumIn(List values) { + public Criteria andNumIn(List values) { addCriterion("num in", values, "num"); return (Criteria) this; } - public Criteria andNumNotIn(List values) { + public Criteria andNumNotIn(List values) { addCriterion("num not in", values, "num"); return (Criteria) this; } - public Criteria andNumBetween(Integer value1, Integer value2) { + public Criteria andNumBetween(Long value1, Long value2) { addCriterion("num between", value1, value2, "num"); return (Criteria) this; } - public Criteria andNumNotBetween(Integer value1, Integer value2) { + public Criteria andNumNotBetween(Long value1, Long value2) { addCriterion("num not between", value1, value2, "num"); return (Criteria) this; } @@ -1234,73 +1234,73 @@ public class ApiScenarioExample { return (Criteria) this; } - public Criteria andApiScenarioModuleIdIsNull() { - addCriterion("api_scenario_module_id is null"); + public Criteria andModuleIdIsNull() { + addCriterion("module_id is null"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdIsNotNull() { - addCriterion("api_scenario_module_id is not null"); + public Criteria andModuleIdIsNotNull() { + addCriterion("module_id is not null"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdEqualTo(String value) { - addCriterion("api_scenario_module_id =", value, "apiScenarioModuleId"); + public Criteria andModuleIdEqualTo(String value) { + addCriterion("module_id =", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdNotEqualTo(String value) { - addCriterion("api_scenario_module_id <>", value, "apiScenarioModuleId"); + public Criteria andModuleIdNotEqualTo(String value) { + addCriterion("module_id <>", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdGreaterThan(String value) { - addCriterion("api_scenario_module_id >", value, "apiScenarioModuleId"); + public Criteria andModuleIdGreaterThan(String value) { + addCriterion("module_id >", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdGreaterThanOrEqualTo(String value) { - addCriterion("api_scenario_module_id >=", value, "apiScenarioModuleId"); + public Criteria andModuleIdGreaterThanOrEqualTo(String value) { + addCriterion("module_id >=", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdLessThan(String value) { - addCriterion("api_scenario_module_id <", value, "apiScenarioModuleId"); + public Criteria andModuleIdLessThan(String value) { + addCriterion("module_id <", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdLessThanOrEqualTo(String value) { - addCriterion("api_scenario_module_id <=", value, "apiScenarioModuleId"); + public Criteria andModuleIdLessThanOrEqualTo(String value) { + addCriterion("module_id <=", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdLike(String value) { - addCriterion("api_scenario_module_id like", value, "apiScenarioModuleId"); + public Criteria andModuleIdLike(String value) { + addCriterion("module_id like", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdNotLike(String value) { - addCriterion("api_scenario_module_id not like", value, "apiScenarioModuleId"); + public Criteria andModuleIdNotLike(String value) { + addCriterion("module_id not like", value, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdIn(List values) { - addCriterion("api_scenario_module_id in", values, "apiScenarioModuleId"); + public Criteria andModuleIdIn(List values) { + addCriterion("module_id in", values, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdNotIn(List values) { - addCriterion("api_scenario_module_id not in", values, "apiScenarioModuleId"); + public Criteria andModuleIdNotIn(List values) { + addCriterion("module_id not in", values, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdBetween(String value1, String value2) { - addCriterion("api_scenario_module_id between", value1, value2, "apiScenarioModuleId"); + public Criteria andModuleIdBetween(String value1, String value2) { + addCriterion("module_id between", value1, value2, "moduleId"); return (Criteria) this; } - public Criteria andApiScenarioModuleIdNotBetween(String value1, String value2) { - addCriterion("api_scenario_module_id not between", value1, value2, "apiScenarioModuleId"); + public Criteria andModuleIdNotBetween(String value1, String value2) { + addCriterion("module_id not between", value1, value2, "moduleId"); return (Criteria) this; } diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModule.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModule.java index 86a8df2e74..45de0e0b22 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModule.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModule.java @@ -20,13 +20,9 @@ public class ApiScenarioModule implements Serializable { @Size(min = 1, max = 255, message = "{api_scenario_module.name.length_range}", groups = {Created.class, Updated.class}) private String name; - @Schema(description = "模块级别", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_scenario_module.level.not_blank}", groups = {Created.class}) - private Integer level; - @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "{api_scenario_module.pos.not_blank}", groups = {Created.class}) - private Integer pos; + private Long pos; @Schema(description = "创建时间") private Long createTime; @@ -55,8 +51,7 @@ public class ApiScenarioModule implements Serializable { public enum Column { id("id", "id", "VARCHAR", false), name("name", "name", "VARCHAR", true), - level("level", "level", "INTEGER", true), - pos("pos", "pos", "INTEGER", false), + pos("pos", "pos", "BIGINT", false), createTime("create_time", "createTime", "BIGINT", false), updateTime("update_time", "updateTime", "BIGINT", false), updateUser("update_user", "updateUser", "VARCHAR", false), diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModuleExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModuleExample.java index bfa27b6746..5c7955a16f 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModuleExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioModuleExample.java @@ -244,66 +244,6 @@ public class ApiScenarioModuleExample { return (Criteria) this; } - public Criteria andLevelIsNull() { - addCriterion("`level` is null"); - return (Criteria) this; - } - - public Criteria andLevelIsNotNull() { - addCriterion("`level` is not null"); - return (Criteria) this; - } - - public Criteria andLevelEqualTo(Integer value) { - addCriterion("`level` =", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelNotEqualTo(Integer value) { - addCriterion("`level` <>", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelGreaterThan(Integer value) { - addCriterion("`level` >", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelGreaterThanOrEqualTo(Integer value) { - addCriterion("`level` >=", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelLessThan(Integer value) { - addCriterion("`level` <", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelLessThanOrEqualTo(Integer value) { - addCriterion("`level` <=", value, "level"); - return (Criteria) this; - } - - public Criteria andLevelIn(List values) { - addCriterion("`level` in", values, "level"); - return (Criteria) this; - } - - public Criteria andLevelNotIn(List values) { - addCriterion("`level` not in", values, "level"); - return (Criteria) this; - } - - public Criteria andLevelBetween(Integer value1, Integer value2) { - addCriterion("`level` between", value1, value2, "level"); - return (Criteria) this; - } - - public Criteria andLevelNotBetween(Integer value1, Integer value2) { - addCriterion("`level` not between", value1, value2, "level"); - return (Criteria) this; - } - public Criteria andPosIsNull() { addCriterion("pos is null"); return (Criteria) this; @@ -314,52 +254,52 @@ public class ApiScenarioModuleExample { return (Criteria) this; } - public Criteria andPosEqualTo(Integer value) { + public Criteria andPosEqualTo(Long value) { addCriterion("pos =", value, "pos"); return (Criteria) this; } - public Criteria andPosNotEqualTo(Integer value) { + public Criteria andPosNotEqualTo(Long value) { addCriterion("pos <>", value, "pos"); return (Criteria) this; } - public Criteria andPosGreaterThan(Integer value) { + public Criteria andPosGreaterThan(Long value) { addCriterion("pos >", value, "pos"); return (Criteria) this; } - public Criteria andPosGreaterThanOrEqualTo(Integer value) { + public Criteria andPosGreaterThanOrEqualTo(Long value) { addCriterion("pos >=", value, "pos"); return (Criteria) this; } - public Criteria andPosLessThan(Integer value) { + public Criteria andPosLessThan(Long value) { addCriterion("pos <", value, "pos"); return (Criteria) this; } - public Criteria andPosLessThanOrEqualTo(Integer value) { + public Criteria andPosLessThanOrEqualTo(Long value) { addCriterion("pos <=", value, "pos"); return (Criteria) this; } - public Criteria andPosIn(List values) { + public Criteria andPosIn(List values) { addCriterion("pos in", values, "pos"); return (Criteria) this; } - public Criteria andPosNotIn(List values) { + public Criteria andPosNotIn(List values) { addCriterion("pos not in", values, "pos"); return (Criteria) this; } - public Criteria andPosBetween(Integer value1, Integer value2) { + public Criteria andPosBetween(Long value1, Long value2) { addCriterion("pos between", value1, value2, "pos"); return (Criteria) this; } - public Criteria andPosNotBetween(Integer value1, Integer value2) { + public Criteria andPosNotBetween(Long value1, Long value2) { addCriterion("pos not between", value1, value2, "pos"); return (Criteria) this; } diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioMapper.xml index 721e584824..f55050cc57 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioMapper.xml @@ -4,14 +4,14 @@ - + - + @@ -19,7 +19,7 @@ - + @@ -89,10 +89,10 @@ - id, `name`, `level`, `status`, principal, step_total, pass_rate, last_report_status, + id, `name`, priority, `status`, principal, step_total, pass_rate, last_report_status, last_report_id, num, custom_num, deleted, pos, version_id, ref_id, latest, project_id, - api_scenario_module_id, description, tags, grouped, create_user, create_time, delete_time, - delete_user, update_user, update_time + module_id, description, tags, grouped, create_user, create_time, delete_time, delete_user, + update_user, update_time @@ -106,14 +105,14 @@ - insert into api_scenario_module (id, `name`, `level`, - pos, create_time, update_time, - update_user, create_user, project_id, - parent_id) - values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, - #{pos,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{updateUser,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, - #{parentId,jdbcType=VARCHAR}) + insert into api_scenario_module (id, `name`, pos, + create_time, update_time, update_user, + create_user, project_id, parent_id + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, + #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, + #{createUser,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR} + ) insert into api_scenario_module @@ -124,9 +123,6 @@ `name`, - - `level`, - pos, @@ -156,11 +152,8 @@ #{name,jdbcType=VARCHAR}, - - #{level,jdbcType=INTEGER}, - - #{pos,jdbcType=INTEGER}, + #{pos,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, @@ -197,11 +190,8 @@ `name` = #{record.name,jdbcType=VARCHAR}, - - `level` = #{record.level,jdbcType=INTEGER}, - - pos = #{record.pos,jdbcType=INTEGER}, + pos = #{record.pos,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT}, @@ -230,8 +220,7 @@ update api_scenario_module set id = #{record.id,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR}, - `level` = #{record.level,jdbcType=INTEGER}, - pos = #{record.pos,jdbcType=INTEGER}, + pos = #{record.pos,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, update_user = #{record.updateUser,jdbcType=VARCHAR}, @@ -248,11 +237,8 @@ `name` = #{name,jdbcType=VARCHAR}, - - `level` = #{level,jdbcType=INTEGER}, - - pos = #{pos,jdbcType=INTEGER}, + pos = #{pos,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT}, @@ -278,8 +264,7 @@ update api_scenario_module set `name` = #{name,jdbcType=VARCHAR}, - `level` = #{level,jdbcType=INTEGER}, - pos = #{pos,jdbcType=INTEGER}, + pos = #{pos,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, update_user = #{updateUser,jdbcType=VARCHAR}, @@ -290,14 +275,14 @@ insert into api_scenario_module - (id, `name`, `level`, pos, create_time, update_time, update_user, create_user, project_id, + (id, `name`, pos, create_time, update_time, update_user, create_user, project_id, parent_id) values - (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.level,jdbcType=INTEGER}, - #{item.pos,jdbcType=INTEGER}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, - #{item.updateUser,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, - #{item.parentId,jdbcType=VARCHAR}) + (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, + #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, + #{item.createUser,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.parentId,jdbcType=VARCHAR} + ) @@ -316,11 +301,8 @@ #{item.name,jdbcType=VARCHAR} - - #{item.level,jdbcType=INTEGER} - - #{item.pos,jdbcType=INTEGER} + #{item.pos,jdbcType=BIGINT} #{item.createTime,jdbcType=BIGINT} diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql index 8da336fea5..14285963d1 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql @@ -161,7 +161,7 @@ CREATE UNIQUE INDEX uq_name_project_parent_type ON api_definition_module (projec CREATE TABLE IF NOT EXISTS api_scenario( `id` VARCHAR(50) NOT NULL COMMENT '' , `name` VARCHAR(255) NOT NULL COMMENT '场景名称' , - `level` VARCHAR(10) NOT NULL COMMENT '场景级别/P0/P1等' , + `priority` VARCHAR(10) NOT NULL COMMENT '场景级别/P0/P1等' , `status` VARCHAR(20) NOT NULL COMMENT '场景状态/未规划/已完成 等' , `principal` VARCHAR(50) NOT NULL COMMENT '责任人/用户fk' , `step_total` INT NOT NULL DEFAULT 0 COMMENT '场景步骤总数' , @@ -176,7 +176,7 @@ CREATE TABLE IF NOT EXISTS api_scenario( `ref_id` VARCHAR(50) COMMENT '引用资源fk' , `latest` BIT(1) DEFAULT 0 COMMENT '是否为最新版本 0:否,1:是' , `project_id` VARCHAR(50) NOT NULL COMMENT '项目fk' , - `api_scenario_module_id` VARCHAR(50) COMMENT '场景模块fk' , + `module_id` VARCHAR(50) COMMENT '场景模块fk' , `description` VARCHAR(500) COMMENT '描述信息' , `tags` VARCHAR(1000) COMMENT '标签' , `grouped` BIT(1) NOT NULL DEFAULT 0 COMMENT '是否为环境组' , @@ -192,7 +192,7 @@ CREATE TABLE IF NOT EXISTS api_scenario( COLLATE = utf8mb4_general_ci COMMENT = '场景'; -CREATE INDEX idx_api_scenario_module_id ON api_scenario(api_scenario_module_id); +CREATE INDEX idx_module_id ON api_scenario(module_id); CREATE INDEX idx_ref_id ON api_scenario(ref_id); CREATE INDEX idx_version_id ON api_scenario(version_id); CREATE INDEX idx_project_id ON api_scenario(project_id); @@ -202,7 +202,7 @@ CREATE INDEX idx_create_time ON api_scenario(create_time desc); CREATE INDEX idx_update_time ON api_scenario(update_time desc); CREATE INDEX idx_create_user ON api_scenario(create_user); CREATE INDEX idx_num ON api_scenario(num); -CREATE INDEX idx_level ON api_scenario(level); +CREATE INDEX idx_priority ON api_scenario(priority); CREATE INDEX idx_name ON api_scenario(name); CREATE TABLE IF NOT EXISTS api_scenario_follower( @@ -219,8 +219,7 @@ CREATE INDEX uk_api_scenario_id_follow_id ON api_scenario_follower(api_scenario_ CREATE TABLE IF NOT EXISTS api_scenario_module( `id` VARCHAR(50) NOT NULL COMMENT '场景模块pk' , `name` VARCHAR(255) NOT NULL COMMENT '模块名称' , - `level` INT NOT NULL DEFAULT 1 COMMENT '模块级别' , - `pos` INT NOT NULL COMMENT '排序' , + `pos` BIGINT NOT NULL COMMENT '排序' , `create_time` BIGINT NOT NULL COMMENT '创建时间' , `update_time` BIGINT NOT NULL COMMENT '更新时间' , `update_user` VARCHAR(50) NOT NULL COMMENT '更新人' , @@ -234,6 +233,9 @@ CREATE TABLE IF NOT EXISTS api_scenario_module( CREATE INDEX idx_project_id ON api_scenario_module(project_id); +CREATE INDEX idx_pos ON api_scenario_module(pos); +CREATE UNIQUE INDEX uq_name_project_parent_type ON api_scenario_module (project_id, name, parent_id); + CREATE TABLE IF NOT EXISTS api_scenario_reference( `id` VARCHAR(50) NOT NULL COMMENT '引用关系pk' , diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql index 87e7a423fd..ca4bfe350d 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql @@ -152,11 +152,29 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION:READ+IMPORT'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION:READ+EXPORT'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION:READ+DEBUG'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+UPDATE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+DELETE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_MOCK:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_MOCK:READ+ADD'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_MOCK:READ+UPDATE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_MOCK:READ+DELETE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_MOCK:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+ADD'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+UPDATE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+DELETE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+IMPORT'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+EXPORT'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_SCENARIO:READ+DEBUG'); + INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+UPDATE'); @@ -237,11 +255,29 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION:READ+IMPORT'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION:READ+EXPORT'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION:READ+DEBUG'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+UPDATE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+DELETE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_MOCK:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_MOCK:READ+ADD'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_MOCK:READ+UPDATE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_MOCK:READ+DELETE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_MOCK:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+ADD'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+UPDATE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+DELETE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+EXECUTE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+RECOVER'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+IMPORT'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+EXPORT'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_SCENARIO:READ+DEBUG'); + INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+UPDATE'); diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index 0fa1f3ed39..bb7916c06d 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -254,6 +254,7 @@ public class PermissionConstants { public static final String PROJECT_API_DEFINITION_IMPORT = "PROJECT_API_DEFINITION:READ+IMPORT"; public static final String PROJECT_API_DEFINITION_EXPORT = "PROJECT_API_DEFINITION:READ+EXPORT"; public static final String PROJECT_API_DEFINITION_EXECUTE = "PROJECT_API_DEFINITION:READ+EXECUTE"; + public static final String PROJECT_API_DEFINITION_DEBUG = "PROJECT_API_DEFINITION:READ+DEBUG"; public static final String PROJECT_API_DEFINITION_CASE_READ = "PROJECT_API_DEFINITION_CASE:READ"; public static final String PROJECT_API_DEFINITION_CASE_ADD = "PROJECT_API_DEFINITION_CASE:READ+ADD"; public static final String PROJECT_API_DEFINITION_CASE_UPDATE = "PROJECT_API_DEFINITION_CASE:READ+UPDATE"; @@ -266,6 +267,18 @@ public class PermissionConstants { public static final String PROJECT_API_DEFINITION_MOCK_UPDATE = "PROJECT_API_DEFINITION_MOCK:READ+UPDATE"; public static final String PROJECT_API_DEFINITION_MOCK_DELETE = "PROJECT_API_DEFINITION_MOCK:READ+DELETE"; public static final String PROJECT_API_DEFINITION_MOCK_EXECUTE = "PROJECT_API_DEFINITION_MOCK:READ+EXECUTE"; + /* ----API_SCENARIO---- */ + public static final String PROJECT_API_SCENARIO_READ = "PROJECT_API_SCENARIO:READ"; + public static final String PROJECT_API_SCENARIO_ADD = "PROJECT_API_SCENARIO:READ+ADD"; + public static final String PROJECT_API_SCENARIO_UPDATE = "PROJECT_API_SCENARIO:READ+UPDATE"; + public static final String PROJECT_API_SCENARIO_DELETE = "PROJECT_API_SCENARIO:READ+DELETE"; + public static final String PROJECT_API_SCENARIO_EXECUTE = "PROJECT_API_SCENARIO:READ+EXECUTE"; + public static final String PROJECT_API_SCENARIO_IMPORT = "PROJECT_API_SCENARIO:READ+IMPORT"; + public static final String PROJECT_API_SCENARIO_EXPORT = "PROJECT_API_SCENARIO:READ+EXPORT"; + public static final String PROJECT_API_SCENARIO_DEBUG = "PROJECT_API_SCENARIO:READ+DEBUG"; + + + /*------ end: API_MANAGEMENT ------*/ //个人中心 diff --git a/backend/framework/sdk/src/main/resources/i18n/api.properties b/backend/framework/sdk/src/main/resources/i18n/api.properties index 5f4c9c2555..9745d4aa6c 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api.properties @@ -286,18 +286,15 @@ api_debug_module.pos.not_blank=模块位置不能为空 api_debug_module.name.not_contain_slash=模块名称不能包含斜杠 api_debug_module.unplanned_request=未规划请求 api_unplanned_request=未规划接口 - +api_unplanned_scenario=未规划场景 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 api_environment_config.environment_id.not_blank=环境ID不能为空 - #module:ApiDefinitionCustomField api_definition_custom_field.api_id.not_blank=接口ID不能为空 api_definition_custom_field.field_id.not_blank=自定义字段ID不能为空 - api_module.not.exist=模块不存在 - permission.api.name=接口测试 permission.api_mock.name=接口 MOCK api_debug_exist=接口已存在 @@ -305,6 +302,5 @@ follow=关注 unfollow=取消关注 api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 - execute_resource_pool_not_config_error=请在【项目管理-应用管理-接口测试】中选择资源池 resource_pool_execute_error=资源池调用失败 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties index 7f3bab5804..a002ef8821 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties @@ -262,7 +262,6 @@ api_scenario_report_detail.resource_id.length_range=Each step in the scenario re api_scenario_report_detail.resource_id.not_blank=The unique identifier requested by each step in the scenario cannot be empty #module:ApiDefinitionBlob api_definition_blob.api_definition_id.not_blank=The interface fk/one-to-one relationship cannot be empty - #module: ApiDebug api_debug.id.not_blank=ID cannot be blank api_debug.id.length_range=The interface ID length must be between 1-50 @@ -278,7 +277,6 @@ api_debug.create_user.not_blank=The creator cannot be empty api_debug.create_user.length_range=Creator length must be between {min}-{max} api_debug.update_user.not_blank=Modifier cannot be blank api_debug.update_user.length_range=Modifier length must be between {min}-{max} - #module: ApiDebugModule api_debug_module.id.not_blank=ID cannot be blank api_debug_module.id.length_range=Module ID length must be between 1-50 @@ -292,18 +290,15 @@ api_debug_module.pos.not_blank=Module position cannot be blank api_debug_module.name.not_contain_slash=Module name cannot contain slashes api_debug_module.unplanned_request=Unplanned request api_unplanned_request=Unplanned Api - +api_unplanned_scenario=Unplanned scenario #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID cannot be blank api_environment_config.environment_id.length_range=Environment ID length must be between 1-50 api_environment_config.environment_id.not_blank=Environment ID cannot be blank - #module:ApiDefinitionCustomField api_definition_custom_field.api_id.not_blank=Interface pk cannot be empty api_definition_custom_field.field_id.not_blank=Field ID cannot be empty - api_module.not.exist=The module does not exist - permission.api.name=API Test permission.api_mock.name=API MOCK api_debug_exist=The API already exists @@ -311,6 +306,5 @@ follow=Follow unfollow=Unfollow api_definition_exist=The API already exists api_definition_mock_exist=The API MOCK already exists - execute_resource_pool_not_config_error=Select a resource pool in 【Project Management - Application Management - Interface Testing】 resource_pool_execute_error=The resource pool call failed diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties index f078241ca1..2e5f1cce59 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties @@ -262,7 +262,6 @@ api_scenario_report_detail.resource_id.length_range=场景中各个步骤请求 api_scenario_report_detail.resource_id.not_blank=场景中各个步骤请求唯一标识不能为空 #module:ApiDefinitionBlob api_definition_blob.api_definition_id.not_blank=接口ID/ 一对一关系不能为空 - #module: ApiDebug api_debug.id.not_blank=ID不能为空 api_debug.id.length_range=接口ID长度必须在1-50之间 @@ -278,7 +277,6 @@ api_debug.create_user.not_blank=创建人不能为空 api_debug.create_user.length_range=创建人长度必须在{min}和{max}之间 api_debug.update_user.not_blank=修改人不能为空 api_debug.update_user.length_range=修改人长度必须在{min}和{max}之间 - #module: ApiDebugModule api_debug_module.id.not_blank=ID不能为空 api_debug_module.id.length_range=模块ID长度必须在1-50之间 @@ -292,18 +290,15 @@ api_debug_module.pos.not_blank=模块位置不能为空 api_debug_module.name.not_contain_slash=名称中不能包含正反斜杠 api_debug_module.unplanned_request=未规划请求 api_unplanned_request=未规划接口 - +api_unplanned_scenario=未规划场景 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 api_environment_config.environment_id.not_blank=环境ID不能为空 - #module:ApiDefinitionCustomField api_definition_custom_field.api_id.not_blank=接口ID不能为空 api_definition_custom_field.field_id.not_blank=自定义字段ID不能为空 - api_module.not.exist=模块不存在 - permission.api.name=接口测试 permission.api_mock.name=接口 MOCK api_debug_exist=接口已存在 @@ -311,6 +306,5 @@ follow=关注 unfollow=取消关注 api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 - execute_resource_pool_not_config_error=请在【项目管理-应用管理-接口测试】中选择资源池 resource_pool_execute_error=资源池调用失败 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties index 852c3c3797..3760d3a70e 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties @@ -262,7 +262,6 @@ api_scenario_report_detail.resource_id.length_range=場景中各個步驟請求 api_scenario_report_detail.resource_id.not_blank=場景中各個步驟請求唯一標識不能為空 #module:ApiDefinitionBlob api_definition_blob.api_definition_id.not_blank=接口ID/ 一對一關繫不能為空 - #module: ApiDebug api_debug.id.not_blank=ID不能為空 api_debug.id.length_range=接口ID長度必須在1-50之間 @@ -278,7 +277,6 @@ api_debug.create_user.not_blank=創建人不能為空 api_debug.create_user.length_range=創建人長度必須在{min}和{max}之間 api_debug.update_user.not_blank=修改人不能為空 api_debug.update_user.length_range=修改人長度必須在{min}和{max}之間 - #module: ApiDebugModule api_debug_module.id.not_blank=ID不能為空 api_debug_module.id.length_range=模塊ID長度必須在1-50之間 @@ -291,19 +289,16 @@ api_debug_module.project_id.length_range=項目ID長度必須在1-50之間 api_debug_module.pos.not_blank=模塊位置不能為空 api_debug_module.name.not_contain_slash=模塊名稱不能包含斜線 api_debug_module.unplanned_request=未規劃請求 -api_unplanned_request=未规划接口 - +api_unplanned_request=未規劃請求 +api_unplanned_scenario=未規劃場景 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能為空 api_environment_config.environment_id.length_range=環境ID長度必須在1-50之間 api_environment_config.environment_id.not_blank=環境ID不能為空 - #module:ApiDefinitionCustomField api_definition_custom_field.api_id.not_blank=接口ID不能為空 api_definition_custom_field.field_id.not_blank=自定義字段ID不能爲空 - api_module.not.exist=模塊不存在 - permission.api.name=接口測試 permission.api_mock.name=接口 MOCK api_debug_exist=接口已存在 @@ -311,6 +306,5 @@ follow=关注 unfollow=取消关注 api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 - execute_resource_pool_not_config_error=請在【項目管理-應用管理-接口測試】中選擇資源池 resource_pool_execute_error=資源池調用失敗 diff --git a/backend/framework/sdk/src/main/resources/i18n/commons.properties b/backend/framework/sdk/src/main/resources/i18n/commons.properties index 5cdf173bce..307b223193 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons.properties @@ -440,6 +440,7 @@ permission.import=导入 permission.recover=恢复 permission.export=导出 permission.execute=执行 +permission.debug=调试 file_name_illegal_error=文件名不合法 plugin_enable_error=插件未启用 diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties index a33a1abefb..a50314d9b4 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties @@ -443,6 +443,7 @@ permission.import=Import permission.recover=Recover permission.export=Export permission.execute=Execute +permission.debug=Debug file_name_illegal_error=File name is illegal plugin_enable_error=Plugin is not enabled diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties index 1bf69e43d7..4488f98c88 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties @@ -441,6 +441,7 @@ permission.import=导入 permission.recover=恢复 permission.export=导出 permission.execute=执行 +permission.debug=调试 file_name_illegal_error=文件名不合法 plugin_enable_error=插件未启用 diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties index 59fab8b662..5a06889233 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties @@ -439,6 +439,7 @@ permission.import=導入 permission.recover=恢復 permission.export=導出 permission.execute=執行 +permission.debug=調試 file_name_illegal_error=文件名不合法 plugin_enable_error=插件未啟用 diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionModuleController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionModuleController.java index a658cb877d..886c76ebc7 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionModuleController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionModuleController.java @@ -54,7 +54,7 @@ public class ApiDefinitionModuleController { @GetMapping("/delete/{id}") @Operation(summary = "接口测试-接口管理-模块-删除模块") @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) - @CheckOwner(resourceId = "#=id", resourceType = "api_definition_module") + @CheckOwner(resourceId = "#id", resourceType = "api_definition_module") public void deleteNode(@PathVariable String id) { apiDefinitionModuleService.deleteModule(id, SessionUtils.getUserId()); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioModuleController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioModuleController.java new file mode 100644 index 0000000000..3745435b59 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioModuleController.java @@ -0,0 +1,93 @@ +package io.metersphere.api.controller.scenario; + +import io.metersphere.api.dto.debug.ModuleCreateRequest; +import io.metersphere.api.dto.debug.ModuleUpdateRequest; +import io.metersphere.api.dto.definition.ApiModuleRequest; +import io.metersphere.api.dto.definition.ApiScenarioModuleRequest; +import io.metersphere.api.service.scenario.ApiScenarioModuleService; +import io.metersphere.sdk.constants.PermissionConstants; +import io.metersphere.system.dto.sdk.BaseTreeNode; +import io.metersphere.system.dto.sdk.request.NodeMoveRequest; +import io.metersphere.system.security.CheckOwner; +import io.metersphere.system.utils.SessionUtils; +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 java.util.List; +import java.util.Map; + +@Tag(name = "接口测试-接口场景-模块") +@RestController +@RequestMapping("/api/scenario/module") +public class ApiScenarioModuleController { + + @Resource + private ApiScenarioModuleService apiScenarioModuleService; + + @PostMapping("/tree") + @Operation(summary = "接口测试-接口场景-模块-查找模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ) + @CheckOwner(resourceId = "#request.projectId", resourceType = "project") + public List getTree(@RequestBody @Validated ApiScenarioModuleRequest request) { + return apiScenarioModuleService.getTree(request); + } + + @PostMapping("/add") + @Operation(summary = "接口测试-接口场景-模块-添加模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_ADD) + public String add(@RequestBody @Validated ModuleCreateRequest request) { + return apiScenarioModuleService.add(request, SessionUtils.getUserId()); + } + + @PostMapping("/update") + @Operation(summary = "接口测试-接口场景-模块-修改模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_UPDATE) + @CheckOwner(resourceId = "#request.id", resourceType = "api_scenario_module") + public boolean update(@RequestBody @Validated ModuleUpdateRequest request) { + apiScenarioModuleService.update(request, SessionUtils.getUserId()); + return true; + } + + @GetMapping("/delete/{id}") + @Operation(summary = "接口测试-接口场景-模块-删除模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_DELETE) + @CheckOwner(resourceId = "#id", resourceType = "api_scenario_module") + public void deleteNode(@PathVariable String id) { + apiScenarioModuleService.deleteModule(id, SessionUtils.getUserId()); + } + + @PostMapping("/move") + @Operation(summary = "接口测试-接口场景-模块-移动模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_UPDATE) + public void moveNode(@Validated @RequestBody NodeMoveRequest request) { + apiScenarioModuleService.moveNode(request, SessionUtils.getUserId()); + } + + @PostMapping("/count") + @Operation(summary = "接口测试-接口场景-模块-统计模块数量") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ) + @CheckOwner(resourceId = "#request.projectId", resourceType = "project") + public Map moduleCount(@Validated @RequestBody ApiScenarioModuleRequest request) { + return apiScenarioModuleService.moduleCount(request, false); + } + + @PostMapping("/trash/count") + @Operation(summary = "接口测试-接口场景-模块-统计回收站模块数量") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ) + @CheckOwner(resourceId = "#request.projectId", resourceType = "project") + public Map moduleCountTrash(@Validated @RequestBody ApiScenarioModuleRequest request) { + return apiScenarioModuleService.moduleCount(request, true); + } + + @PostMapping("/trash/tree") + @Operation(summary = "接口测试-接口场景-模块-查找模块") + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ) + @CheckOwner(resourceId = "#request.projectId", resourceType = "project") + public List getTrashTree(@RequestBody @Validated ApiModuleRequest request) { + return apiScenarioModuleService.getTrashTree(request); + } +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java index 9d1728f6d1..a702b4feb5 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java @@ -1,6 +1,7 @@ package io.metersphere.api.dto.definition; import io.metersphere.sdk.constants.ModuleConstants; +import io.metersphere.system.dto.sdk.BaseCondition; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; @@ -9,7 +10,7 @@ import lombok.Data; import java.util.List; @Data -public class ApiModuleRequest { +public class ApiModuleRequest extends BaseCondition { @Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)") private List<@NotBlank String> moduleIds; @@ -24,4 +25,10 @@ public class ApiModuleRequest { @Schema(description = "关键字") private String keyword; + + @Schema(description = "版本fk") + private String versionId; + + @Schema(description = "版本引用fk") + private String refId; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiScenarioModuleRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiScenarioModuleRequest.java new file mode 100644 index 0000000000..34cdf21d33 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiScenarioModuleRequest.java @@ -0,0 +1,26 @@ +package io.metersphere.api.dto.definition; + +import io.metersphere.system.dto.sdk.BaseCondition; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.util.List; + +@Data +public class ApiScenarioModuleRequest extends BaseCondition { + @Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)") + private List<@NotBlank String> moduleIds; + @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_definition_module.project_id.not_blank}") + private String projectId; + + @Schema(description = "关键字") + private String keyword; + + @Schema(description = "版本fk") + private String versionId; + + @Schema(description = "版本引用fk") + private String refId; +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java index 288bf50f2f..8aa429c161 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java @@ -43,5 +43,7 @@ public interface ExtApiDefinitionMapper { List importList(@Param("request") ApiDefinitionPageRequest request); - List selectIdsByIdsAndDeleted(@Param("ids")List ids, @Param("deleted") boolean deleted); + List selectIdsByIdsAndDeleted(@Param("ids") List ids, @Param("deleted") boolean deleted); + + List selectByProjectId(@Param("projectId") String projectId); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml index 39925a20f0..6cb1b45aa6 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml @@ -147,6 +147,10 @@ and deleted = #{deleted} + update api_definition diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java index cc5573e334..d04e1e37fa 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java @@ -10,4 +10,5 @@ public interface ExtApiDefinitionMockMapper { List list(@Param("request") ApiDefinitionMockPageRequest request); + List getIdsByApiIds(@Param("ids") List ids); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml index 1c79832644..de47828cde 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml @@ -11,6 +11,15 @@ where m.api_definition_id = #{request.apiDefinitionId} + diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml index 8e0306b278..6dd6843077 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml @@ -44,13 +44,15 @@ method, protocol FROM api_definition - + where api_definition.deleted = #{deleted} + ORDER BY update_time DESC + SELECT m.id, + m.parent_id AS parentId + FROM api_scenario_module m + + ORDER BY pos + + + + DELETE + FROM api_scenario_module + WHERE id IN + + #{id} + + + + update api_scenario + set delete_user = #{userId},delete_time = #{time}, deleted = 1 , module_id = 'root' + where ref_id in + + #{v} + + + + + + + + + + + + + + + + + and ( + api_scenario.num like concat('%', #{request.keyword},'%') + or api_scenario.name like concat('%', #{request.keyword},'%') + or api_scenario.tags like JSON_CONTAINS(tags, concat('["',#{request.keyword},'"]')) + ) + + + and api_scenario.project_id = #{request.projectId} + + + and api_scenario.module_id in + + #{nodeId} + + + + + + + + + + + + + + + + + + + + + + and ${versionTable}.version_id = #{request.versionId} + + + and ${versionTable}.ref_id = #{request.refId} + + + AND ${versionTable}.latest = 1 + + + + + and api_scenario.name + + + + + + + and api_scenario.num + + + + + + + and api_scenario.update_time + + + + + + + and api_scenario.create_time + + + + + + + and api_scenario.status + + + + + + + and (api_scenario.tags is null or api_scenario.tags + + + + ) + + + + and api_scenario.tags + + + + + + + + + + + + + + + and api_scenario.status in + + + + and api_scenario.create_user in + + + + and api_scenario.version_id in + + + + and api_scenario.level in + + + + and api_scenario.principal in + + + + and api_scenario.update_user in + + + + + + + + + + + + + AND m.project_id = #{request.projectId} + + + AND m.name like CONCAT('%', #{request.keyword},'%') + + + AND m.id IN + + #{item} + + + + + + + \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java index 455d855524..6abb395eed 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java @@ -40,7 +40,9 @@ public interface ExtApiTestCaseMapper { List selectIdsByCaseIds(@Param("ids") List ids); - List getCaseIds(@Param("ids")List ids, @Param("deleted")boolean deleted); + List getCaseIds(@Param("ids") List ids, @Param("deleted") boolean deleted); + + List getIdsByApiIds(@Param("ids") List ids); List listByProviderRequest(@Param("table") String resourceType, @Param("sourceName") String sourceName, @Param("apiCaseColumnName") String apiCaseColumnName,@Param("request") ApiTestCasePageProviderRequest request, @Param("deleted") boolean deleted); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml index 55fb601c5c..d4a5376974 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml @@ -141,6 +141,17 @@ #{id} +