mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
feat: 视图数据集权限控制
This commit is contained in:
@@ -7,4 +7,6 @@ import java.util.List;
|
||||
|
||||
public interface ExtDataSetTableMapper {
|
||||
List<DataSetTableDTO> search(DataSetTableRequest request);
|
||||
|
||||
DataSetTableDTO searchOne(DataSetTableRequest request);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,33 @@
|
||||
<result column="privileges" property="privileges"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="searchOne" resultMap="BaseResultMapDTO">
|
||||
select
|
||||
id, `name`, scene_id, data_source_id, `type`, `mode`,`info`, create_by, create_time,
|
||||
get_auths(id,'dataset',#{userId}) as `privileges`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'dataset') cids) t,dataset_table
|
||||
<where>
|
||||
FIND_IN_SET(dataset_table.id,cids)
|
||||
<if test="id != null">
|
||||
and id = #{id,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="sceneId != null">
|
||||
and scene_id = #{sceneId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="mode != null">
|
||||
and mode = #{mode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="typeFilter != null">
|
||||
and type in
|
||||
<foreach collection="typeFilter" item="item" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="BaseResultMapDTO">
|
||||
select
|
||||
@@ -31,7 +58,5 @@
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -54,6 +54,11 @@ public class DataSetTableController {
|
||||
return dataSetTableService.get(id);
|
||||
}
|
||||
|
||||
@PostMapping("getWithPermission/{id}")
|
||||
public DataSetTableDTO getWithPermission(@PathVariable String id) {
|
||||
return dataSetTableService.getWithPermission(id);
|
||||
}
|
||||
|
||||
@PostMapping("getFields")
|
||||
public List<TableFiled> getFields(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
return dataSetTableService.getFields(dataSetTableRequest);
|
||||
|
||||
@@ -215,6 +215,14 @@ public class DataSetTableService {
|
||||
return datasetTableMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public DataSetTableDTO getWithPermission(String id) {
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
dataSetTableRequest.setId(id);
|
||||
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
|
||||
return extDataSetTableMapper.searchOne(dataSetTableRequest);
|
||||
}
|
||||
|
||||
public List<TableFiled> getFields(DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
|
||||
Reference in New Issue
Block a user