forked from github/dataease
fix: 修复仪表盘视图查不出来的问题
This commit is contained in:
parent
e3ab785540
commit
63fa24fcb4
@ -1,12 +1,13 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.dto.panel.PanelViewDto;
|
||||
import io.dataease.dto.panel.po.PanelViewPo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtPanelViewMapper {
|
||||
|
||||
List<PanelViewPo> groups(String userId);
|
||||
List<PanelViewDto> groups(String userId);
|
||||
|
||||
List<PanelViewPo> views(String userId);
|
||||
List<PanelViewDto> views(String userId);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="io.dataease.base.mapper.ext.ExtPanelViewMapper">
|
||||
|
||||
<resultMap id="treeNodeMap" type="io.dataease.dto.panel.po.PanelViewPo">
|
||||
<resultMap id="treeNodeMap" type="io.dataease.dto.panel.PanelViewDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="pid" property="pid" />
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
<select id="groups" resultMap="treeNodeMap">
|
||||
select id, pid, name, `type`
|
||||
select id, ifnull(pid,0) as pid, name, `type`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'chart') cids) t,chart_group
|
||||
<where>
|
||||
FIND_IN_SET(chart_group.id,cids)
|
||||
|
@ -3,6 +3,7 @@ package io.dataease.controller.panel.server;
|
||||
import io.dataease.base.domain.ChartView;
|
||||
import io.dataease.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.TreeUtils;
|
||||
import io.dataease.controller.panel.api.ViewApi;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
@ -10,6 +11,7 @@ import io.dataease.dto.panel.PanelViewDto;
|
||||
import io.dataease.dto.panel.po.PanelViewPo;
|
||||
import io.dataease.service.chart.ChartViewService;
|
||||
import io.dataease.service.panel.PanelViewService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -35,10 +37,13 @@ public class ViewServer implements ViewApi {
|
||||
*/
|
||||
@Override
|
||||
public List<PanelViewDto> treeWithAuth() {
|
||||
List<PanelViewPo> groups = panelViewService.groups();
|
||||
List<PanelViewPo> views = panelViewService.views();
|
||||
List<PanelViewDto> panelViewDtos = panelViewService.buildTree(groups, views);
|
||||
return panelViewDtos;
|
||||
List<PanelViewDto> groups = panelViewService.groups();
|
||||
List<PanelViewDto> views = panelViewService.views();
|
||||
if(CollectionUtils.isNotEmpty(groups)&&CollectionUtils.isNotEmpty(views)){
|
||||
groups.addAll(views);
|
||||
}
|
||||
// List<PanelViewDto> panelViewDtos = panelViewService.buildTree(groups, views);
|
||||
return TreeUtils.mergeTree(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.dto.panel;
|
||||
|
||||
import io.dataease.commons.model.ITreeBase;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -7,7 +8,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Data
|
||||
public class PanelViewDto {
|
||||
public class PanelViewDto implements ITreeBase<PanelViewDto> {
|
||||
|
||||
private String id;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package io.dataease.dto.panel.po;
|
||||
|
||||
import io.dataease.commons.model.ITreeBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PanelViewPo {
|
||||
public class PanelViewPo{
|
||||
|
||||
private String id;
|
||||
|
||||
|
@ -26,11 +26,11 @@ public class PanelViewService {
|
||||
|
||||
private final static String SCENE_TYPE = "scene";
|
||||
|
||||
public List<PanelViewPo> groups(){
|
||||
public List<PanelViewDto> groups(){
|
||||
return extPanelViewMapper.groups(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
}
|
||||
|
||||
public List<PanelViewPo> views(){
|
||||
public List<PanelViewDto> views(){
|
||||
return extPanelViewMapper.views(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,7 @@ export default {
|
||||
.tree-main{
|
||||
height: calc(100vh - 210px);
|
||||
border: 1px solid #e6e6e6;
|
||||
overflow-y: auto!important;
|
||||
}
|
||||
.tree-head{
|
||||
height: 30px;
|
||||
|
Loading…
Reference in New Issue
Block a user