From 2b01c586b40f75f3ddb7c796aa3ad76add7636f1 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Thu, 31 Aug 2023 17:39:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E7=BB=84=E4=B8=8E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=85=B3=E8=81=94=E8=A1=A8=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?ID=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/domain/UserRoleRelation.java | 18 +++-- .../domain/UserRoleRelationExample.java | 70 +++++++++++++++++++ .../system/mapper/UserRoleRelationMapper.xml | 34 ++++++--- .../3.0.0/ddl/V3.0.0_11__system_setting.sql | 19 ++--- .../migration/3.0.0/dml/V3.0.0_11_1__data.sql | 2 +- .../service/BaseUserRoleRelationService.java | 12 +--- .../sdk/service/BaseUserRoleService.java | 7 +- .../project/service/ProjectMemberService.java | 9 ++- .../resources/dml/init_permission_test.sql | 4 +- .../src/test/resources/dml/init_project.sql | 12 ++-- .../resources/dml/init_project_member.sql | 14 ++-- .../system/service/CommonProjectService.java | 3 + .../GlobalUserRoleRelationService.java | 2 + .../system/service/GlobalUserRoleService.java | 2 +- .../system/service/OrganizationService.java | 5 ++ .../service/OrganizationUserRoleService.java | 3 +- .../service/UserRoleRelationService.java | 2 + .../GlobalUserRoleControllerTests.java | 1 + ...GlobalUserRoleRelationControllerTests.java | 3 + .../resources/dml/init_clean_organization.sql | 4 +- .../test/resources/dml/init_clean_project.sql | 4 +- .../test/resources/dml/init_org_project.sql | 4 +- .../test/resources/dml/init_organization.sql | 4 +- .../dml/init_organization_user_role.sql | 12 ++-- .../resources/dml/init_permission_test.sql | 9 ++- .../src/test/resources/dml/init_project.sql | 6 +- .../resources/dml/init_sys_organization.sql | 4 +- 27 files changed, 189 insertions(+), 80 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelation.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelation.java index 0939261654..801f43d814 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelation.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelation.java @@ -10,30 +10,35 @@ import lombok.Data; @Data public class UserRoleRelation implements Serializable { - @Schema(description = "用户组关系ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "用户组关系ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user_role_relation.id.not_blank}", groups = {Updated.class}) @Size(min = 1, max = 50, message = "{user_role_relation.id.length_range}", groups = {Created.class, Updated.class}) private String id; - @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user_role_relation.user_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{user_role_relation.user_id.length_range}", groups = {Created.class, Updated.class}) private String userId; - @Schema(description = "组ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "组ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user_role_relation.role_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{user_role_relation.role_id.length_range}", groups = {Created.class, Updated.class}) private String roleId; - @Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user_role_relation.source_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{user_role_relation.source_id.length_range}", groups = {Created.class, Updated.class}) private String sourceId; - @Schema(description = "创建时间") + @Schema(description = "记录所在的组织ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{user_role_relation.organization_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{user_role_relation.organization_id.length_range}", groups = {Created.class, Updated.class}) + private String organizationId; + + @Schema(description = "创建时间") private Long createTime; - @Schema(description = "创建人") + @Schema(description = "创建人") private String createUser; private static final long serialVersionUID = 1L; @@ -43,6 +48,7 @@ public class UserRoleRelation implements Serializable { userId("user_id", "userId", "VARCHAR", false), roleId("role_id", "roleId", "VARCHAR", false), sourceId("source_id", "sourceId", "VARCHAR", false), + organizationId("organization_id", "organizationId", "VARCHAR", false), createTime("create_time", "createTime", "BIGINT", false), createUser("create_user", "createUser", "VARCHAR", false); diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelationExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelationExample.java index e9ceff5489..6dacd68c56 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelationExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserRoleRelationExample.java @@ -384,6 +384,76 @@ public class UserRoleRelationExample { 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 values) { + addCriterion("organization_id in", values, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotIn(List 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 Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserRoleRelationMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserRoleRelationMapper.xml index 4b77fd9e1b..39747b2a67 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserRoleRelationMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserRoleRelationMapper.xml @@ -6,6 +6,7 @@ + @@ -68,7 +69,7 @@ - id, user_id, role_id, source_id, create_time, create_user + id, user_id, role_id, source_id, organization_id, create_time, create_user