refactor(血源分析-数据集): 调整数据集血缘关系查询结果

返回值修改为数据源和仪表板
This commit is contained in:
wisonic-s 2022-12-28 15:14:24 +08:00
parent 541a1c70c2
commit efcbe1681e
3 changed files with 30 additions and 40 deletions

View File

@ -159,23 +159,25 @@
<select id="queryDatasetRelation" resultType="io.dataease.dto.RelationDTO" resultMap="io.dataease.ext.ExtDataSourceMapper.RelationResultMap">
select
dt.id,
dt.name,
dt_auth.auths,
'dataset' `type`,
pg.id panel_id,
pg.name panel_name,
pg_auth.auths panel_auths,
if(pg.id is not null,'panel',null) pg_type
ds.id,
ds.name,
ds_auth.auths,
'link' `type`,
pg.id sub_id,
pg.name sub_name,
pg_auth.auths sub_auths,
if(pg.id is not null,'panel',null) sub_type
from
dataset_table dt
left join
datasource ds on dt.data_source_id = ds.id
left join
(
select
t_dt.id,group_concat(distinct sad.privilege_type) auths
t_ds.id,group_concat(distinct sad.privilege_type) auths
from
dataset_table t_dt
left join sys_auth sa on sa.auth_source = t_dt.id
datasource t_ds
left join sys_auth sa on sa.auth_source = t_ds.id
left join sys_auth_detail sad on sa.id = sad.auth_id
where
sa.auth_source = #{datasetId,jdbcType=VARCHAR}
@ -199,7 +201,7 @@
)
)
group by sa.auth_source
) dt_auth on dt.id = dt_auth.id
) ds_auth on ds.id = ds_auth.id
left join chart_view cv on cv.table_id = dt.id
left join panel_group pg on cv.scene_id = pg.id
left join
@ -234,7 +236,7 @@
group by sa.auth_source
) pg_auth on pg_auth.id = pg.id
where dt.id=#{datasetId,jdbcType=VARCHAR}
group by id,panel_id
group by id,sub_id
order by id
</select>
</mapper>

View File

@ -11,10 +11,10 @@
<result column="name" property="name"/>
<result column="auths" property="auths"/>
<collection property="subRelation" ofType="io.dataease.dto.RelationDTO">
<id column="panel_id" property="id"/>
<result column="panel_name" property="name"/>
<result column="panel_auths" property="auths"/>
<result column="pg_type" property="type"/>
<id column="sub_id" property="id"/>
<result column="sub_name" property="name"/>
<result column="sub_auths" property="auths"/>
<result column="sub_type" property="type"/>
</collection>
</resultMap>
@ -167,10 +167,10 @@
dt.name,
dt_auth.auths,
'dataset' `type`,
pg.id panel_id,
pg.name panel_name,
pg_auth.auths panel_auths,
if(pg.id is not null,'panel',null) pg_type
pg.id sub_id,
pg.name sub_name,
pg_auth.auths sub_auths,
if(pg.id is not null,'panel',null) sub_type
from
datasource ds
join dataset_table dt on dt.data_source_id = ds.id
@ -239,7 +239,7 @@
group by sa.auth_source
) pg_auth on pg_auth.id = pg.id
where ds.id=#{datasourceId,jdbcType=VARCHAR}
group by id,panel_id
group by id,sub_id
order by id
</select>
</mapper>

View File

@ -14,18 +14,6 @@
<result column="is_default" property="isDefault"/>
</resultMap>
<resultMap id="RelationResultMap" type="io.dataease.dto.RelationDTO">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="auths" property="auths"/>
<collection property="subRelation" ofType="io.dataease.dto.RelationDTO">
<id column="dt_id" property="id"/>
<result column="dt_name" property="name"/>
<result column="dt_auths" property="auths"/>
<result column="dt_type" property="type"/>
</collection>
</resultMap>
<select id="findOneWithPrivileges" resultMap="BaseResultMapDTO">
select panel_group.*,
panel_group.name as label,
@ -238,16 +226,16 @@
</delete>
<select id="queryPanelRelation" resultType="io.dataease.dto.RelationDTO" resultMap="RelationResultMap">
<select id="queryPanelRelation" resultType="io.dataease.dto.RelationDTO" resultMap="io.dataease.ext.ExtDataSourceMapper.RelationResultMap">
select
ds.id,
ds.name,
ds_auth.auths,
'link' `type`,
dt.id dt_id,
dt.name dt_name,
dt_auth.auths dt_auths,
if(dt.id is not null,'dataset',null) dt_type
dt.id sub_id,
dt.name sub_name,
dt_auth.auths sub_auths,
if(dt.id is not null,'dataset',null) sub_type
from
panel_group pg
join
@ -318,7 +306,7 @@
group by sa.auth_source
) ds_auth on ds_auth.id = ds.id
where pg.id=#{panelId,jdbcType=VARCHAR}
group by id,dt_id
group by id,sub_id
order by id
</select>