diff --git a/api/app/lib/index.js b/api/app/lib/index.js index b1991d8b..d7df097b 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -27,7 +27,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq }); const { User, Department } = dc.models; - + // 定义外键 User.belongsTo(Department, { foreignKey: 'departmentId', targetKey: 'id' }); Department.hasMany(User, { foreignKey: 'departmentId', sourceKey: 'id' }); };