人力资源
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.4 KiB

/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RoleResource = sequelize.define("roleResource", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
roleId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "角色id",
primaryKey: false,
field: "role_id",
autoIncrement: false
},
resId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "权限id",
primaryKey: false,
field: "res_id",
autoIncrement: false
}
}, {
tableName: "role_resource",
comment: "",
indexes: []
});
dc.models.RoleResource = RoleResource;
const Role = dc.models.Role;
RoleResource.belongsTo(Role, { foreignKey: 'roleId', targetKey: 'id' });
Role.hasMany(RoleResource, { foreignKey: 'roleId', sourceKey: 'id' });
const Resource = dc.models.Resource;
RoleResource.belongsTo(Resource, { foreignKey: 'resId', targetKey: 'id' });
Resource.hasMany(RoleResource, { foreignKey: 'resId', sourceKey: 'id' });
return RoleResource;
};