forked from github/dataease
Merge pull request #6364 from dataease/pr@dev-v2@fixDatasource
fix: 数据源移动校验
This commit is contained in:
commit
5fbb84482c
@ -19,8 +19,6 @@ import io.dataease.api.permissions.user.vo.UserFormVO;
|
|||||||
import io.dataease.commons.constants.TaskStatus;
|
import io.dataease.commons.constants.TaskStatus;
|
||||||
import io.dataease.commons.utils.CommonThreadPool;
|
import io.dataease.commons.utils.CommonThreadPool;
|
||||||
import io.dataease.constant.DataSourceType;
|
import io.dataease.constant.DataSourceType;
|
||||||
import io.dataease.dataset.dao.auto.entity.CoreDatasetTable;
|
|
||||||
import io.dataease.dataset.dao.auto.mapper.CoreDatasetTableMapper;
|
|
||||||
import io.dataease.dataset.dto.DatasourceSchemaDTO;
|
import io.dataease.dataset.dto.DatasourceSchemaDTO;
|
||||||
import io.dataease.dataset.manage.DatasetDataManage;
|
import io.dataease.dataset.manage.DatasetDataManage;
|
||||||
import io.dataease.dataset.utils.TableUtils;
|
import io.dataease.dataset.utils.TableUtils;
|
||||||
@ -109,6 +107,14 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
|
|
||||||
private boolean isUpdatingStatus = false;
|
private boolean isUpdatingStatus = false;
|
||||||
|
|
||||||
|
private void getParents(Long pid, List<Long> ids) {
|
||||||
|
CoreDatasource parent = datasourceMapper.selectById(pid);// 查找父级folder
|
||||||
|
ids.add(parent.getId());
|
||||||
|
if (parent.getPid() != null && parent.getPid() != 0) {
|
||||||
|
getParents(parent.getPid(), ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void move(DatasourceDTO dataSourceDTO) throws DEException {
|
public void move(DatasourceDTO dataSourceDTO) throws DEException {
|
||||||
switch (dataSourceDTO.getAction()) {
|
switch (dataSourceDTO.getAction()) {
|
||||||
case "move" -> {
|
case "move" -> {
|
||||||
@ -116,7 +122,12 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
DEException.throwException("目录必选!");
|
DEException.throwException("目录必选!");
|
||||||
}
|
}
|
||||||
if (Objects.equals(dataSourceDTO.getId(), dataSourceDTO.getPid())) {
|
if (Objects.equals(dataSourceDTO.getId(), dataSourceDTO.getPid())) {
|
||||||
DEException.throwException("pid can not equal to id.");
|
DEException.throwException(Translator.get("i18n_pid_not_eq_id"));
|
||||||
|
}
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
getParents(dataSourceDTO.getPid(), ids);
|
||||||
|
if (ids.contains(dataSourceDTO.getId())) {
|
||||||
|
DEException.throwException(Translator.get("i18n_pid_not_eq_id"));
|
||||||
}
|
}
|
||||||
dataSourceManage.move(dataSourceDTO);
|
dataSourceManage.move(dataSourceDTO);
|
||||||
}
|
}
|
||||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
|||||||
Subproject commit e3143e3176ca189c35729fa7bb195264c061a824
|
Subproject commit 0a8337cd2b6ea435977c22614c2a24bc9460c6c9
|
Loading…
Reference in New Issue
Block a user