完善保险端前后端和养殖端小程序
This commit is contained in:
@@ -303,31 +303,31 @@ const IotCattle = sequelize.define('IotCattle', {
|
||||
comment: '物联网牛只表'
|
||||
});
|
||||
|
||||
// 定义关联关系
|
||||
IotCattle.associate = (models) => {
|
||||
// 关联到农场
|
||||
IotCattle.belongsTo(models.Farm, {
|
||||
foreignKey: 'orgId',
|
||||
as: 'farm'
|
||||
});
|
||||
// 关联关系已在 models/index.js 中定义
|
||||
// IotCattle.associate = (models) => {
|
||||
// // 关联到农场
|
||||
// IotCattle.belongsTo(models.Farm, {
|
||||
// foreignKey: 'orgId',
|
||||
// as: 'farm'
|
||||
// });
|
||||
|
||||
// 关联到批次
|
||||
IotCattle.belongsTo(models.CattleBatch, {
|
||||
foreignKey: 'batchId',
|
||||
as: 'batch'
|
||||
});
|
||||
// // 关联到批次
|
||||
// IotCattle.belongsTo(models.CattleBatch, {
|
||||
// foreignKey: 'batchId',
|
||||
// as: 'batch'
|
||||
// });
|
||||
|
||||
// 关联到栏舍
|
||||
IotCattle.belongsTo(models.CattlePen, {
|
||||
foreignKey: 'penId',
|
||||
as: 'pen'
|
||||
});
|
||||
// // 关联到栏舍
|
||||
// IotCattle.belongsTo(models.CattlePen, {
|
||||
// foreignKey: 'penId',
|
||||
// as: 'pen'
|
||||
// });
|
||||
|
||||
// 关联到围栏
|
||||
IotCattle.belongsTo(models.ElectronicFence, {
|
||||
foreignKey: 'fenceId',
|
||||
as: 'fence'
|
||||
});
|
||||
};
|
||||
// // 关联到围栏
|
||||
// IotCattle.belongsTo(models.ElectronicFence, {
|
||||
// foreignKey: 'fenceId',
|
||||
// as: 'fence'
|
||||
// });
|
||||
// };
|
||||
|
||||
module.exports = IotCattle;
|
||||
|
||||
Reference in New Issue
Block a user