feat(仪表板): 新增批量获取数据集字段列表接口

This commit is contained in:
junjun 2024-06-18 10:17:09 +08:00
parent 20b8421d0c
commit 2eb8e67e97
3 changed files with 24 additions and 2 deletions

View File

@ -2,17 +2,17 @@ package io.dataease.dataset.manage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.dataease.api.chart.dto.ColumnPermissionItem;
import io.dataease.extensions.view.model.SQLObj;
import io.dataease.dataset.dao.auto.entity.CoreDatasetTableField;
import io.dataease.dataset.dao.auto.mapper.CoreDatasetGroupMapper;
import io.dataease.dataset.dao.auto.mapper.CoreDatasetTableFieldMapper;
import io.dataease.dataset.utils.TableUtils;
import io.dataease.datasource.provider.CalciteProvider;
import io.dataease.extensions.view.dto.DatasetTableFieldDTO;
import io.dataease.engine.constant.ExtFieldConstant;
import io.dataease.engine.func.FunctionConstant;
import io.dataease.engine.utils.Utils;
import io.dataease.exception.DEException;
import io.dataease.extensions.view.dto.DatasetTableFieldDTO;
import io.dataease.extensions.view.model.SQLObj;
import io.dataease.i18n.Translator;
import io.dataease.utils.AuthUtils;
import io.dataease.utils.BeanUtils;
@ -160,6 +160,19 @@ public class DatasetTableFieldManage {
return transDTO(coreDatasetTableFieldMapper.selectList(wrapper));
}
public Map<String, List<DatasetTableFieldDTO>> selectByDatasetGroupIds(List<Long> ids) {
Map<String, List<DatasetTableFieldDTO>> map = new HashMap<>();
QueryWrapper<CoreDatasetTableField> wrapper = new QueryWrapper<>();
for (Long id : ids) {
wrapper.eq("dataset_group_id", id);
wrapper.eq("checked", true);
wrapper.isNull("chart_id");
wrapper.eq("ext_field", 0);
map.put(String.valueOf(id), transDTO(coreDatasetTableFieldMapper.selectList(wrapper)));
}
return map;
}
public List<DatasetTableFieldDTO> selectByFieldIds(List<Long> ids) {
QueryWrapper<CoreDatasetTableField> wrapper = new QueryWrapper<>();
wrapper.in("id", ids);

View File

@ -43,6 +43,11 @@ public class DatasetFieldServer implements DatasetTableApi {
return datasetTableFieldManage.selectByDatasetGroupId(id);
}
@Override
public Map<String, List<DatasetTableFieldDTO>> listByDsIds(List<Long> ids) {
return datasetTableFieldManage.selectByDatasetGroupIds(ids);
}
@Override
public void delete(Long id) {
datasetTableFieldManage.deleteById(id);

View File

@ -40,6 +40,10 @@ public interface DatasetTableApi {
@PostMapping("listByDatasetGroup/{id}")
List<DatasetTableFieldDTO> listByDatasetGroup(@PathVariable Long id);
@Operation(summary = "获取数据集字段map")
@PostMapping("listByDsIds")
Map<String, List<DatasetTableFieldDTO>> listByDsIds(@RequestBody List<Long> ids);
@Operation(summary = "删除字段")
@PostMapping("delete/{id}")
void delete(@PathVariable Long id);