diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseController.java index 7e3ecfc617..9078188026 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseController.java @@ -58,17 +58,13 @@ public class CaseReviewFunctionalCaseController { @Operation(summary = "用例管理-用例评审-评审列表-评审详情-已关联用例列表") @RequiresPermissions(PermissionConstants.CASE_REVIEW_READ) public Pager> page(@Validated @RequestBody ReviewFunctionalCasePageRequest request) { - String userId = StringUtils.EMPTY; - if (request.isViewFlag()) { - userId = SessionUtils.getUserId(); - } String viewStatusUserId = StringUtils.EMPTY; if (request.isViewStatusFlag()) { viewStatusUserId = SessionUtils.getUserId(); } Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); - return PageUtils.setPageInfo(page, caseReviewFunctionalCaseService.page(request, false, userId, viewStatusUserId)); + return PageUtils.setPageInfo(page, caseReviewFunctionalCaseService.page(request, false, viewStatusUserId)); } @@ -86,11 +82,7 @@ public class CaseReviewFunctionalCaseController { @RequiresPermissions(PermissionConstants.CASE_REVIEW_READ) @CheckOwner(resourceId = "#request.getReviewId()", resourceType = "case_review") public Map moduleCount(@Validated @RequestBody ReviewFunctionalCasePageRequest request) { - String userId = StringUtils.EMPTY; - if (request.isViewFlag()) { - userId = SessionUtils.getUserId(); - } - return caseReviewFunctionalCaseService.moduleCount(request, false, userId); + return caseReviewFunctionalCaseService.moduleCount(request, false); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.java index c1b72373fc..00b79623bb 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.java @@ -24,7 +24,7 @@ public interface ExtCaseReviewFunctionalCaseMapper { List getCaseIdsByReviewId(@Param("reviewId") String reviewId); @BaseConditionFilter - List page(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("userId") String userId, @Param("sort") String sort); + List page(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("sort") String sort); Long getPos(@Param("reviewId") String reviewId); @@ -33,10 +33,10 @@ public interface ExtCaseReviewFunctionalCaseMapper { Long getLastPos(@Param("reviewId") String reviewId, @Param("basePos") Long basePos); @BaseConditionFilter - List getIds(@Param("request") BaseReviewCaseBatchRequest request, @Param("userId") String userId, @Param("deleted") boolean deleted); + List getIds(@Param("request") BaseReviewCaseBatchRequest request, @Param("deleted") boolean deleted); @BaseConditionFilter - List getListByRequest(@Param("request") BaseReviewCaseBatchRequest request, @Param("userId") String userId, @Param("deleted") boolean deleted); + List getListByRequest(@Param("request") BaseReviewCaseBatchRequest request, @Param("deleted") boolean deleted); List getList(@Param("reviewId") String reviewId, @Param("reviewIds") List reviewIds, @Param("deleted") boolean deleted); @@ -46,9 +46,9 @@ public interface ExtCaseReviewFunctionalCaseMapper { List getCaseIdsByIds(@Param("ids") List ids); @BaseConditionFilter - List countModuleIdByRequest(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("userId") String userId); + List countModuleIdByRequest(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted); @BaseConditionFilter - long caseCount(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("userId") String userId); + long caseCount(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml index 43924d00fd..45095be620 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml @@ -52,10 +52,6 @@ WHERE review_id = #{request.reviewId} AND functional_case.deleted = #{deleted} - - AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = - #{request.reviewId} and crfcu.user_id = #{userId}) - order by @@ -142,9 +138,17 @@ - - functional_case.id in ( - select case_id from functional_case_follower where + + + + + + + + crfc.case_id in ( + select case_id from case_review_functional_case_user + where review_id = #{request.reviewId} + and @@ -210,10 +214,6 @@ WHERE review_id = #{request.reviewId} AND functional_case.deleted = #{deleted} - - AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = - #{request.reviewId} and crfcu.user_id = #{userId}) - @@ -226,10 +226,6 @@ WHERE review_id = #{request.reviewId} AND functional_case.deleted = #{deleted} - - AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = - #{request.reviewId} and crfcu.user_id = #{userId}) - and crfc.id not in @@ -343,10 +339,6 @@ LEFT JOIN project ON functional_case.project_id = project.id WHERE crfc.review_id = #{request.reviewId} AND functional_case.deleted = #{deleted} - - AND crfc.case_id in (select crfcu.case_id from case_review_functional_case_user crfcu where crfcu.review_id - = #{request.reviewId} and crfcu.user_id = #{userId}) - GROUP BY module_id @@ -357,10 +349,6 @@ FROM case_review_functional_case crfc LEFT JOIN functional_case ON crfc.case_id = functional_case.id WHERE crfc.review_id = #{request.reviewId} AND functional_case.deleted = #{deleted} - - AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = - #{request.reviewId} and crfcu.user_id = #{userId}) - diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/BaseReviewCaseBatchRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/BaseReviewCaseBatchRequest.java index 4d85d43d76..143d2d3054 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/BaseReviewCaseBatchRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/BaseReviewCaseBatchRequest.java @@ -22,10 +22,6 @@ public class BaseReviewCaseBatchRequest extends TableBatchProcessDTO implements @NotBlank(message = "{case_review_user.review_id.not_blank}") private String reviewId; - - @Schema(description = "userId用来判断是否只看我的") - private String userId; - @Schema(description = "模块id") private List moduleIds; } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/ReviewFunctionalCasePageRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/ReviewFunctionalCasePageRequest.java index 1f077cf9e7..e772c60c83 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/ReviewFunctionalCasePageRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/ReviewFunctionalCasePageRequest.java @@ -25,9 +25,6 @@ public class ReviewFunctionalCasePageRequest extends BasePageRequest implements @NotBlank(message = "{case_review.project_id.not_blank}") private String projectId; - @Schema(description = "是否只看我的", requiredMode = Schema.RequiredMode.REQUIRED) - private boolean viewFlag; - @Schema(description = "模块id") private List moduleIds; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java index 67d780495f..34e9b21a72 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java @@ -133,8 +133,8 @@ public class CaseReviewFunctionalCaseService { * @param deleted deleted * @return ReviewFunctionalCaseDTO */ - public List page(ReviewFunctionalCasePageRequest request, boolean deleted, String userId, String viewStatusUserId) { - List list = extCaseReviewFunctionalCaseMapper.page(request, deleted, userId, request.getSortString()); + public List page(ReviewFunctionalCasePageRequest request, boolean deleted, String viewStatusUserId) { + List list = extCaseReviewFunctionalCaseMapper.page(request, deleted, request.getSortString()); return doHandleDTO(list, request, viewStatusUserId); } @@ -252,7 +252,7 @@ public class CaseReviewFunctionalCaseService { public List doSelectIds(BaseReviewCaseBatchRequest request) { if (request.isSelectAll()) { - List ids = extCaseReviewFunctionalCaseMapper.getIds(request, request.getUserId(), false); + List ids = extCaseReviewFunctionalCaseMapper.getIds(request, false); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { ids.removeAll(request.getExcludeIds()); } @@ -264,7 +264,7 @@ public class CaseReviewFunctionalCaseService { public List doCaseReviewFunctionalCases(BaseReviewCaseBatchRequest request) { if (request.isSelectAll()) { - return extCaseReviewFunctionalCaseMapper.getListByRequest(request, request.getUserId(), false); + return extCaseReviewFunctionalCaseMapper.getListByRequest(request, false); } else { CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample.createCriteria().andIdIn(request.getSelectIds()); @@ -856,10 +856,10 @@ public class CaseReviewFunctionalCaseService { return returnList; } - public Map moduleCount(ReviewFunctionalCasePageRequest request, boolean deleted, String userId) { + public Map moduleCount(ReviewFunctionalCasePageRequest request, boolean deleted) { //查出每个模块节点下的资源数量。 不需要按照模块进行筛选 request.setModuleIds(null); - List projectModuleCountDTOList = extCaseReviewFunctionalCaseMapper.countModuleIdByRequest(request, deleted, userId); + List projectModuleCountDTOList = extCaseReviewFunctionalCaseMapper.countModuleIdByRequest(request, deleted); Map> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId)); Map projectModuleCountMap = new HashMap<>(); projectCountMap.forEach((projectId, moduleCountDTOList) -> { @@ -879,7 +879,7 @@ public class CaseReviewFunctionalCaseService { projectModuleCountMap.put(projectId, (long) sum); }); //查出全部用例数量 - long allCount = extCaseReviewFunctionalCaseMapper.caseCount(request, deleted, userId); + long allCount = extCaseReviewFunctionalCaseMapper.caseCount(request, deleted); projectModuleCountMap.put(CASE_MODULE_COUNT_ALL, allCount); return projectModuleCountMap; } diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseControllerTests.java index da9c1b9213..52670254a9 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/CaseReviewFunctionalCaseControllerTests.java @@ -122,7 +122,6 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest { request.setProjectId("wx_test_project"); request.setReviewId("wx_review_id_5"); - request.setViewFlag(true); request.setViewStatusFlag(true); this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request); request.setReviewId("wx_review_id_1"); @@ -130,11 +129,9 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest { request.setReviewId("wx_review_id_1"); request.setCombineSearch(getCustomCombineSearch()); - request.setViewFlag(true); request.setViewStatusFlag(true); this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request); this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_MODULE_COUNT, request); - request.setViewFlag(false); request.setViewStatusFlag(false); this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request); @@ -654,7 +651,6 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest { request.setReviewId("wx_review_id_1"); request.setCurrent(1); request.setPageSize(10); - request.setViewFlag(false); request.setProjectId("wx_test_project"); MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_MODULE_COUNT, request); Map moduleCount = JSON.parseObject(JSON.toJSONString( diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java b/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java index e40ca2162c..2d66f7ab61 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java @@ -3,6 +3,7 @@ import io.metersphere.sdk.dto.BaseCondition; import io.metersphere.sdk.dto.CombineCondition; import io.metersphere.sdk.dto.CombineSearch; import io.metersphere.sdk.util.BeanUtils; +import io.metersphere.sdk.util.JSON; import io.metersphere.system.constants.InternalUserView; import io.metersphere.system.dto.UserViewDTO; import io.metersphere.system.dto.sdk.*; @@ -77,8 +78,10 @@ public class BaseConditionFilterAspect { for (InternalUserView internalUserView : InternalUserView.values()) { UserViewDTO userView = internalUserView.getUserView(); if (StringUtils.equals(userView.getId(), viewId)) { - replaceCurrentUser(userView.getConditions()); - dbCombineSearch.setUserViewConditions(userView.getConditions()); + // 复制视图查询条件 + List conditions = JSON.parseArray(JSON.toJSONString(userView.getConditions()), CombineCondition.class); + replaceCurrentUser(conditions); + dbCombineSearch.setUserViewConditions(conditions); } } }