初始化

This commit is contained in:
robin
2022-08-02 19:21:03 +08:00
parent 73c1343060
commit b7e5ee5fec
27 changed files with 564 additions and 156 deletions
+27
View File
@@ -0,0 +1,27 @@
'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
}
}
+12
View File
@@ -0,0 +1,12 @@
'use strict';
module.exports = {
params: {
"taskList": "array",
},
fun : async (ctx, app) => {
const {taskList} = ctx.params
const data = await $db.jsonTasks(taskList)
return data
}
}
+20
View File
@@ -0,0 +1,20 @@
module.exports = {
doc : "数据库模型映射到前端目录表",
api : true,//是否需要生成api接口
model: {
// id : {type: "INTEGER", comment: '导航id', primaryKey: true},
name: {type: "STRING", comment: '导航名称'},
path: {type: "STRING", comment: '导航路径'},
index: {type: "INTEGER", comment: '权重,越大越靠前'},
icon : {type: "STRING", comment: '图标'},
group: {type: "STRING", comment: '导航分组'},
table: {type: "STRING", comment: '绑定的表名'},
table_key: {type: "STRING", comment: '表的主键名称,一般是id'},
search: {type: "STRING", comment: '模糊查询的字段用/分割'},
table_field: {type: "JSON", comment: '表格字段'},
table_field_key: {type: "JSON", comment: '已选择的字段'},
user: {type: "JSON", comment: '查询表字段的时候,默认带上的用户数据,比如["oid"],这样用户就只能看到自己机构的数据'},
},
}