From 82f7b44a0367b9dc1ae6d6cc3c5c72c72f297b7a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 12 Jun 2020 13:46:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AF=BC=E5=85=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AF=A5=E7=BB=B4=E6=8A=A4=E4=BA=BA=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/track/service/TestCaseService.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index ca4743eff9..b66be54637 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; +import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.BeanUtils; @@ -64,6 +65,9 @@ public class TestCaseService { @Resource UserMapper userMapper; + @Resource + UserRoleMapper userRoleMapper; + public void addTestCase(TestCaseWithBLOBs testCase) { testCase.setName(testCase.getName()); TestCaseExample testCaseExample = new TestCaseExample(); @@ -196,10 +200,12 @@ public class TestCaseService { .map(TestCase::getName) .collect(Collectors.toSet()); - UserExample userExample = new UserExample(); - userExample.createCriteria().andLastWorkspaceIdEqualTo(currentWorkspaceId); - List users = userMapper.selectByExample(userExample); - Set userIds = users.stream().map(User::getId).collect(Collectors.toSet()); + UserRoleExample userRoleExample = new UserRoleExample(); + userRoleExample.createCriteria() + .andRoleIdIn(Arrays.asList(RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER)) + .andSourceIdEqualTo(currentWorkspaceId); + + Set userIds = userRoleMapper.selectByExample(userRoleExample).stream().map(UserRole::getUserId).collect(Collectors.toSet()); EasyExcelListener easyExcelListener = null; List> errList = null;