forked from github/dataease
feat(仪表板): 增加获取仪表板列表的接口
This commit is contained in:
parent
1f2005712b
commit
54d9f5d5f1
@ -14,6 +14,7 @@ import io.dataease.dto.PermissionProxy;
|
||||
import io.dataease.dto.authModel.VAuthModelDTO;
|
||||
import io.dataease.dto.panel.PanelExport2App;
|
||||
import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.plugins.common.base.domain.PanelGroup;
|
||||
import io.dataease.service.panel.PanelGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -50,6 +51,12 @@ public class PanelGroupController {
|
||||
return panelGroupService.tree(request);
|
||||
}
|
||||
|
||||
@ApiOperation("查询当前用户仪表板")
|
||||
@GetMapping("/list")
|
||||
public List<PanelGroup> list() {
|
||||
return panelGroupService.list();
|
||||
}
|
||||
|
||||
@ApiOperation("默认树")
|
||||
@PostMapping("/defaultTree")
|
||||
public List<PanelGroupDTO> defaultTree(@RequestBody PanelGroupRequest request) {
|
||||
|
@ -3,6 +3,7 @@ package io.dataease.ext;
|
||||
import io.dataease.controller.request.panel.PanelGroupRequest;
|
||||
import io.dataease.dto.RelationDTO;
|
||||
import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.plugins.common.base.domain.PanelGroup;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -30,4 +31,6 @@ public interface ExtPanelGroupMapper {
|
||||
List<PanelGroupDTO> panelGroupInit();
|
||||
|
||||
List<RelationDTO> queryPanelRelation(@Param("panelId") String panelId, @Param("userId") Long userId);
|
||||
|
||||
List<PanelGroup> listPanelByUser(@Param("userId") long userId);
|
||||
}
|
||||
|
@ -320,4 +320,38 @@
|
||||
where pg.id=#{panelId,jdbcType=VARCHAR}
|
||||
group by dt.id
|
||||
</select>
|
||||
|
||||
<select id="listPanelByUser" resultType="io.dataease.plugins.common.base.domain.PanelGroup"
|
||||
resultMap="io.dataease.plugins.common.base.mapper.PanelGroupMapper.BaseResultMap">
|
||||
select
|
||||
pg.*
|
||||
from
|
||||
panel_group pg
|
||||
join sys_auth sa on sa.auth_source = pg.id
|
||||
join sys_auth_detail sad on sa.id = sad.auth_id
|
||||
where
|
||||
pg.node_type = 'panel'
|
||||
and
|
||||
sa.auth_source_type = 'panel'
|
||||
and
|
||||
sad.privilege_value = 1
|
||||
and
|
||||
(
|
||||
(
|
||||
sa.auth_target_type = 'dept'
|
||||
AND sa.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = #{userId,jdbcType=BIGINT} )
|
||||
)
|
||||
OR
|
||||
(
|
||||
sa.auth_target_type = 'user'
|
||||
AND sa.auth_target = #{userId,jdbcType=BIGINT}
|
||||
)
|
||||
OR
|
||||
(
|
||||
sa.auth_target_type = 'role'
|
||||
AND sa.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId,jdbcType=BIGINT} )
|
||||
)
|
||||
)
|
||||
group by pg.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.dataease.auth.annotation.DeCleaner;
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.commons.constants.*;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.authModel.VAuthModelRequest;
|
||||
@ -151,6 +152,17 @@ public class PanelGroupService {
|
||||
return TreeUtils.mergeTree(panelGroupDTOList, "default_panel");
|
||||
}
|
||||
|
||||
public List<PanelGroup> list() {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
if (user.getIsAdmin()) {
|
||||
PanelGroupExample example = new PanelGroupExample();
|
||||
example.setOrderByClause("name");
|
||||
example.createCriteria().andNodeTypeEqualTo("panel");
|
||||
return panelGroupMapper.selectByExample(example);
|
||||
}
|
||||
return extPanelGroupMapper.listPanelByUser(user.getUserId());
|
||||
}
|
||||
|
||||
@DeCleaner(value = DePermissionType.PANEL, key = "pid")
|
||||
public String save(PanelGroupRequest request) {
|
||||
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
|
||||
|
Loading…
Reference in New Issue
Block a user