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.
4.9 KiB
4.9 KiB
school_contract_sign 表文档
表概述
表名: school_contract_sign
功能: 合同签署管理表,用于管理合同的电子签署流程,支持内部人员和外部学员的合同签署,包括电子签名、状态跟踪、自动分发和数据填充等功能,为合同管理提供完整的数字化解决方案
字段说明
Field Type Collation Null Key Default Extra Privileges Comment
id int NULL NO PRI NULL auto_increment select,insert,update,references
contract_id int NULL NO NULL select,insert,update,references 合同
personnel_id int NULL NO NULL select,insert,update,references 下发人员
sign_file text utf8mb4_general_ci YES NULL select,insert,update,references 签署附件
status int NULL NO 1 select,insert,update,references 1未签署 2已签署3 已生效 4 已失效
created_at timestamp NULL YES CURRENT_TIMESTAMP DEFAULT_GENERATED select,insert,update,references 创建时间
sign_time datetime NULL YES NULL select,insert,update,references 签署时间
signature_image varchar(500) utf8mb4_general_ci YES NULL select,insert,update,references 签名图片路径
source_type varchar(50) utf8mb4_general_ci YES manual select,insert,update,references 分发来源:manual手动分发,auto_course自动课程分发
source_id int NULL YES NULL select,insert,update,references 来源ID(如课程ID、订单ID等)
updated_at timestamp NULL YES CURRENT_TIMESTAMP DEFAULT_GENERATED on update CURRENT_TIMESTAMP select,insert,update,references 更新时间
deleted_at int NULL NO 0 select,insert,update,references 逻辑删除时间
type tinyint(1) NULL YES NULL select,insert,update,references 签订类型1内部人员2外部人员
fill_data text utf8mb4_general_ci YES NULL select,insert,update,references 填充数据JSON
error_msg varchar(255) utf8mb4_general_ci YES NULL select,insert,update,references 错误信息
student_id int NULL YES NULL select,insert,update,references 学员 Id
功能用途
主要功能
- 合同签署管理: 管理合同的签署流程和状态跟踪
- 电子签名: 支持电子签名图片的存储和验证
- 多角色签署: 支持内部人员和外部人员(学员)的合同签署
- 签署文件管理: 存储签署后的合同附件和相关文档
- 自动化分发: 支持手动分发和自动课程分发两种模式
- 数据填充: 支持合同模板的动态数据填充
- 状态追踪: 完整的签署状态生命周期管理
业务场景
- 学员入学合同: 新学员报名时签署入学协议和课程合同
- 员工劳动合同: 内部人员入职时签署劳动合同和保密协议
- 课程服务协议: 学员购买课程时自动生成并分发服务协议
- 合同续签: 到期合同的续签和重新签署流程
- 批量合同处理: 批量生成和分发合同给多个签署人
- 合同审核: 签署完成后的合同审核和生效流程
- 电子存档: 已签署合同的电子化存档和管理
关联关系
主要关联表
- school_contract: 通过contract_id关联合同基础信息
- school_personnel: 通过personnel_id关联下发人员信息
- school_student: 通过student_id关联学员信息
- school_course: 通过source_id关联课程信息(当source_type为auto_course时)
- school_sys_user: 关联系统用户信息
关联说明
contract_id→school_contract.id: 多对一关系,一个合同可以有多个签署记录personnel_id→school_personnel.id: 记录合同的分发人员student_id→school_student.id: 外部人员签署时关联学员信息source_id: 根据source_type关联不同的业务对象(课程、订单等)- 支持软删除机制,通过deleted_at字段管理数据生命周期
索引建议
-- 主键索引(已存在)
PRIMARY KEY (id)
-- 合同查询索引
INDEX idx_contract_id (contract_id)
-- 人员查询索引
INDEX idx_personnel_id (personnel_id)
-- 学员查询索引
INDEX idx_student_id (student_id)
-- 状态查询索引
INDEX idx_status (status)
-- 签署类型索引
INDEX idx_type (type)
-- 来源查询索引
INDEX idx_source (source_type, source_id)
-- 复合索引:合同+状态
INDEX idx_contract_status (contract_id, status)
-- 软删除查询索引
INDEX idx_deleted_at (deleted_at)
-- 时间范围查询索引
INDEX idx_created_at (created_at)
INDEX idx_sign_time (sign_time)
注意事项
- 法律效力: 电子签名需要符合相关法律法规要求
- 身份验证: 签署前必须验证签署人的身份信息
- 签名安全: 签名图片应加密存储,防止篡改
- 状态一致性: 签署状态变更需要保证数据一致性
- 文件完整性: 签署文件的完整性和不可篡改性验证
- 时间戳: 签署时间的准确性和不可篡改性
- 错误处理: 签署失败时的错误信息记录和处理机制
- 数据备份: 重要合同数据的定期备份和恢复机制