|
@@ -0,0 +1,27 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+// 文件导入表
|
|
|
+const OptlogSchema = {
|
|
|
+ userid: { type: String, required: true, maxLength: 64 }, // 操作人
|
|
|
+ name: { type: String, required: false, maxLength: 200 }, // 名称
|
|
|
+ unitid: { type: String, required: true, maxLength: 64 }, // 学校/分站id
|
|
|
+ ip: { type: String, required: false, maxLength: 64 }, // ip地址
|
|
|
+ createtime: { type: String, required: false, maxLength: 20 }, // 时间
|
|
|
+ type: { type: String, required: false, maxLength: 64 }, // 操作类型: 1. 添加 2.修改 3. 删除 4.查询
|
|
|
+ target: { type: String, required: false, maxLength: 200 }, // 操作目标,根据页面的menu页区分
|
|
|
+ content: { type: String, required: false, maxLength: 64 }, // 描述
|
|
|
+ status: { type: String, required: false, maxLength: 2 }, // 操作结果
|
|
|
+ remark: { type: String, required: false, maxLength: 200 }, // 备注
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+const schema = new Schema(OptlogSchema, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ userid: 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Optlog', schema, 'opt_log');
|
|
|
+};
|