修改政府端前端,银行端小程序和后端接口

This commit is contained in:
2025-09-26 17:52:50 +08:00
parent 852adbcfff
commit 00dfa83fd1
237 changed files with 9172 additions and 33500 deletions

View File

@@ -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
};