28 lines
773 B
JavaScript
28 lines
773 B
JavaScript
'use strict';
|
|
//获取数据库模型列表
|
|
module.exports = {
|
|
params: {},
|
|
fun : async (ctx, app) => {
|
|
const {} = ctx.params
|
|
const data = Object.keys($db.models).map(item => {
|
|
let tableAttributes = $db.models[item].tableAttributes
|
|
let ta = {}
|
|
Object.keys(tableAttributes).forEach(ta_item => {
|
|
ta[ta_item] = {
|
|
fieldName: tableAttributes[ta_item].fieldName,//字段名
|
|
field : tableAttributes[ta_item].field,//字段
|
|
headName : tableAttributes[ta_item].fieldNameCus,//字段自定义名
|
|
comment : tableAttributes[ta_item].comment,//注释
|
|
|
|
}
|
|
})
|
|
return {
|
|
tableName : $db.models[item].tableName,
|
|
tableAttributes: ta,
|
|
primaryKeyField: $db.models[item].primaryKeyField,
|
|
}
|
|
})
|
|
return data
|
|
}
|
|
}
|