添加银行后端接口,前端代码
This commit is contained in:
121
bank-backend/migrations/20241220000002-create-projects.js
Normal file
121
bank-backend/migrations/20241220000002-create-projects.js
Normal file
@@ -0,0 +1,121 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('projects', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
comment: '项目名称'
|
||||
},
|
||||
status: {
|
||||
type: Sequelize.ENUM('supervision', 'completed'),
|
||||
allowNull: false,
|
||||
defaultValue: 'supervision',
|
||||
comment: '项目状态:supervision-监管中,completed-已结项'
|
||||
},
|
||||
farmName: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: false,
|
||||
comment: '养殖场名称'
|
||||
},
|
||||
supervisionObject: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
comment: '监管对象'
|
||||
},
|
||||
supervisionQuantity: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '监管数量'
|
||||
},
|
||||
supervisionPeriod: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
comment: '监管周期'
|
||||
},
|
||||
supervisionAmount: {
|
||||
type: Sequelize.DECIMAL(15, 2),
|
||||
allowNull: false,
|
||||
defaultValue: 0.00,
|
||||
comment: '监管金额'
|
||||
},
|
||||
startTime: {
|
||||
type: Sequelize.DATEONLY,
|
||||
allowNull: false,
|
||||
comment: '起始时间'
|
||||
},
|
||||
endTime: {
|
||||
type: Sequelize.DATEONLY,
|
||||
allowNull: false,
|
||||
comment: '结束时间'
|
||||
},
|
||||
earTag: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '耳标数量'
|
||||
},
|
||||
collar: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '项圈数量'
|
||||
},
|
||||
host: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '主机数量'
|
||||
},
|
||||
loanOfficer: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: true,
|
||||
comment: '贷款专员'
|
||||
},
|
||||
description: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: true,
|
||||
comment: '项目描述'
|
||||
},
|
||||
createdBy: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '创建人ID'
|
||||
},
|
||||
updatedBy: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '更新人ID'
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.NOW
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.NOW
|
||||
}
|
||||
});
|
||||
|
||||
// 添加索引
|
||||
await queryInterface.addIndex('projects', ['status']);
|
||||
await queryInterface.addIndex('projects', ['farmName']);
|
||||
await queryInterface.addIndex('projects', ['createdBy']);
|
||||
await queryInterface.addIndex('projects', ['startTime']);
|
||||
await queryInterface.addIndex('projects', ['endTime']);
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.dropTable('projects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,152 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('supervision_tasks', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false
|
||||
},
|
||||
applicationNumber: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
comment: '申请单号'
|
||||
},
|
||||
contractNumber: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
comment: '放款合同编号'
|
||||
},
|
||||
productName: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
comment: '产品名称'
|
||||
},
|
||||
customerName: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
comment: '客户姓名'
|
||||
},
|
||||
idType: {
|
||||
type: Sequelize.ENUM('id_card', 'passport', 'other'),
|
||||
allowNull: false,
|
||||
defaultValue: 'id_card',
|
||||
comment: '证件类型:id_card-身份证,passport-护照,other-其他'
|
||||
},
|
||||
idNumber: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
comment: '证件号码'
|
||||
},
|
||||
assetType: {
|
||||
type: Sequelize.ENUM('cattle', 'sheep', 'pig', 'poultry', 'other'),
|
||||
allowNull: false,
|
||||
defaultValue: 'cattle',
|
||||
comment: '养殖生资种类:cattle-牛,sheep-羊,pig-猪,poultry-家禽,other-其他'
|
||||
},
|
||||
assetQuantity: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '监管生资数量'
|
||||
},
|
||||
supervisionStatus: {
|
||||
type: Sequelize.ENUM('pending', 'supervising', 'completed', 'suspended'),
|
||||
allowNull: false,
|
||||
defaultValue: 'pending',
|
||||
comment: '监管状态:pending-待监管,supervising-监管中,completed-已完成,suspended-已暂停'
|
||||
},
|
||||
importTime: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
||||
comment: '任务导入时间'
|
||||
},
|
||||
startTime: {
|
||||
type: Sequelize.DATEONLY,
|
||||
allowNull: false,
|
||||
comment: '监管起始时间'
|
||||
},
|
||||
endTime: {
|
||||
type: Sequelize.DATEONLY,
|
||||
allowNull: false,
|
||||
comment: '监管结束时间'
|
||||
},
|
||||
loanAmount: {
|
||||
type: Sequelize.DECIMAL(15, 2),
|
||||
allowNull: true,
|
||||
defaultValue: 0.00,
|
||||
comment: '贷款金额'
|
||||
},
|
||||
interestRate: {
|
||||
type: Sequelize.DECIMAL(5, 4),
|
||||
allowNull: true,
|
||||
defaultValue: 0.0000,
|
||||
comment: '利率'
|
||||
},
|
||||
loanTerm: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
defaultValue: 12,
|
||||
comment: '贷款期限(月)'
|
||||
},
|
||||
supervisorName: {
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: true,
|
||||
comment: '监管员姓名'
|
||||
},
|
||||
supervisorPhone: {
|
||||
type: Sequelize.STRING(20),
|
||||
allowNull: true,
|
||||
comment: '监管员电话'
|
||||
},
|
||||
farmAddress: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: true,
|
||||
comment: '养殖场地址'
|
||||
},
|
||||
remarks: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: true,
|
||||
comment: '备注'
|
||||
},
|
||||
createdBy: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '创建人ID'
|
||||
},
|
||||
updatedBy: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '更新人ID'
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')
|
||||
}
|
||||
});
|
||||
|
||||
// 添加索引
|
||||
await queryInterface.addIndex('supervision_tasks', ['applicationNumber']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['contractNumber']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['customerName']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['supervisionStatus']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['createdBy']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['startTime']);
|
||||
await queryInterface.addIndex('supervision_tasks', ['endTime']);
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.dropTable('supervision_tasks');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user