diff --git a/api/app/lib/controllers/dataService/index.js b/api/app/lib/controllers/dataService/index.js index 52b08a7..a3c01c5 100644 --- a/api/app/lib/controllers/dataService/index.js +++ b/api/app/lib/controllers/dataService/index.js @@ -96,34 +96,26 @@ function getLookField (opts) { let option = { where: { - $or: [] - // code: table, - // 'metadataDatabase.code': fields + code: table, }, order: [["id", "desc"]], include: [{ model: models.MetadataDatabase, - include: [{ - model: models.MetadataDatabase, - }], + where: { code: fields, }, distinct: true }], distinct: true } - option.where.$or.push( - { - code: table, - } - ) - option.where.$or.push( - { - '$metadataDatabase.code$': fields - }, - ) - let res = await models.MetadataDatabase.findOne(option) + let list = await models.MetadataDatabase.findOne(option) + let res = await models.MetadataDatabase.findAll({ + where: { + type: '字段', + parent: list && list.metadataDatabases[0] && list.metadataDatabases[0].id + } + }) ctx.status = 200; diff --git a/api/app/lib/controllers/latestMetadata/index.js b/api/app/lib/controllers/latestMetadata/index.js index 25f629b..49625f8 100644 --- a/api/app/lib/controllers/latestMetadata/index.js +++ b/api/app/lib/controllers/latestMetadata/index.js @@ -819,8 +819,8 @@ async function listStructuredData (ctx) { const models = ctx.fs.dc.models; const { id, parent } = ctx.query; - let field = await models.MetadataDatabase.findAll({ where: { parent: id } }) || [] - let database = await models.MetadataDatabase.findOne({ where: { id: parent } }) || {} + let field = await models.MetadataDatabase.findAll({ where: { parent: id, type: '字段' } }) || [] + let database = await models.MetadataDatabase.findOne({ where: { id: parent, type: '库' } }) || {} ctx.status = 200; ctx.body = { @@ -831,7 +831,7 @@ async function listStructuredData (ctx) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { - "message": "获取元数据资源申请记录失败" + "message": "获取对表的库与字段信息失败" } } } diff --git a/web/client/src/sections/dataService/components/editModal.js b/web/client/src/sections/dataService/components/editModal.js index 0c0f844..7998034 100644 --- a/web/client/src/sections/dataService/components/editModal.js +++ b/web/client/src/sections/dataService/components/editModal.js @@ -12,7 +12,7 @@ function EditModal ({ loading, parent, user, actions, editData = {}, dispatch, c const { dataService } = actions const [lookFiold, setLookFiold] = useState([]); const [interfaceName, setInterfaceName] = useState() - + useEffect(() => { setInterfaceName(editData?.name); dispatch(dataService.getLookField({ table: editData?.table, fields: editData?.fields })).then(res => { @@ -62,7 +62,7 @@ function EditModal ({ loading, parent, user, actions, editData = {}, dispatch, c
意义
说明
- {lookFiold?.metadataDatabases?.map((s, index) => { + {lookFiold?.map((s, index) => { return
{s.code}
{s.name}