1
This commit is contained in:
41
api/model/sof_sofawa.js
Normal file
41
api/model/sof_sofawa.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
|
||||
module.exports = sof_sofawa = db.define("sof_sofawa", {
|
||||
|
||||
sofaKey: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件key",
|
||||
},
|
||||
title: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件名称",
|
||||
},
|
||||
version: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件版本",
|
||||
},
|
||||
down_url: {
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件版本",
|
||||
},
|
||||
file_size: {
|
||||
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件大小",
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// sof_sofawa.sync({ force: true });
|
||||
64
api/model/sof_sofawa_ga.js
Normal file
64
api/model/sof_sofawa_ga.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
|
||||
module.exports = sof_sofawa_ga = db.define("sof_sofawa_ga", {
|
||||
|
||||
sofaKey: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "软件key",
|
||||
},
|
||||
version: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "版本号",
|
||||
},
|
||||
serialNumber: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "硬盘序列号",
|
||||
},
|
||||
|
||||
ip: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "ip",
|
||||
},
|
||||
position: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "功能位置",
|
||||
},
|
||||
type: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "类型",
|
||||
},
|
||||
msg: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "{}",
|
||||
comment: "详细信息",
|
||||
set(value) {
|
||||
this.setDataValue('msg', { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("msg")
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
}
|
||||
else {
|
||||
return jsonValue
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
//sof_sofawa_ga.sync({ force: true });
|
||||
24
api/model/sys_control_type.js
Normal file
24
api/model/sys_control_type.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
module.exports = sys_control_type = db.define("sys_control_type", {
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "控件名称",
|
||||
},
|
||||
module_key: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "组件key",
|
||||
},
|
||||
data_lenght: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "50",
|
||||
comment: "数据长度",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_control_type.sync({ force: true });
|
||||
42
api/model/sys_form.js
Normal file
42
api/model/sys_form.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
// 表单表
|
||||
module.exports = sys_form = db.define("sys_form", {
|
||||
// 表单名称
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "表单名称",
|
||||
},
|
||||
// 模型id
|
||||
model_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "模型id",
|
||||
},
|
||||
// 项目id
|
||||
project_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "项目id",
|
||||
},
|
||||
// 组件地址
|
||||
component: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "组件地址",
|
||||
},
|
||||
//api地址
|
||||
api_path: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "api地址",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_form.sync({ force: true });
|
||||
78
api/model/sys_form_field.js
Normal file
78
api/model/sys_form_field.js
Normal file
@@ -0,0 +1,78 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
module.exports = sys_form_field = db.define("sys_form_field", {
|
||||
form_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "表单id",
|
||||
},
|
||||
model_field_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "字段id",
|
||||
},
|
||||
model_field_name: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "字段名称",
|
||||
},
|
||||
control: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "{}",
|
||||
comment: "控件",
|
||||
set(value) {
|
||||
this.setDataValue('control', { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("control")
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
|
||||
|
||||
|
||||
return jsonValue.value;
|
||||
}
|
||||
else {
|
||||
return jsonValue
|
||||
}
|
||||
}
|
||||
},
|
||||
is_show_edit: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否显示在编辑界面",
|
||||
},
|
||||
|
||||
is_edit_disable: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "编辑界面是否禁用",
|
||||
},
|
||||
is_show_list: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否显示在列表",
|
||||
},
|
||||
|
||||
is_show_seach: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否显示在搜索",
|
||||
},
|
||||
sort: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "排序",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_form_field.sync({ force: true });
|
||||
35
api/model/sys_log.js
Normal file
35
api/model/sys_log.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
// db日志管理
|
||||
module.exports = sys_log = db.define("sys_log", {
|
||||
table_name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "表名",
|
||||
},
|
||||
operate: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "操作",
|
||||
},
|
||||
content: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "内容",
|
||||
set(value) {
|
||||
this.setDataValue("content", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("content");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
// sys_log.sync({ force: true });
|
||||
87
api/model/sys_menu.js
Normal file
87
api/model/sys_menu.js
Normal file
@@ -0,0 +1,87 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
// 菜单表
|
||||
module.exports = sys_menu = db.define("sys_menu", {
|
||||
// 菜单名称
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "菜单名称",
|
||||
},
|
||||
|
||||
// 父id
|
||||
parent_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "父id",
|
||||
},
|
||||
|
||||
// 图标
|
||||
icon: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "图标",
|
||||
},
|
||||
path: {
|
||||
type: Sequelize.STRING(255),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "路径",
|
||||
},
|
||||
|
||||
// 菜单类型 "菜单", "页面", "外链", "功能"
|
||||
type: {
|
||||
type: Sequelize.STRING(255),
|
||||
allowNull: false,
|
||||
defaultValue: "页面",
|
||||
comment: "菜单类型",
|
||||
},
|
||||
//模型id
|
||||
model_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "模型id",
|
||||
},
|
||||
// 组件地址
|
||||
component: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "组件地址",
|
||||
},
|
||||
|
||||
// api地址
|
||||
api_path: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "api地址",
|
||||
},
|
||||
// 是否显示在菜单中
|
||||
is_show_menu: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: true,
|
||||
comment: "是否显示在菜单中",
|
||||
},
|
||||
is_show: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: true,
|
||||
comment: "是否展示",
|
||||
},
|
||||
|
||||
// 菜单类型
|
||||
sort: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "菜单类型",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_menu.sync({ force: true })
|
||||
26
api/model/sys_model.js
Normal file
26
api/model/sys_model.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
module.exports = sys_model = db.define("sys_model", {
|
||||
key: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "模型key",
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "模型名称",
|
||||
},
|
||||
// 项目id
|
||||
project_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "项目id",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_model.sync({ force: true });
|
||||
82
api/model/sys_model_field.js
Normal file
82
api/model/sys_model_field.js
Normal file
@@ -0,0 +1,82 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
module.exports = sys_model_field = db.define("sys_model_field", {
|
||||
model_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "模型Id",
|
||||
},
|
||||
|
||||
key: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "字段Key",
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "名称",
|
||||
},
|
||||
// 控件
|
||||
control: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "{}",
|
||||
comment: "控件",
|
||||
set(value) {
|
||||
this.setDataValue("control", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("control");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
},
|
||||
// 排序
|
||||
sort: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: 1,
|
||||
comment: "排序",
|
||||
},
|
||||
// 类型
|
||||
data_type: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "数据类型",
|
||||
},
|
||||
|
||||
//数据长度
|
||||
data_length: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: 50,
|
||||
comment: "数据长度",
|
||||
},
|
||||
|
||||
//是否为空 0 为空 , 1 不允许为空
|
||||
allow_null: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否为空",
|
||||
},
|
||||
|
||||
// 默认值
|
||||
default_value: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "默认值",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_model_field.sync({ force: true });
|
||||
35
api/model/sys_parameter.js
Normal file
35
api/model/sys_parameter.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
// 字典表
|
||||
module.exports = sys_parameter = db.define("sys_parameter", {
|
||||
key: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "字典key",
|
||||
},
|
||||
|
||||
value: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "值",
|
||||
},
|
||||
|
||||
remark: {
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "备注",
|
||||
},
|
||||
|
||||
// 是否允许修改 0 允许,1 不允许
|
||||
is_modified: {
|
||||
type: Sequelize.INTEGER(2),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否允许修改",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_parameter.sync({ force: true })
|
||||
33
api/model/sys_project.js
Normal file
33
api/model/sys_project.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const dayjs = require("dayjs");
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
module.exports = sys_project = db.define("sys_project", {
|
||||
name: {
|
||||
comment: "项目名称",
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
},
|
||||
key: {
|
||||
comment: "项目key",
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
},
|
||||
|
||||
project_type_id: {
|
||||
comment: "项目类型",
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
},
|
||||
|
||||
remark: {
|
||||
comment: "备注",
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: 1,
|
||||
defaultValue: "",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_project.sync({ force: true });
|
||||
141
api/model/sys_project_config.js
Normal file
141
api/model/sys_project_config.js
Normal file
@@ -0,0 +1,141 @@
|
||||
const dayjs = require("dayjs");
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
module.exports = sys_project_config = db.define("sys_project_config", {
|
||||
project_id: {
|
||||
comment: "项目id",
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
},
|
||||
|
||||
config_env_type: {
|
||||
comment: "环境类型",
|
||||
type: Sequelize.INTEGER(2),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
},
|
||||
|
||||
db: {
|
||||
comment: "db配置",
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
set(value) {
|
||||
this.setDataValue("db", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("db");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
defaultValue: {
|
||||
username: "",
|
||||
password: "",
|
||||
database: "",
|
||||
host: "",
|
||||
port: 3306,
|
||||
dialect: "mysql",
|
||||
},
|
||||
},
|
||||
aliyun: {
|
||||
comment: "阿里云配置",
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
set(value) {
|
||||
this.setDataValue("aliyun", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("aliyun");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
defaultValue: {
|
||||
accessKeyId: "",
|
||||
accessKeySecret: "",
|
||||
ossUrl: "",
|
||||
},
|
||||
},
|
||||
redis: {
|
||||
comment: "redis配置",
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
set(value) {
|
||||
this.setDataValue("redis", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("redis");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
defaultValue: {
|
||||
host: "",
|
||||
port: "",
|
||||
pwd: "",
|
||||
opt: {},
|
||||
},
|
||||
},
|
||||
|
||||
file: {
|
||||
comment: "文件配置",
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
|
||||
set(value) {
|
||||
this.setDataValue("file", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("file");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
defaultValue: {
|
||||
vue: {
|
||||
api: "../../admin/src/api/",
|
||||
view: "../../admin/src/view/",
|
||||
},
|
||||
node: {
|
||||
controller: "../controller_admin/",
|
||||
model: "../model/",
|
||||
},
|
||||
},
|
||||
},
|
||||
wechat: {
|
||||
comment: "微信配置",
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
set(value) {
|
||||
this.setDataValue("wechat", { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("wechat");
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
return jsonValue.value;
|
||||
} else {
|
||||
return jsonValue;
|
||||
}
|
||||
},
|
||||
defaultValue: {
|
||||
appid: "",
|
||||
secret: "",
|
||||
mch_id: "",
|
||||
partner_key: "",
|
||||
partnerV3_key: "",
|
||||
notify_url: "",
|
||||
refund_notify_url: "",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// sys_project_config.sync({ force: true });
|
||||
19
api/model/sys_project_type.js
Normal file
19
api/model/sys_project_type.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const dayjs = require("dayjs");
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
module.exports = sys_project_type = db.define("sys_project_type", {
|
||||
name: {
|
||||
comment: "类型名称",
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
},
|
||||
|
||||
remark: {
|
||||
comment: "备注",
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
},
|
||||
});
|
||||
// sys_project_type.sync({ force: true });
|
||||
39
api/model/sys_role.js
Normal file
39
api/model/sys_role.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
//角色表
|
||||
module.exports = sys_role = db.define("sys_role", {
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "角色名称",
|
||||
},
|
||||
// 0 普通角色 1 系统角色
|
||||
type: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "角色类型",
|
||||
},
|
||||
menus: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "权限菜单",
|
||||
set(value) {
|
||||
this.setDataValue('menus', { value });
|
||||
},
|
||||
get() {
|
||||
let jsonValue = this.getDataValue("menus")
|
||||
if (jsonValue && jsonValue.value !== undefined) {
|
||||
|
||||
return jsonValue.value;
|
||||
}
|
||||
else {
|
||||
return jsonValue
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// sys_role.sync({ force: true })
|
||||
24
api/model/sys_user.js
Normal file
24
api/model/sys_user.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const db = require("../../middleware/db");
|
||||
const Sequelize = require("sequelize");
|
||||
// 系统用户表
|
||||
module.exports = sys_user = db.define("sys_user", {
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "名称",
|
||||
},
|
||||
password: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "密码",
|
||||
},
|
||||
roleId: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
comment: "角色id",
|
||||
},
|
||||
});
|
||||
|
||||
// sys_user.sync({ force: true });
|
||||
Reference in New Issue
Block a user