From 1c1d52f45f6c7b9cc25c97ef48e533ba30669fa8 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Sat, 11 May 2024 17:23:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90&=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8B=E8=AE=A1=E5=88=92=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestPlanFunctionalCaseController.java | 6 +++--- .../plan/service/TestPlanBaseUtilsService.java | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseController.java index 5cc616b50a..9eeed7fd18 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseController.java @@ -63,7 +63,7 @@ public class TestPlanFunctionalCaseController { @PostMapping("/page") @Operation(summary = "测试计划-已关联功能用例分页查询") - @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) + @RequiresPermissions(PermissionConstants.TEST_PLAN_READ) @CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan") public Pager> page(@Validated @RequestBody TestPlanCaseRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); @@ -73,7 +73,7 @@ public class TestPlanFunctionalCaseController { @GetMapping("/tree/{testPlanId}") @Operation(summary = "测试计划-已关联功能用例列表模块树") - @RequiresPermissions(PermissionConstants.CASE_REVIEW_READ) + @RequiresPermissions(PermissionConstants.TEST_PLAN_READ) @CheckOwner(resourceId = "#testPlanId", resourceType = "test_plan") public List getTree(@PathVariable String testPlanId) { return testPlanFunctionalCaseService.getTree(testPlanId); @@ -81,7 +81,7 @@ public class TestPlanFunctionalCaseController { @PostMapping("/module/count") @Operation(summary = "测试计划-已关联功能用例模块数量") - @RequiresPermissions(PermissionConstants.CASE_REVIEW_READ) + @RequiresPermissions(PermissionConstants.TEST_PLAN_READ) @CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan") public Map moduleCount(@Validated @RequestBody TestPlanCaseRequest request) { return testPlanFunctionalCaseService.moduleCount(request); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanBaseUtilsService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanBaseUtilsService.java index 3dc7cc2168..9a6acb2d20 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanBaseUtilsService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanBaseUtilsService.java @@ -39,20 +39,6 @@ public class TestPlanBaseUtilsService { TestPlan group = testPlanMapper.selectByPrimaryKey(testPlan.getGroupId()); testPlan.setModuleId(group.getModuleId()); } - TestPlanExample example = new TestPlanExample(); - if (StringUtils.isBlank(testPlan.getId())) { - //新建 校验 - example.createCriteria().andNameEqualTo(testPlan.getName()).andProjectIdEqualTo(testPlan.getProjectId()).andModuleIdEqualTo(testPlan.getModuleId()); - if (testPlanMapper.countByExample(example) > 0) { - throw new MSException(Translator.get("test_plan.name.exist") + ":" + testPlan.getName()); - } - } else { - //更新 校验 - example.createCriteria().andNameEqualTo(testPlan.getName()).andProjectIdEqualTo(testPlan.getProjectId()).andIdNotEqualTo(testPlan.getId()).andModuleIdEqualTo(testPlan.getModuleId()); - if (testPlanMapper.countByExample(example) > 0) { - throw new MSException(Translator.get("test_plan.name.exist") + ":" + testPlan.getName()); - } - } }