forked from github/dataease
fix(移动端): 没有角色的用户无法查看分享仪表板
This commit is contained in:
parent
4a165ae0d4
commit
fce9905c23
@ -3,15 +3,15 @@
|
|||||||
<mapper namespace="io.dataease.ext.HomeMapper">
|
<mapper namespace="io.dataease.ext.HomeMapper">
|
||||||
|
|
||||||
<select id="queryStore" resultType="io.dataease.mobile.dto.HomeItemDTO">
|
<select id="queryStore" resultType="io.dataease.mobile.dto.HomeItemDTO">
|
||||||
select
|
select
|
||||||
s.panel_group_id as id,
|
s.panel_group_id as id,
|
||||||
g.name as title,
|
g.name as title,
|
||||||
s.create_time as `time`
|
s.create_time as `time`
|
||||||
from( SELECT GET_V_AUTH_MODEL_ID_P_USE_MOBILE ( #{userId}, 'panel' ) cids ) t, panel_store s
|
from( SELECT GET_V_AUTH_MODEL_ID_P_USE_MOBILE ( #{userId}, 'panel' ) cids ) t, panel_store s
|
||||||
inner join panel_group g
|
inner join panel_group g
|
||||||
on s.panel_group_id = g.id
|
on s.panel_group_id = g.id
|
||||||
where s.user_id = #{userId}
|
where s.user_id = #{userId}
|
||||||
and FIND_IN_SET( g.id, cids )
|
and FIND_IN_SET( g.id, cids )
|
||||||
<if test="lastTime != null">
|
<if test="lastTime != null">
|
||||||
and #{lastTime} > s.create_time
|
and #{lastTime} > s.create_time
|
||||||
</if>
|
</if>
|
||||||
@ -20,25 +20,32 @@
|
|||||||
|
|
||||||
<select id="queryShare" resultType="io.dataease.mobile.dto.HomeItemShareDTO">
|
<select id="queryShare" resultType="io.dataease.mobile.dto.HomeItemShareDTO">
|
||||||
select
|
select
|
||||||
distinct(s.panel_group_id) as id,
|
distinct(s.panel_group_id) as id,
|
||||||
g.name as title,
|
g.name as title,
|
||||||
s.create_time as `time`,
|
s.create_time as `time`,
|
||||||
u.nick_name,
|
u.nick_name,
|
||||||
u.user_id
|
u.user_id
|
||||||
from panel_share s
|
from panel_share s
|
||||||
inner join panel_group g
|
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)
|
left join sys_user u on u.username = IFNULL(s.granter,g.create_by)
|
||||||
where
|
where
|
||||||
g.mobile_layout = 1 and (
|
g.mobile_layout = 1 and (
|
||||||
( s.target_id = #{userId} and s.type = 0 ) or
|
( s.target_id = #{userId} and s.type = 0 )
|
||||||
( s.target_id = #{deptId} and s.type = 2 ) or
|
<if test="deptId != null">
|
||||||
( s.target_id in
|
or ( s.target_id = #{deptId} and s.type = 2 )
|
||||||
<foreach collection="roleIds" item="roleId" open='(' separator=',' close=')'>
|
</if>
|
||||||
#{roleId}
|
|
||||||
</foreach>
|
<if test="roleIds != null">
|
||||||
and s.type = 1 )
|
or
|
||||||
)
|
( s.target_id in
|
||||||
|
<foreach collection="roleIds" item="roleId" open='(' separator=',' close=')'>
|
||||||
|
#{roleId}
|
||||||
|
</foreach>
|
||||||
|
and s.type = 1 )
|
||||||
|
</if>
|
||||||
|
|
||||||
|
)
|
||||||
<if test="lastTime != null">
|
<if test="lastTime != null">
|
||||||
and #{lastTime} > s.create_time
|
and #{lastTime} > s.create_time
|
||||||
</if>
|
</if>
|
||||||
@ -46,6 +53,4 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -11,7 +11,9 @@ import io.dataease.mobile.dto.HomeItemDTO;
|
|||||||
import io.dataease.mobile.dto.HomeItemShareDTO;
|
import io.dataease.mobile.dto.HomeItemShareDTO;
|
||||||
import io.dataease.ext.HomeMapper;
|
import io.dataease.ext.HomeMapper;
|
||||||
import io.dataease.mobile.dto.HomeRequest;
|
import io.dataease.mobile.dto.HomeRequest;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -47,7 +49,10 @@ public class HomeService {
|
|||||||
List<Long> roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
List<Long> roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
param.put("deptId", deptId);
|
param.put("deptId", deptId);
|
||||||
param.put("roleIds", roleIds);
|
if (CollectionUtils.isNotEmpty(roleIds)) {
|
||||||
|
param.put("roleIds", roleIds);
|
||||||
|
}
|
||||||
|
|
||||||
if (null != request.getLastTime()) {
|
if (null != request.getLastTime()) {
|
||||||
param.put("lastTime", request.getLastTime());
|
param.put("lastTime", request.getLastTime());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user