| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -114,8 +114,14 @@ async function delResourceCatalog(ctx) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					async function getMetadataDatabases(ctx) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const models = ctx.fs.dc.models; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const { catalog, limit, offset, keywords, orderBy = 'createAt', orderDirection = 'desc' } = ctx.query; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const where = { catalog: catalog }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const { catalog, limit, offset, keywords, orderBy = 'createAt', orderDirection = 'desc', id = null } = ctx.query; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const where = {}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (catalog) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            where.catalog = catalog; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (id) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            where.parent = id; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (keywords) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            where['$or'] = [{ name: { $iLike: `%${keywords}%` } }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { code: { $iLike: `%${keywords}%` } }, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -278,6 +284,36 @@ async function postMeatadataDatabases(ctx) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//获取库表元数据基本信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					async function getMetadataDatabasesById(ctx) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const models = ctx.fs.dc.models; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const { id } = ctx.params; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const findObj = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            include: [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    model: models.User, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    attributes: ['id', 'name', 'username'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    model: models.TagDatabase, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    include: [{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        model: models.Tag, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            where: { id: id }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const rslt = await models.MetadataDatabase.findOne(findObj); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ctx.status = 200; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ctx.body = rslt; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } catch (error) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ctx.status = 400; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ctx.body = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            "message": "获取库表元数据基本信息失败" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					module.exports = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    getResourceCatalog, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    postResourceCatalog, | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -289,5 +325,6 @@ module.exports = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    getMetadataModels, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    postMeatadataDatabases, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // putMeatadataDatabases,
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // delMeatadataDatabases
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // delMeatadataDatabases,
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    getMetadataDatabasesById | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |