From fce9905c237b90cb727678c31dd577a10ef53a8f Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 2 Nov 2022 16:29:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A7=92=E8=89=B2=E7=9A=84=E7=94=A8=E6=88=B7=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E7=9C=8B=E5=88=86=E4=BA=AB=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/ext/HomeMapper.xml | 51 ++++++++++--------- .../dataease/mobile/service/HomeService.java | 7 ++- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/backend/src/main/java/io/dataease/ext/HomeMapper.xml b/backend/src/main/java/io/dataease/ext/HomeMapper.xml index b31b944a4d..ed3f9a7ac0 100644 --- a/backend/src/main/java/io/dataease/ext/HomeMapper.xml +++ b/backend/src/main/java/io/dataease/ext/HomeMapper.xml @@ -3,15 +3,15 @@ select - distinct(s.panel_group_id) as id, - g.name as title, - s.create_time as `time`, - u.nick_name, - u.user_id + distinct(s.panel_group_id) as id, + g.name as title, + s.create_time as `time`, + u.nick_name, + u.user_id from panel_share s inner join panel_group g - on s.panel_group_id = g.id + on s.panel_group_id = g.id left join sys_user u on u.username = IFNULL(s.granter,g.create_by) where - g.mobile_layout = 1 and ( - ( s.target_id = #{userId} and s.type = 0 ) or - ( s.target_id = #{deptId} and s.type = 2 ) or - ( s.target_id in - - #{roleId} - - and s.type = 1 ) - ) + g.mobile_layout = 1 and ( + ( s.target_id = #{userId} and s.type = 0 ) + + or ( s.target_id = #{deptId} and s.type = 2 ) + + + + or + ( s.target_id in + + #{roleId} + + and s.type = 1 ) + + + ) and #{lastTime} > s.create_time @@ -46,6 +53,4 @@ - - diff --git a/backend/src/main/java/io/dataease/mobile/service/HomeService.java b/backend/src/main/java/io/dataease/mobile/service/HomeService.java index 4dd61a8d12..b7d4d714ad 100644 --- a/backend/src/main/java/io/dataease/mobile/service/HomeService.java +++ b/backend/src/main/java/io/dataease/mobile/service/HomeService.java @@ -11,7 +11,9 @@ import io.dataease.mobile.dto.HomeItemDTO; import io.dataease.mobile.dto.HomeItemShareDTO; import io.dataease.ext.HomeMapper; import io.dataease.mobile.dto.HomeRequest; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; + import javax.annotation.Resource; import java.util.HashMap; import java.util.List; @@ -47,7 +49,10 @@ public class HomeService { List roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList()); param.put("deptId", deptId); - param.put("roleIds", roleIds); + if (CollectionUtils.isNotEmpty(roleIds)) { + param.put("roleIds", roleIds); + } + if (null != request.getLastTime()) { param.put("lastTime", request.getLastTime()); }