forked from github/dataease
feat: 编辑仪表板时 由查询自建视图 修改为查询有权限的视图
This commit is contained in:
parent
eeb331d522
commit
5e277bfd3a
@ -1,13 +1,12 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.dto.panel.po.PanelViewPo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtPanelViewMapper {
|
||||
|
||||
List<PanelViewPo> groups(GridExample example);
|
||||
List<PanelViewPo> groups(String userId);
|
||||
|
||||
List<PanelViewPo> views(GridExample example);
|
||||
List<PanelViewPo> views(String userId);
|
||||
}
|
||||
|
@ -11,32 +11,23 @@
|
||||
|
||||
|
||||
|
||||
<select id="groups" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="treeNodeMap">
|
||||
<select id="groups" resultMap="treeNodeMap">
|
||||
select id, pid, name, `type`
|
||||
from chart_group
|
||||
<if test="_parameter != null">
|
||||
<include refid="io.dataease.base.mapper.ext.query.GridSql.gridCondition" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="orderByClause == null">
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'chart') cids) t,chart_group
|
||||
<where>
|
||||
FIND_IN_SET(chart_group.id,cids)
|
||||
</where>
|
||||
order by create_time desc
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="views" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="treeNodeMap">
|
||||
select id, scene_id as pid ,title as name, `type`
|
||||
from chart_view
|
||||
<if test="_parameter != null">
|
||||
<include refid="io.dataease.base.mapper.ext.query.GridSql.gridCondition" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="orderByClause == null">
|
||||
<select id="views" resultMap="treeNodeMap">
|
||||
select id, scene_id as pid , name, `type`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'chart') cids) t, chart_view
|
||||
<where>
|
||||
FIND_IN_SET(chart_view.id,cids)
|
||||
</where>
|
||||
order by create_time desc
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -18,9 +18,13 @@ import java.util.List;
|
||||
public interface ViewApi {
|
||||
|
||||
|
||||
@ApiOperation("视图树")
|
||||
// @ApiOperation("视图树")
|
||||
// @PostMapping("/tree")
|
||||
// List<PanelViewDto> tree(BaseGridRequest request);
|
||||
|
||||
@ApiOperation("授权的视图树")
|
||||
@PostMapping("/tree")
|
||||
List<PanelViewDto> tree(BaseGridRequest request);
|
||||
List<PanelViewDto> treeWithAuth();
|
||||
|
||||
|
||||
@ApiOperation("根据仪表板Id查询视图")
|
||||
|
@ -34,16 +34,9 @@ public class ViewServer implements ViewApi {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PanelViewDto> tree(@RequestBody BaseGridRequest request) {
|
||||
List<ConditionEntity> conditions = new ArrayList<>();
|
||||
ConditionEntity condition = new ConditionEntity();
|
||||
condition.setField("create_by");
|
||||
condition.setOperator("eq");
|
||||
condition.setValue(AuthUtils.getUser().getUsername());
|
||||
conditions.add(condition);
|
||||
request.setConditions(conditions);
|
||||
List<PanelViewPo> groups = panelViewService.groups(request);
|
||||
List<PanelViewPo> views = panelViewService.views(request);
|
||||
public List<PanelViewDto> treeWithAuth() {
|
||||
List<PanelViewPo> groups = panelViewService.groups();
|
||||
List<PanelViewPo> views = panelViewService.views();
|
||||
List<PanelViewDto> panelViewDtos = panelViewService.buildTree(groups, views);
|
||||
return panelViewDtos;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user