rentease-backend-new/models/Menu.js

107 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Menu = sequelize.define('Menu', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: '父菜单IDnull表示顶级菜单'
},
name: {
type: DataTypes.STRING(50),
allowNull: false,
comment: '菜单名称'
},
code: {
type: DataTypes.STRING(50),
allowNull: false,
unique: true,
comment: '菜单编码'
},
type: {
type: DataTypes.ENUM('menu', 'button'),
allowNull: false,
defaultValue: 'menu',
comment: '类型menu-菜单button-按钮'
},
path: {
type: DataTypes.STRING(200),
allowNull: true,
comment: '路由路径'
},
component: {
type: DataTypes.STRING(200),
allowNull: true,
comment: '组件路径'
},
icon: {
type: DataTypes.STRING(50),
allowNull: true,
comment: '菜单图标'
},
sort: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '排序号'
},
visible: {
type: DataTypes.ENUM('show', 'hide'),
allowNull: false,
defaultValue: 'show',
comment: '是否显示show-显示hide-隐藏'
},
status: {
type: DataTypes.ENUM('active', 'disabled'),
allowNull: false,
defaultValue: 'active',
comment: '状态active-启用disabled-禁用'
},
isBasic: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '是否基础菜单01新租户默认分配基础菜单'
},
createBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '创建人ID'
},
updateBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '修改人ID'
},
isDeleted: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '删除状态0未删除1已删除'
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updateTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'menus',
timestamps: false,
comment: '菜单表'
});
module.exports = Menu;