人力资源
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.
 
 
 
 

47 lines
1.2 KiB

/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const UserRole = sequelize.define("userRole", {
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
},
userId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "用户id",
primaryKey: false,
field: "user_id",
autoIncrement: false
}
}, {
tableName: "user_role",
comment: "",
indexes: []
});
dc.models.UserRole = UserRole;
const Role = dc.models.Role;
UserRole.belongsTo(Role, { foreignKey: 'roleId', targetKey: 'id' });
Role.hasMany(UserRole, { foreignKey: 'roleId', sourceKey: 'id' });
return UserRole;
};