From 71d0091a839e09fb5188801e88ed87d4a4061461 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 19 Nov 2024 11:45:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9D=83=E9=99=90=E9=A1=B9=E7=9B=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96=E4=BB=A5=E5=8F=8A=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=A9=BA=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/service/DashboardService.java | 10 +++++--- .../project/mapper/ExtProjectMapper.java | 8 ------- .../project/mapper/ExtProjectMapper.xml | 23 ------------------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index cf28ff597f..34d698bd41 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -331,8 +331,12 @@ public class DashboardService { UserLayout userLayout = new UserLayout(); userLayout.setUserId(userId); userLayout.setOrgId(organizationId); - String configuration = JSON.toJSONString(saveList); - userLayout.setConfiguration(configuration.getBytes()); + if (CollectionUtils.isEmpty(saveList)) { + userLayout.setConfiguration(new byte[0]); + } else { + String configuration = JSON.toJSONString(saveList); + userLayout.setConfiguration(configuration.getBytes()); + } if (CollectionUtils.isEmpty(userLayouts)) { userLayout.setId(IDGenerator.nextStr()); userLayoutMapper.insert(userLayout); @@ -347,7 +351,7 @@ public class DashboardService { UserLayoutExample userLayoutExample = new UserLayoutExample(); userLayoutExample.createCriteria().andUserIdEqualTo(userId).andOrgIdEqualTo(organizationId); List userLayouts = userLayoutMapper.selectByExampleWithBLOBs(userLayoutExample); - List allPermissionProjects = extProjectMapper.getUserProjectIdName(organizationId, null, userId); + ListallPermissionProjects = extProjectMapper.getProjectNameModule(organizationId, null); if (CollectionUtils.isEmpty(allPermissionProjects)) { return new ArrayList<>(); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.java b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.java index dfe1afd227..7f0f1ca42a 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.java @@ -34,14 +34,6 @@ public interface ExtProjectMapper { List getProjectNameModule(@Param("organizationId") String organizationId, @Param("ids") ListprojectIds); - /** - * 获取用户在所选项目中仍然有任意权限的项目 - * @param organizationId 组织id - * @param projectIds 所选项目ids - * @param userId 用户 - * @return List - */ - List getUserProjectIdName(@Param("organizationId") String organizationId, @Param("ids") ListprojectIds, @Param("userId") String userId); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.xml index d96048f300..166a84d5d2 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMapper.xml @@ -132,27 +132,4 @@ - - - \ No newline at end of file