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