From 9522889ecea563586e7ffe5220ed333e6786ccff Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 15 Sep 2023 11:26:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E5=8E=BB=E6=8E=89=E9=87=8D=E5=A4=8D=E7=9A=84dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/sdk/dto/OrgIdNameDTO.java | 15 ------- .../sdk/dto/TestResourceReturnDTO.java | 2 +- .../sdk/service/TestResourcePoolService.java | 12 +++--- .../controller/OrganizationController.java | 10 ++--- .../system/dto/IdNameStructureDTO.java | 17 -------- ...isabledDTO.java => OptionDisabledDTO.java} | 3 +- .../metersphere/system/dto/OrgUserExtend.java | 5 ++- .../system/mapper/ExtOrganizationMapper.java | 2 +- .../system/mapper/ExtOrganizationMapper.xml | 2 +- .../mapper/ExtSystemOrgProjectMapper.java | 4 +- .../mapper/ExtSystemOrgProjectMapper.xml | 2 +- .../system/service/OrganizationService.java | 42 +++++++++---------- .../OrganizationControllerTests.java | 40 +++++++++--------- 13 files changed, 63 insertions(+), 93 deletions(-) delete mode 100644 backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/OrgIdNameDTO.java delete mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameStructureDTO.java rename backend/services/system-setting/src/main/java/io/metersphere/system/dto/{IdNameDisabledDTO.java => OptionDisabledDTO.java} (77%) diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/OrgIdNameDTO.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/OrgIdNameDTO.java deleted file mode 100644 index 1da9b8a9e0..0000000000 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/OrgIdNameDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.metersphere.sdk.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Data -public class OrgIdNameDTO { - - @Schema(description = "关联的组织id") - private String id; - - @Schema(description = "关联的组织名称") - private String name; - -} diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/TestResourceReturnDTO.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/TestResourceReturnDTO.java index b849bfc151..c853cb1ad7 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/TestResourceReturnDTO.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/TestResourceReturnDTO.java @@ -82,5 +82,5 @@ public class TestResourceReturnDTO { * 关联的组织id集合 */ @Schema(description = "关联的组织id和名称的集合") - private List orgIdNameMap; + private List orgIdNameMap; } diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/TestResourcePoolService.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/TestResourcePoolService.java index d6d35feab1..af9b0eef73 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/TestResourcePoolService.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/TestResourcePoolService.java @@ -268,18 +268,18 @@ public class TestResourcePoolService { TestResourceReturnDTO testResourceReturnDTO = new TestResourceReturnDTO(); BeanUtils.copyBean(testResourceReturnDTO, testResourceDTO); List orgIds = testResourceDTO.getOrgIds(); - List orgIdNameMap = new ArrayList<>(); + List orgIdNameMap = new ArrayList<>(); if (CollectionUtils.isNotEmpty(orgIds)) { for (String orgId : orgIds) { - OrgIdNameDTO orgIdNameDTO = new OrgIdNameDTO(); + OptionDTO optionDTO = new OptionDTO(); Organization organization = organizationMapper.selectByPrimaryKey(orgId); - orgIdNameDTO.setId(orgId); + optionDTO.setId(orgId); if (organization != null) { - orgIdNameDTO.setName(organization.getName()); + optionDTO.setName(organization.getName()); } else { - orgIdNameDTO.setName(Translator.get("organization_not_exists")); + optionDTO.setName(Translator.get("organization_not_exists")); } - orgIdNameMap.add(orgIdNameDTO); + orgIdNameMap.add(optionDTO); } } testResourceReturnDTO.setOrgIdNameMap(orgIdNameMap); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationController.java index 7e7bb8fbc8..f7edd1d36f 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationController.java @@ -3,13 +3,13 @@ package io.metersphere.system.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.sdk.constants.PermissionConstants; +import io.metersphere.sdk.dto.OptionDTO; import io.metersphere.sdk.log.annotation.Log; import io.metersphere.sdk.log.constants.OperationLogType; import io.metersphere.sdk.util.PageUtils; import io.metersphere.sdk.util.Pager; import io.metersphere.sdk.util.SessionUtils; -import io.metersphere.system.dto.IdNameDisabledDTO; -import io.metersphere.system.dto.IdNameStructureDTO; +import io.metersphere.system.dto.OptionDisabledDTO; import io.metersphere.system.dto.OrgUserExtend; import io.metersphere.system.request.*; import io.metersphere.system.service.OrganizationService; @@ -90,21 +90,21 @@ public class OrganizationController { @GetMapping("/project/list/{organizationId}") @Operation(summary = "系统设置-组织-成员-获取当前组织下的所有项目") @RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ) - public List getProjectList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据项目名查询", requiredMode = Schema.RequiredMode.REQUIRED) @RequestParam(value = "keyword", required = false) String keyword) { + public List getProjectList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据项目名查询", requiredMode = Schema.RequiredMode.REQUIRED) @RequestParam(value = "keyword", required = false) String keyword) { return organizationService.getProjectList(organizationId, keyword); } @GetMapping("/user/role/list/{organizationId}") @Operation(summary = "系统设置-组织-成员-获取当前组织下的所有自定义用户组以及组织级别的用户组") @RequiresPermissions(PermissionConstants.ORGANIZATION_MEMBER_READ) - public List getUserRoleList(@PathVariable(value = "organizationId") String organizationId) { + public List getUserRoleList(@PathVariable(value = "organizationId") String organizationId) { return organizationService.getUserRoleList(organizationId); } @GetMapping("/not-exist/user/list/{organizationId}") @Operation(summary = "系统设置-组织-成员-获取不在当前组织的所有用户") @RequiresPermissions(PermissionConstants.SYSTEM_USER_ROLE_READ) - public List getUserList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据用户名查询", requiredMode = Schema.RequiredMode.REQUIRED) + public List getUserList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据用户名查询", requiredMode = Schema.RequiredMode.REQUIRED) @RequestParam(value = "keyword", required = false) String keyword) { return organizationService.getUserList(organizationId, keyword); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameStructureDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameStructureDTO.java deleted file mode 100644 index 233f89757d..0000000000 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameStructureDTO.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.metersphere.system.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class IdNameStructureDTO { - @Schema(description = "选项ID") - private String id; - @Schema(description = "选项名称") - private String name; - -} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameDisabledDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OptionDisabledDTO.java similarity index 77% rename from backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameDisabledDTO.java rename to backend/services/system-setting/src/main/java/io/metersphere/system/dto/OptionDisabledDTO.java index 43aaceedfb..dda37b7c68 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/IdNameDisabledDTO.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OptionDisabledDTO.java @@ -1,5 +1,6 @@ package io.metersphere.system.dto; +import io.metersphere.sdk.dto.OptionDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Data; @@ -8,7 +9,7 @@ import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor -public class IdNameDisabledDTO extends IdNameStructureDTO{ +public class OptionDisabledDTO extends OptionDTO { @Schema(description = "是否已经关联过") private Boolean disabled = false; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrgUserExtend.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrgUserExtend.java index cbdbfd76a5..5a8c78aa3f 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrgUserExtend.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrgUserExtend.java @@ -1,5 +1,6 @@ package io.metersphere.system.dto; +import io.metersphere.sdk.dto.OptionDTO; import io.metersphere.system.domain.User; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -15,8 +16,8 @@ import java.util.List; public class OrgUserExtend extends User { @Schema(description = "项目ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED) - private List projectIdNameMap;; + private List projectIdNameMap;; @Schema(description = "用户组ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED) - private List userRoleIdNameMap; + private List userRoleIdNameMap; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java index 7ec413860d..bf1a41288c 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java @@ -83,7 +83,7 @@ public interface ExtOrganizationMapper { * @param keyword 组织成员列表请求参数 * @return 组织成员列表数据 */ - List selectListMemberByOrg(@Param("keyword") String keyword); + List selectListMemberByOrg(@Param("keyword") String keyword); /** * 获取组织管理员 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml index d9a2e5cffb..4de1e10e1e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml @@ -98,7 +98,7 @@ group by temp.id - select id, name from user where deleted = 0 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.java index c2e5bf58f5..9e1b6d6099 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.java @@ -1,6 +1,6 @@ package io.metersphere.system.mapper; -import io.metersphere.system.dto.IdNameStructureDTO; +import io.metersphere.sdk.dto.OptionDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,5 +14,5 @@ public interface ExtSystemOrgProjectMapper { * @param keyword 组织项目列表请求参数 * @return 组织项目列表数据 */ - List selectListProjectByOrg(@Param("organizationId") String organizationId, @Param("keyword") String keyword); + List selectListProjectByOrg(@Param("organizationId") String organizationId, @Param("keyword") String keyword); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.xml index 7a7530c0cb..5f8e4d1f31 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemOrgProjectMapper.xml @@ -2,7 +2,7 @@ - select id, name from project where deleted = 0 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationService.java index d299287d42..39bee9ee50 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationService.java @@ -297,7 +297,7 @@ public class OrganizationService { Set projectIds = userIdProjectIdMap.get(orgUserExtend.getId()); if (CollectionUtils.isNotEmpty(projectIds)) { List projectFilters = projects.stream().filter(t -> projectIds.contains(t.getId())).toList(); - List projectList = new ArrayList<>(); + List projectList = new ArrayList<>(); setProjectList(projectList, projectFilters); orgUserExtend.setProjectIdNameMap(projectList); } @@ -305,7 +305,7 @@ public class OrganizationService { Set userRoleIds = userIdRoleIdMap.get(orgUserExtend.getId()); List userRoleFilters = userRoles.stream().filter(t -> userRoleIds.contains(t.getId())).toList(); - List userRoleList = new ArrayList<>(); + List userRoleList = new ArrayList<>(); setUserRoleList(userRoleList, userRoleFilters); orgUserExtend.setUserRoleIdNameMap(userRoleList); @@ -323,12 +323,12 @@ public class OrganizationService { userIdTargetIdMap.put(userId, targetIds); } - private void setProjectList(List projectList, List projectFilters) { + private void setProjectList(List projectList, List projectFilters) { for (Project project : projectFilters) { - IdNameStructureDTO idNameStructureDTO = new IdNameStructureDTO(); - idNameStructureDTO.setId(project.getId()); - idNameStructureDTO.setName(project.getName()); - projectList.add(idNameStructureDTO); + OptionDTO optionDTO = new OptionDTO(); + optionDTO.setId(project.getId()); + optionDTO.setName(project.getName()); + projectList.add(optionDTO); } } @@ -652,7 +652,7 @@ public class OrganizationService { * @param organizationId 组织ID * @return 项目列表 */ - public List getProjectList(String organizationId, String keyword) { + public List getProjectList(String organizationId, String keyword) { //校验组织是否存在 checkOrgExistById(organizationId); return extSystemOrgProjectMapper.selectListProjectByOrg(organizationId, keyword); @@ -664,11 +664,11 @@ public class OrganizationService { * @param organizationId 组织ID * @return 用户组列表 */ - public List getUserRoleList(String organizationId) { + public List getUserRoleList(String organizationId) { //校验组织是否存在 checkOrgExistById(organizationId); List scopeIds = Arrays.asList(UserRoleEnum.GLOBAL.toString(), organizationId); - List userRoleList = new ArrayList<>(); + List userRoleList = new ArrayList<>(); UserRoleExample userRoleExample = new UserRoleExample(); userRoleExample.createCriteria().andTypeEqualTo(UserRoleType.ORGANIZATION.toString()).andScopeIdIn(scopeIds); List userRoles = userRoleMapper.selectByExample(userRoleExample); @@ -676,12 +676,12 @@ public class OrganizationService { return userRoleList; } - private static void setUserRoleList(List userRoleList, List userRoles) { + private static void setUserRoleList(List userRoleList, List userRoles) { for (UserRole userRole : userRoles) { - IdNameStructureDTO idNameStructureDTO = new IdNameStructureDTO(); - idNameStructureDTO.setId(userRole.getId()); - idNameStructureDTO.setName(userRole.getName()); - userRoleList.add(idNameStructureDTO); + OptionDTO optionDTO = new OptionDTO(); + optionDTO.setId(userRole.getId()); + optionDTO.setName(userRole.getName()); + userRoleList.add(optionDTO); } } @@ -691,24 +691,24 @@ public class OrganizationService { * @param organizationId 组织ID * @return 用户列表 */ - public List getUserList(String organizationId, String keyword) { + public List getUserList(String organizationId, String keyword) { //校验组织是否存在 checkOrgExistById(organizationId); - List idNameDisabledDTOS = extOrganizationMapper.selectListMemberByOrg(keyword); + List optionDisabledDTOS = extOrganizationMapper.selectListMemberByOrg(keyword); UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample(); userRoleRelationExample.createCriteria().andSourceIdEqualTo(organizationId); List userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample); List userIds = userRoleRelations.stream().map(UserRoleRelation::getUserId).distinct().toList(); - for (IdNameDisabledDTO idNameDisabledDTO : idNameDisabledDTOS) { - if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(idNameDisabledDTO.getId())) { - idNameDisabledDTO.setDisabled(true); + for (OptionDisabledDTO optionDisabledDTO : optionDisabledDTOS) { + if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(optionDisabledDTO.getId())) { + optionDisabledDTO.setDisabled(true); } } - return idNameDisabledDTOS; + return optionDisabledDTOS; } /** diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationControllerTests.java index adda35766e..a28496884d 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationControllerTests.java @@ -4,9 +4,9 @@ import io.metersphere.sdk.base.BaseTest; import io.metersphere.sdk.constants.InternalUserRole; import io.metersphere.sdk.constants.SessionConstants; import io.metersphere.sdk.controller.handler.ResultHolder; +import io.metersphere.sdk.dto.OptionDTO; import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.Pager; -import io.metersphere.system.dto.IdNameStructureDTO; import io.metersphere.system.dto.OrgUserExtend; import io.metersphere.system.request.OrgMemberExtendProjectRequest; import io.metersphere.system.request.OrganizationMemberExtendRequest; @@ -336,11 +336,11 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList)); - List ids = projectList.stream().map(IdNameStructureDTO::getId).toList(); + List ids = projectList.stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(ids.contains("sys_org_projectId")); - List names = projectList.stream().map(IdNameStructureDTO::getName).toList(); + List names = projectList.stream().map(OptionDTO::getName).toList(); Assertions.assertTrue(names.contains("sys_org_projectId")); } @@ -355,7 +355,7 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isEmpty(projectList)); } @@ -383,11 +383,11 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList)); - List ids = projectList.stream().map(IdNameStructureDTO::getId).toList(); + List ids = projectList.stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(ids.contains("sys_default_org_role_id_3")); - List names = projectList.stream().map(IdNameStructureDTO::getName).toList(); + List names = projectList.stream().map(OptionDTO::getName).toList(); Assertions.assertTrue(names.contains("sys_default_org_role_id_3")); } @@ -402,12 +402,12 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List userRoleList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List userRoleList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isNotEmpty(userRoleList)); - List ids = userRoleList.stream().map(IdNameStructureDTO::getId).toList(); + List ids = userRoleList.stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(ids.contains("org_admin")); Assertions.assertTrue(ids.contains("org_member")); - List names = userRoleList.stream().map(IdNameStructureDTO::getName).toList(); + List names = userRoleList.stream().map(OptionDTO::getName).toList(); Assertions.assertTrue(names.contains("组织管理员")); Assertions.assertTrue(names.contains("组织成员")); @@ -437,11 +437,11 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList)); - List ids = projectList.stream().map(IdNameStructureDTO::getId).toList(); + List ids = projectList.stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(ids.contains("sys_default_user5")); - List names = projectList.stream().map(IdNameStructureDTO::getName).toList(); + List names = projectList.stream().map(OptionDTO::getName).toList(); Assertions.assertTrue(names.contains("testUserFive")); } @@ -456,7 +456,7 @@ public class OrganizationControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); String contentAsString = mvcResult.getResponse().getContentAsString(); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); - List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class); + List projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class); Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList)); } @@ -502,25 +502,25 @@ public class OrganizationControllerTests extends BaseTest { } if (compare) { Assertions.assertNotNull(orgUserExtend.getUserRoleIdNameMap()); - List userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(IdNameStructureDTO::getId).toList(); + List userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(userRoleIds.contains(userRoleId)); if (StringUtils.isNotBlank(projectId)) { Assertions.assertNotNull(orgUserExtend.getProjectIdNameMap()); - List projectIds = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getId).toList(); + List projectIds = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getId).toList(); Assertions.assertTrue(projectIds.contains(projectId)); - List projectNames = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getName).toList(); + List projectNames = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getName).toList(); Assertions.assertTrue(projectNames.contains(projectId)); } } if (checkPart) { Assertions.assertNotNull(orgUserExtend.getUserRoleIdNameMap()); - List userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(IdNameStructureDTO::getId).toList(); + List userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(OptionDTO::getId).toList(); Assertions.assertFalse(userRoleIds.contains(noUserRoleId)); if (StringUtils.isNotBlank(noProjectId)) { Assertions.assertNotNull(orgUserExtend.getProjectIdNameMap()); - List projectIds = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getId).toList(); + List projectIds = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getId).toList(); Assertions.assertFalse(projectIds.contains(noProjectId)); }