添加银行政府后端接口

This commit is contained in:
2025-09-25 15:53:44 +08:00
parent b17bdcc24c
commit 5b6b7e0a96
60 changed files with 5345 additions and 1920 deletions

View File

@@ -0,0 +1,66 @@
const sequelize = require('../config/database');
const { DataTypes } = require('sequelize');
const Department = require('./Department');
const Position = sequelize.define('Position', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
department_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: Department,
key: 'id'
},
comment: '所属部门ID'
},
name: {
type: DataTypes.STRING,
allowNull: false,
comment: '岗位名称'
},
has_permission: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
comment: '是否已设置权限'
},
created_by: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '创建人ID'
},
updated_by: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '更新人ID'
}
}, {
tableName: 'government_positions',
indexes: [
{
name: 'idx_position_department_id',
fields: ['department_id']
},
{
name: 'idx_position_name',
fields: ['name']
}
]
});
// 定义关系
Department.hasMany(Position, {
foreignKey: 'department_id',
as: 'positions'
});
Position.belongsTo(Department, {
foreignKey: 'department_id',
as: 'department'
});
module.exports = Position;