You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6.1 KiB
6.1 KiB
school_approval_process 表文档
表概述
表名: school_approval_process
功能: 审批流程管理表,负责管理教务系统中的各种业务审批流程,包括流程状态跟踪、审批人管理、业务数据关联等核心功能
字段说明
Field Type Collation Null Key Default Extra Privileges Comment
id int NULL NO PRI NULL auto_increment select,insert,update,references 流程编号
process_name varchar(255) utf8mb4_general_ci NO NULL select,insert,update,references 流程名称
applicant_id int NULL NO NULL select,insert,update,references 申请人ID
application_time timestamp NULL YES CURRENT_TIMESTAMP DEFAULT_GENERATED select,insert,update,references 申请时间
current_approver_id int NULL NO NULL select,insert,update,references 当前审批人ID
approval_status enum('pending','approved','rejected') utf8mb4_general_ci NO NULL select,insert,update,references 审批状态: pending-待审批, approved-已批准, rejected-已拒绝
approval_time timestamp NULL YES NULL select,insert,update,references 审批时间
remarks text utf8mb4_general_ci YES NULL select,insert,update,references 备注
created_at timestamp NULL YES CURRENT_TIMESTAMP DEFAULT_GENERATED select,insert,update,references 创建时间
updated_at timestamp NULL YES CURRENT_TIMESTAMP DEFAULT_GENERATED on update CURRENT_TIMESTAMP select,insert,update,references 修改时间
business_type varchar(255) utf8mb4_general_ci YES MUL NULL select,insert,update,references 业务方法名
business_id int NULL YES NULL select,insert,update,references 关联业务ID
business_data longtext utf8mb4_general_ci YES NULL select,insert,update,references 业务数据JSON
功能用途
主要功能
- 审批流程管理: 管理各种业务的审批流程实例
- 流程状态跟踪: 跟踪审批流程的当前状态(待审批/已批准/已拒绝)
- 申请人管理: 记录流程的发起人和申请时间
- 当前审批人跟踪: 跟踪当前负责审批的人员
- 业务数据关联: 关联具体的业务类型和业务数据
- 审批时间管理: 记录申请时间和审批完成时间
- 流程备注记录: 记录流程相关的备注和说明信息
- 业务类型分类: 支持多种业务类型的审批流程
- JSON数据存储: 存储复杂的业务数据结构
业务场景
- 请假审批: 员工请假申请的审批流程
- 报销审批: 费用报销的审批流程
- 合同审批: 合同签署的审批流程
- 课程审批: 新课程开设的审批流程
- 学员退费: 学员退费申请的审批流程
- 薪资调整: 员工薪资调整的审批流程
- 权限申请: 系统权限申请的审批流程
- 资源申请: 教学资源申请的审批流程
- 变更审批: 各种业务变更的审批流程
关联关系
主要关联表
school_personnel: 人员信息表 (applicant_id、current_approver_id外键关联)school_approval_config: 审批配置表 (business_type关联)school_approval_participants: 审批参与人表 (流程参与人关联)school_approval_history: 审批历史表 (流程操作历史关联)school_approval_config_node: 审批节点配置表 (流程节点关联)school_contract: 合同表 (business_id关联,当business_type为合同时)school_member: 会员表 (business_id关联,当business_type为退费时)school_salary: 薪资表 (business_id关联,当business_type为薪资时)sys_log: 系统日志表 (操作日志关联)
关联说明
- 申请人关联: applicant_id关联school_personnel表,确定流程发起人
- 审批人关联: current_approver_id关联school_personnel表,确定当前审批人
- 配置关联: business_type关联school_approval_config表,获取审批配置
- 参与人关联: 与school_approval_participants表关联,管理流程参与人
- 历史关联: 与school_approval_history表关联,记录审批操作历史
- 业务关联: business_id根据business_type关联不同的业务表
- 节点关联: 通过配置关联审批节点信息
- 数据关联: business_data存储具体的业务数据JSON
索引建议
- 主键索引: id (已存在)
- 外键索引:
- applicant_id (申请人查询)
- current_approver_id (当前审批人查询)
- business_type (业务类型查询,已存在MUL)
- 业务索引:
- approval_status (审批状态查询)
- business_id (业务ID查询)
- 复合索引:
- (applicant_id, approval_status) (申请人状态查询)
- (current_approver_id, approval_status) (审批人状态查询)
- (business_type, approval_status) (业务类型状态查询)
- (business_type, business_id) (业务关联查询)
- (approval_status, application_time) (状态时间查询)
- 时间索引:
- application_time (申请时间查询)
- approval_time (审批时间查询)
- created_at (创建时间查询)
- updated_at (更新时间查询)
注意事项
- 审批状态: approval_status字段限定为pending、approved、rejected三种状态
- 外键完整性: applicant_id和current_approver_id必须在school_personnel表中存在
- 业务类型: business_type应该与school_approval_config表中的配置一致
- 业务关联: business_id应该在对应的业务表中存在
- 状态流转: 状态只能从pending转换为approved或rejected
- 时间逻辑: approval_time应该晚于application_time
- 当前审批人: current_approver_id应该与当前审批节点的参与人一致
- JSON数据: business_data应该是有效的JSON格式
- 流程完整性: 确保流程配置和参与人配置的完整性
- 权限验证: 验证申请人和审批人的权限
- 并发控制: 防止同一流程被多人同时操作
- 数据一致性: 确保流程状态与参与人状态的一致性
- 审计要求: 所有状态变更都需要记录详细的审计日志
- 性能优化: 大量流程查询时需要考虑分页和索引优化
- 监控告警: 建立流程超时和异常的监控机制
- 数据备份: 重要的审批流程数据需要定期备份
- 清理策略: 建立已完成流程的归档和清理策略