完善保险端前后端和养殖端小程序
This commit is contained in:
@@ -71,19 +71,19 @@ const CattlePen = sequelize.define('CattlePen', {
|
||||
comment: '栏舍设置表'
|
||||
});
|
||||
|
||||
// 定义关联关系
|
||||
CattlePen.associate = (models) => {
|
||||
// 栏舍属于农场
|
||||
CattlePen.belongsTo(models.Farm, {
|
||||
foreignKey: 'farmId',
|
||||
as: 'farm'
|
||||
});
|
||||
// 关联关系已在 models/index.js 中定义
|
||||
// CattlePen.associate = (models) => {
|
||||
// // 栏舍属于农场
|
||||
// CattlePen.belongsTo(models.Farm, {
|
||||
// foreignKey: 'farmId',
|
||||
// as: 'farm'
|
||||
// });
|
||||
|
||||
// 栏舍有多个动物
|
||||
CattlePen.hasMany(models.Animal, {
|
||||
foreignKey: 'penId',
|
||||
as: 'animals'
|
||||
});
|
||||
};
|
||||
// // 栏舍有多个动物
|
||||
// CattlePen.hasMany(models.Animal, {
|
||||
// foreignKey: 'penId',
|
||||
// as: 'animals'
|
||||
// });
|
||||
// };
|
||||
|
||||
module.exports = CattlePen;
|
||||
|
||||
Reference in New Issue
Block a user