feat: 数据库数据集允许重复创建
This commit is contained in:
parent
dafc481f59
commit
e2786874a9
@ -51,7 +51,6 @@ import io.dataease.service.message.DeMsgutil;
|
|||||||
import io.dataease.service.sys.SysAuthService;
|
import io.dataease.service.sys.SysAuthService;
|
||||||
import io.dataease.service.system.SystemParameterService;
|
import io.dataease.service.system.SystemParameterService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
@ -431,11 +430,7 @@ public class DatasourceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<TableDesc> tables = datasourceProvider.getTables(datasourceRequest);
|
List<TableDesc> tables = datasourceProvider.getTables(datasourceRequest);
|
||||||
|
// 构造table节点
|
||||||
// 获取当前数据源下的db、api类型数据集
|
|
||||||
DatasetTableExample datasetTableExample = new DatasetTableExample();
|
|
||||||
datasetTableExample.createCriteria().andTypeIn(Arrays.asList(DatasetType.DB.name(), DatasetType.API.name())).andDataSourceIdEqualTo(ds.getId());
|
|
||||||
List<DatasetTable> datasetTables = datasetTableMapper.selectByExample(datasetTableExample);
|
|
||||||
List<DBTableDTO> list = new ArrayList<>();
|
List<DBTableDTO> list = new ArrayList<>();
|
||||||
for (TableDesc tableDesc : tables) {
|
for (TableDesc tableDesc : tables) {
|
||||||
DBTableDTO dbTableDTO = new DBTableDTO();
|
DBTableDTO dbTableDTO = new DBTableDTO();
|
||||||
@ -444,22 +439,6 @@ public class DatasourceService {
|
|||||||
dbTableDTO.setRemark(tableDesc.getRemark());
|
dbTableDTO.setRemark(tableDesc.getRemark());
|
||||||
dbTableDTO.setEnableCheck(true);
|
dbTableDTO.setEnableCheck(true);
|
||||||
dbTableDTO.setDatasetPath(null);
|
dbTableDTO.setDatasetPath(null);
|
||||||
for (DatasetTable datasetTable : datasetTables) {
|
|
||||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
|
||||||
if (StringUtils.equals(tableDesc.getName(), dataTableInfoDTO.getTable())) {
|
|
||||||
dbTableDTO.setEnableCheck(false);
|
|
||||||
List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId());
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
parents.forEach(ele -> {
|
|
||||||
if (ObjectUtils.isNotEmpty(ele)) {
|
|
||||||
stringBuilder.append(ele.getName()).append("/");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
stringBuilder.append(datasetTable.getName());
|
|
||||||
dbTableDTO.setDatasetPath(stringBuilder.toString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.add(dbTableDTO);
|
list.add(dbTableDTO);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@ -73,43 +73,34 @@
|
|||||||
v-model="checkTableList"
|
v-model="checkTableList"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<el-tooltip
|
<div
|
||||||
v-for="t in tableData"
|
:class="[
|
||||||
:key="t.name"
|
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
||||||
:disabled="t.enableCheck"
|
]"
|
||||||
effect="dark"
|
class="item"
|
||||||
:content="$t('dataset.table_already_add_to') + ': ' + t.datasetPath"
|
:title="t.name"
|
||||||
placement="right"
|
@click="setActiveName(t)"
|
||||||
>
|
>
|
||||||
<div
|
<svg-icon
|
||||||
:class="[
|
v-if="!t.enableCheck"
|
||||||
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
icon-class="Checkbox"
|
||||||
]"
|
style="margin-right: 8px"
|
||||||
class="item"
|
/>
|
||||||
:title="t.name"
|
<el-checkbox
|
||||||
@click="setActiveName(t)"
|
v-else
|
||||||
|
:label="t.name"
|
||||||
|
/>
|
||||||
|
<span class="label">{{ showTableNameWithComment(t) }}</span>
|
||||||
|
<span
|
||||||
|
v-if="t.nameExist"
|
||||||
|
class="error-name-exist"
|
||||||
>
|
>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
v-if="!t.enableCheck"
|
icon-class="exclamationmark"
|
||||||
icon-class="Checkbox"
|
class="ds-icon-scene"
|
||||||
style="margin-right: 8px"
|
|
||||||
/>
|
/>
|
||||||
<el-checkbox
|
</span>
|
||||||
v-else
|
</div>
|
||||||
:label="t.name"
|
|
||||||
/>
|
|
||||||
<span class="label">{{ showTableNameWithComment(t) }}</span>
|
|
||||||
<span
|
|
||||||
v-if="t.nameExist"
|
|
||||||
class="error-name-exist"
|
|
||||||
>
|
|
||||||
<svg-icon
|
|
||||||
icon-class="exclamationmark"
|
|
||||||
class="ds-icon-scene"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -73,44 +73,35 @@
|
|||||||
v-model="checkTableList"
|
v-model="checkTableList"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<el-tooltip
|
<div
|
||||||
v-for="t in tableData"
|
:class="[
|
||||||
:key="t.name"
|
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
||||||
:disabled="t.enableCheck"
|
]"
|
||||||
effect="dark"
|
class="item"
|
||||||
:content="$t('dataset.table_already_add_to') + ': ' + t.datasetPath"
|
:title="t.name"
|
||||||
placement="right"
|
@click="setActiveName(t)"
|
||||||
>
|
>
|
||||||
<div
|
<svg-icon
|
||||||
:class="[
|
v-if="!t.enableCheck"
|
||||||
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
icon-class="Checkbox"
|
||||||
]"
|
style="margin-right: 8px"
|
||||||
class="item"
|
/>
|
||||||
:title="t.name"
|
<el-checkbox
|
||||||
@click="setActiveName(t)"
|
v-else
|
||||||
|
:label="t.name"
|
||||||
|
:disabled="!t.enableCheck"
|
||||||
|
/>
|
||||||
|
<span class="label">{{ showTableNameWithComment(t) }}</span>
|
||||||
|
<span
|
||||||
|
v-if="t.nameExist"
|
||||||
|
class="error-name-exist"
|
||||||
>
|
>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
v-if="!t.enableCheck"
|
icon-class="exclamationmark"
|
||||||
icon-class="Checkbox"
|
class="ds-icon-scene"
|
||||||
style="margin-right: 8px"
|
|
||||||
/>
|
/>
|
||||||
<el-checkbox
|
</span>
|
||||||
v-else
|
</div>
|
||||||
:label="t.name"
|
|
||||||
:disabled="!t.enableCheck"
|
|
||||||
/>
|
|
||||||
<span class="label">{{ showTableNameWithComment(t) }}</span>
|
|
||||||
<span
|
|
||||||
v-if="t.nameExist"
|
|
||||||
class="error-name-exist"
|
|
||||||
>
|
|
||||||
<svg-icon
|
|
||||||
icon-class="exclamationmark"
|
|
||||||
class="ds-icon-scene"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user