From e93a648780052f5a34032b08dcab73d0dc665d5a Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 17 Jun 2024 13:49:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FunctionalCaseMinderController.java | 14 ++++++-------- .../service/FunctionalCaseMinderService.java | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java index e0c3254e80..7491218e4c 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java @@ -14,10 +14,12 @@ 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.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -42,7 +44,7 @@ public class FunctionalCaseMinderController { @PostMapping("/list") @Operation(summary = "用例管理-功能用例-脑图用例跟根据模块ID查询列表") - @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER) + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") public List getFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCaseMindRequest request) { return functionalCaseMinderService.getMindFunctionalCase(request, false); @@ -50,11 +52,7 @@ public class FunctionalCaseMinderController { @PostMapping("/edit") @Operation(summary = "脑图保存") - @RequiresPermissions(value = { - PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, - PermissionConstants.FUNCTIONAL_CASE_READ_DELETE, - PermissionConstants.FUNCTIONAL_CASE_READ_ADD, - }, logical = Logical.OR) + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER) public void editFunctionalCaseBatch(@Validated @RequestBody FunctionalCaseMinderEditRequest request) { String userId = SessionUtils.getUserId(); functionalCaseMinderService.editFunctionalCaseBatch(request, userId); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 7c74ca2aef..3c640edeed 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -163,8 +163,7 @@ public class FunctionalCaseMinderService { private List getFieldIds(FunctionalCaseMindRequest request) { TemplateDTO defaultTemplateDTO = projectTemplateService.getDefaultTemplateDTO(request.getProjectId(), TemplateScene.FUNCTIONAL.toString()); List customFields = defaultTemplateDTO.getCustomFields(); - List fieldIds = customFields.stream().map(TemplateCustomFieldDTO::getFieldId).toList(); - return fieldIds; + return customFields.stream().map(TemplateCustomFieldDTO::getFieldId).toList(); } private List buildAdditionalData(String moduleId) {