From 809af2ddd4a1de9d9e3eaeb5e495abab40a32648 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 17 Aug 2023 10:21:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/sdk/dto/ProjectDTO.java | 4 +- .../OrganizationProjectController.java | 18 ++++++++ .../SystemOrganizationController.java | 8 ++++ .../controller/SystemProjectController.java | 19 +++++++++ .../system/dto/OrganizationDTO.java | 6 +++ .../system/mapper/ExtSystemProjectMapper.xml | 2 +- .../system/service/CommonProjectService.java | 23 ++++++++++ .../OrganizationProjectLogService.java | 19 +++++++++ .../service/OrganizationProjectService.java | 7 ++++ .../system/service/OrganizationService.java | 22 ++++++++++ .../service/SystemProjectLogService.java | 20 +++++++++ .../system/service/SystemProjectService.java | 8 ++++ .../OrganizationProjectControllerTests.java | 40 ++++++++++++++++++ .../SystemOrganizationControllerTests.java | 19 ++++++++- .../SystemProjectControllerTests.java | 42 +++++++++++++++++++ 15 files changed, 254 insertions(+), 3 deletions(-) diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/ProjectDTO.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/ProjectDTO.java index 97c33c50b6..4dfccb046b 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/ProjectDTO.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/ProjectDTO.java @@ -12,9 +12,11 @@ import java.util.List; @EqualsAndHashCode(callSuper = false) public class ProjectDTO extends Project { @Schema(description = "项目成员数量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - private String number; + private long memberCount; @Schema(description = "所属组织", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private String organizationName; @Schema(description = "管理员", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private List adminList; + @Schema(description = "创建人是否是管理员", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private boolean projectCreateUserIsAdmin; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationProjectController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationProjectController.java index 9a9fc7a7c1..0ebde9674d 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationProjectController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationProjectController.java @@ -94,6 +94,24 @@ public class OrganizationProjectController { return organizationProjectService.revoke(id); } + @GetMapping("/enable/{id}") + @Operation(summary = "启用项目") + @Parameter(name = "id", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) + @Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#id)", msClass = OrganizationProjectLogService.class) + @RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ_UPDATE) + public void enable(@PathVariable String id) { + organizationProjectService.enable(id); + } + + @GetMapping("/disable/{id}") + @Operation(summary = "禁用项目") + @Parameter(name = "id", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) + @RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ_UPDATE) + @Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#id)", msClass = OrganizationProjectLogService.class) + public void disable(@PathVariable String id) { + organizationProjectService.disable(id); + } + @PostMapping("/member-list") @RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ) @Operation(summary = "获取项目下成员列表") diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java index 15e304d270..0b6144baa0 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java @@ -29,6 +29,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * @author song-cc-rock @@ -103,4 +104,11 @@ public class SystemOrganizationController { BeanUtils.copyBean(projectRequest, request); return PageUtils.setPageInfo(page, systemProjectService.getProjectList(projectRequest)); } + + @GetMapping("/total") + @Operation(summary = "获取组织和项目总数") + @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ) + public Map getTotal(@RequestParam(value = "organizationId",required = false) String organizationId) { + return organizationService.getTotal(organizationId); + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemProjectController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemProjectController.java index 2656595a33..ae559fb00e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemProjectController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemProjectController.java @@ -86,6 +86,7 @@ public class SystemProjectController { } @GetMapping("/revoke/{id}") + @Operation(summary = "撤销项目") @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_RECOVER) @Log(type = OperationLogType.UPDATE, expression = "#msClass.recoverLog(#id)", msClass = SystemProjectLogService.class) @Parameter(name = "id", description = "项目", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) @@ -93,6 +94,24 @@ public class SystemProjectController { return systemProjectService.revoke(id); } + @GetMapping("/enable/{id}") + @Operation(summary = "启用项目") + @Parameter(name = "id", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) + @Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#id)", msClass = SystemProjectLogService.class) + @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_UPDATE) + public void enable(@PathVariable String id) { + systemProjectService.enable(id); + } + + @GetMapping("/disable/{id}") + @Operation(summary = "禁用项目") + @Parameter(name = "id", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) + @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_UPDATE) + @Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#id)", msClass = SystemProjectLogService.class) + public void disable(@PathVariable String id) { + systemProjectService.disable(id); + } + @PostMapping("/member-list") @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ) @Operation(summary = "获取项目下成员列表") diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationDTO.java index d4855e3637..616b4a56b9 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationDTO.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationDTO.java @@ -43,4 +43,10 @@ public class OrganizationDTO extends Organization { @Schema(description = "组织管理员ID集合") @NotEmpty(groups = {Created.class, Updated.class}, message = "{member.id.not_empty}") private List memberIds; + + /** + * 创建人是否是管理员 + */ + @Schema(description = "创建人是否是管理员") + private boolean orgCreateUserIsAdmin; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml index 3a0b247641..c85b4ac73e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml @@ -34,7 +34,7 @@ p.deleted, p.delete_user, p.enable, - count(distinct u.id) as number, + count(distinct u.id) as memberCount, o.name as organizationName FROM project p LEFT JOIN user_role_relation u on p.id = u.source_id diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java index 24fcd21eb7..325d57ce61 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java @@ -185,6 +185,11 @@ public class CommonProjectService { projectList.forEach(projectDTO -> { List users = extSystemProjectMapper.getProjectAdminList(projectDTO.getId()); projectDTO.setAdminList(users); + List userIds = users.stream().map(User::getId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(projectDTO.getCreateUser())) { + projectDTO.setProjectCreateUserIsAdmin(true); + } + }); return projectList; } @@ -463,4 +468,22 @@ public class CommonProjectService { dto.setOriginalValue(JSON.toJSONBytes(StringUtils.EMPTY)); logDTOList.add(dto); } + + public void enable(String id) { + checkProjectNotExist(id); + Project project = new Project(); + project.setId(id); + project.setEnable(true); + project.setUpdateTime(System.currentTimeMillis()); + projectMapper.updateByPrimaryKeySelective(project); + } + + public void disable(String id) { + checkProjectNotExist(id); + Project project = new Project(); + project.setId(id); + project.setEnable(false); + project.setUpdateTime(System.currentTimeMillis()); + projectMapper.updateByPrimaryKeySelective(project); + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java index 01f35f4269..011c5ee5b6 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java @@ -2,6 +2,7 @@ package io.metersphere.system.service; import io.metersphere.project.domain.Project; import io.metersphere.project.mapper.ProjectMapper; +import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.dto.AddProjectRequest; import io.metersphere.sdk.dto.LogDTO; import io.metersphere.sdk.dto.UpdateProjectRequest; @@ -60,6 +61,24 @@ public class OrganizationProjectLogService { return null; } + public LogDTO updateLog(String id) { + Project project = projectMapper.selectByPrimaryKey(id); + if (project != null) { + LogDTO dto = new LogDTO( + project.getId(), + project.getOrganizationId(), + project.getId(), + project.getCreateUser(), + OperationLogType.UPDATE.name(), + OperationLogModule.SYSTEM_PROJECT, + project.getName()); + dto.setMethod(HttpMethodConstants.GET.name()); + + dto.setOriginalValue(JSON.toJSONBytes(project)); + return dto; + } + return null; + } /** * 删除接口日志 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java index 34db1009c0..5809873cad 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java @@ -93,4 +93,11 @@ public class OrganizationProjectService { return commonProjectService.revoke(id); } + public void enable(String id) { + commonProjectService.enable(id); + } + + public void disable(String id) { + commonProjectService.disable(id); + } } 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 2fea6e7e92..a15c47a986 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 @@ -772,6 +772,10 @@ public class OrganizationService { organizationDTOS.forEach(organizationDTO -> { List orgAdminList = extOrganizationMapper.getOrgAdminList(organizationDTO.getId()); organizationDTO.setOrgAdmins(orgAdminList); + List userIds = orgAdminList.stream().map(User::getId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(organizationDTO.getCreateUser())) { + organizationDTO.setOrgCreateUserIsAdmin(true); + } }); return organizationDTOS; } @@ -810,4 +814,22 @@ public class OrganizationService { } return extOrganizationMapper.getOptionsByIds(orgIds); } + + + public Map getTotal(String organizationId) { + Map total = new HashMap<>(); + ProjectExample projectExample = new ProjectExample(); + OrganizationExample organizationExample = new OrganizationExample(); + if (StringUtils.isBlank(organizationId)) { + // 统计所有项目 + total.put("projectTotal", projectMapper.countByExample(projectExample)); + total.put("organizationTotal", organizationMapper.countByExample(organizationExample)); + } else { + // 统计组织下的项目 + projectExample.createCriteria().andOrganizationIdEqualTo(organizationId); + total.put("projectTotal", projectMapper.countByExample(projectExample)); + total.put("organizationTotal", 1L); + } + return total; + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java index 8006b9f98f..6de07d41cc 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java @@ -2,6 +2,7 @@ package io.metersphere.system.service; import io.metersphere.project.domain.Project; import io.metersphere.project.mapper.ProjectMapper; +import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.dto.AddProjectRequest; import io.metersphere.sdk.dto.LogDTO; import io.metersphere.sdk.dto.UpdateProjectRequest; @@ -60,6 +61,25 @@ public class SystemProjectLogService { return null; } + public LogDTO updateLog(String id) { + Project project = projectMapper.selectByPrimaryKey(id); + if (project != null) { + LogDTO dto = new LogDTO( + project.getId(), + project.getOrganizationId(), + project.getId(), + project.getCreateUser(), + OperationLogType.UPDATE.name(), + OperationLogModule.SYSTEM_PROJECT, + project.getName()); + dto.setMethod(HttpMethodConstants.GET.name()); + + dto.setOriginalValue(JSON.toJSONBytes(project)); + return dto; + } + return null; + } + /** * 删除接口日志 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java index bbe53fac7e..135ca229e1 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java @@ -98,4 +98,12 @@ public class SystemProjectService { public List getProjectOptions() { return extSystemProjectMapper.selectProjectOptions(); } + + public void enable(String id) { + commonProjectService.enable(id); + } + + public void disable(String id) { + commonProjectService.disable(id); + } } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationProjectControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationProjectControllerTests.java index 7d5198a4cb..3cac7735f7 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationProjectControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationProjectControllerTests.java @@ -68,6 +68,8 @@ public class OrganizationProjectControllerTests extends BaseTest { private final static String getProjectMemberList = prefix + "/member-list"; private final static String addProjectMember = prefix + "/add-members"; private final static String removeProjectMember = prefix + "/remove-member/"; + private final static String disableProject = prefix + "/disable/"; + private final static String enableProject = prefix + "/enable/"; private static final ResultMatcher BAD_REQUEST_MATCHER = status().isBadRequest(); private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError(); @@ -665,4 +667,42 @@ public class OrganizationProjectControllerTests extends BaseTest { this.responseGet(removeProjectMember + projectId + "/" + userId, ERROR_REQUEST_MATCHER); } + @Test + @Order(19) + public void disableSuccess() throws Exception { + String id = "projectId"; + this.responseGet(disableProject + id,status().isOk()); + Project currentProject = projectMapper.selectByPrimaryKey(id); + Assertions.assertEquals(currentProject.getEnable(), false); + checkLog(id, OperationLogType.UPDATE); + // @@校验权限 + requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ_UPDATE, disableProject + id); + } + + @Test + @Order(20) + public void disableError() throws Exception { + String id = "1111"; + this.responseGet(disableProject + id, ERROR_REQUEST_MATCHER); + } + + @Test + @Order(19) + public void enableSuccess() throws Exception { + String id = "projectId"; + this.responseGet(enableProject + id,status().isOk()); + Project currentProject = projectMapper.selectByPrimaryKey(id); + Assertions.assertEquals(currentProject.getEnable(), true); + checkLog(id, OperationLogType.UPDATE); + // @@校验权限 + requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ_UPDATE, enableProject + id); + } + + @Test + @Order(20) + public void enableError() throws Exception { + String id = "1111"; + this.responseGet(enableProject + id, ERROR_REQUEST_MATCHER); + } + } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemOrganizationControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemOrganizationControllerTests.java index b4e8072312..d11a461861 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemOrganizationControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemOrganizationControllerTests.java @@ -29,7 +29,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.nio.charset.StandardCharsets; import java.util.*; - import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -49,6 +48,7 @@ public class SystemOrganizationControllerTests extends BaseTest{ public static final String ORGANIZATION_REMOVE_MEMBER = "/system/organization/remove-member"; public static final String ORGANIZATION_LIST_PROJECT = "/system/organization/list-project"; public static final String ORGANIZATION_MEMBER_OPTION = "/system/user/get-option"; + public static final String ORGANIZATION_TOTAL = "/system/organization/total"; @Test @Order(0) @@ -415,6 +415,23 @@ public class SystemOrganizationControllerTests extends BaseTest{ requestGetPermissionTest(PermissionConstants.SYSTEM_USER_READ, SystemOrganizationControllerTests.ORGANIZATION_MEMBER_OPTION + "/default-organization-2"); } + @Test + @Order(17) + public void testGetTotal() throws Exception { + // 组织不存在 + MvcResult mvcResult = this.responseGet(SystemOrganizationControllerTests.ORGANIZATION_TOTAL + "?organizationId=default-organization-2"); + // 获取返回值 + String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + Map resultHolder = JSON.parseObject(returnData, Map.class); + + mvcResult = this.responseGet(SystemOrganizationControllerTests.ORGANIZATION_TOTAL); + // 获取返回值 + returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + resultHolder = JSON.parseObject(returnData, Map.class); + // 返回请求正常 + Assertions.assertNotNull(resultHolder); + } + private void requestPost(String url, Object param, ResultMatcher resultMatcher) throws Exception { mockMvc.perform(MockMvcRequestBuilders.post(url) .header(SessionConstants.HEADER_TOKEN, sessionId) diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemProjectControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemProjectControllerTests.java index f3f0a2cb7f..ef2328b3b8 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemProjectControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/SystemProjectControllerTests.java @@ -66,6 +66,8 @@ public class SystemProjectControllerTests extends BaseTest { private final static String getProjectMemberList = prefix + "/member-list"; private final static String addProjectMember = prefix + "/add-member"; private final static String removeProjectMember = prefix + "/remove-member/"; + private final static String disableProject = prefix + "/disable/"; + private final static String enableProject = prefix + "/enable/"; private static final ResultMatcher BAD_REQUEST_MATCHER = status().isBadRequest(); private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError(); @@ -484,6 +486,8 @@ public class SystemProjectControllerTests extends BaseTest { this.responseGet(revokeProject + id, ERROR_REQUEST_MATCHER); } + + @Test @Order(13) public void testAddProjectMember() throws Exception{ @@ -627,4 +631,42 @@ public class SystemProjectControllerTests extends BaseTest { this.responseGet(removeProjectMember + projectId + "/" + userId, ERROR_REQUEST_MATCHER); } + @Test + @Order(19) + public void disableSuccess() throws Exception { + String id = "projectId"; + this.responseGet(disableProject + id,status().isOk()); + Project currentProject = projectMapper.selectByPrimaryKey(id); + Assertions.assertEquals(currentProject.getEnable(), false); + checkLog(id, OperationLogType.UPDATE); + // @@校验权限 + requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_UPDATE, disableProject + id); + } + + @Test + @Order(20) + public void disableError() throws Exception { + String id = "1111"; + this.responseGet(disableProject + id, ERROR_REQUEST_MATCHER); + } + + @Test + @Order(19) + public void enableSuccess() throws Exception { + String id = "projectId"; + this.responseGet(enableProject + id,status().isOk()); + Project currentProject = projectMapper.selectByPrimaryKey(id); + Assertions.assertEquals(currentProject.getEnable(), true); + checkLog(id, OperationLogType.UPDATE); + // @@校验权限 + requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_UPDATE, enableProject + id); + } + + @Test + @Order(20) + public void enableError() throws Exception { + String id = "1111"; + this.responseGet(enableProject + id, ERROR_REQUEST_MATCHER); + } + }