修改政府端前端,银行端小程序和后端接口
This commit is contained in:
@@ -22,6 +22,8 @@ const CompletedSupervision = require('./CompletedSupervision');
|
||||
const LoanApplication = require('./LoanApplication');
|
||||
const AuditRecord = require('./AuditRecord');
|
||||
const LoanContract = require('./LoanContract');
|
||||
const LoanRelease = require('./LoanRelease');
|
||||
const LoanReleaseHistory = require('./LoanReleaseHistory');
|
||||
|
||||
// 定义模型关联关系
|
||||
|
||||
@@ -226,6 +228,54 @@ User.hasMany(AuditRecord, {
|
||||
// 贷款合同暂时不关联用户表,因为当前表结构中没有外键字段
|
||||
// 如果需要关联,需要先添加相应的外键字段到数据库表中
|
||||
|
||||
// 贷款解押与用户关联(处理人)
|
||||
LoanRelease.belongsTo(User, {
|
||||
foreignKey: 'processor_id',
|
||||
as: 'processor',
|
||||
targetKey: 'id'
|
||||
});
|
||||
|
||||
User.hasMany(LoanRelease, {
|
||||
foreignKey: 'processor_id',
|
||||
as: 'processedReleases'
|
||||
});
|
||||
|
||||
// 贷款解押与贷款合同关联
|
||||
LoanRelease.belongsTo(LoanContract, {
|
||||
foreignKey: 'contract_id',
|
||||
as: 'contract',
|
||||
targetKey: 'id'
|
||||
});
|
||||
|
||||
LoanContract.hasMany(LoanRelease, {
|
||||
foreignKey: 'contract_id',
|
||||
as: 'releases'
|
||||
});
|
||||
|
||||
// 贷款解押历史记录与解押申请关联
|
||||
LoanReleaseHistory.belongsTo(LoanRelease, {
|
||||
foreignKey: 'release_id',
|
||||
as: 'release',
|
||||
targetKey: 'id'
|
||||
});
|
||||
|
||||
LoanRelease.hasMany(LoanReleaseHistory, {
|
||||
foreignKey: 'release_id',
|
||||
as: 'histories'
|
||||
});
|
||||
|
||||
// 贷款解押历史记录与用户关联(操作人)
|
||||
LoanReleaseHistory.belongsTo(User, {
|
||||
foreignKey: 'operator_id',
|
||||
as: 'operatorUser',
|
||||
targetKey: 'id'
|
||||
});
|
||||
|
||||
User.hasMany(LoanReleaseHistory, {
|
||||
foreignKey: 'operator_id',
|
||||
as: 'releaseHistories'
|
||||
});
|
||||
|
||||
// 导出所有模型和数据库实例
|
||||
module.exports = {
|
||||
sequelize,
|
||||
@@ -244,5 +294,7 @@ module.exports = {
|
||||
CompletedSupervision,
|
||||
LoanApplication,
|
||||
AuditRecord,
|
||||
LoanContract
|
||||
LoanContract,
|
||||
LoanRelease,
|
||||
LoanReleaseHistory
|
||||
};
|
||||
Reference in New Issue
Block a user