From 8d90457cdcddaa0a627e2743496c89c3a55fa451 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Sun, 20 Sep 2026 21:18:59 +0800 Subject: [PATCH] feat(oa): add oa_instance_comment table and model Co-authored-by: Cursor --- backend/app/models/models.py | 22 +++++++++++++++++++ .../2026-09-20-oa-instance-comment.sql | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 docs/sql/migrations/2026-09-20-oa-instance-comment.sql diff --git a/backend/app/models/models.py b/backend/app/models/models.py index 1bc5bde6..fd8dda03 100644 --- a/backend/app/models/models.py +++ b/backend/app/models/models.py @@ -982,6 +982,28 @@ class OaInstanceEvent(Base): del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") +class OaInstanceComment(Base): + """OA审批实例评论 oa_instance_comment""" + + __tablename__ = "oa_instance_comment" + + id = Column(String(64), primary_key=True, comment="主键ID") + instance_id = Column(String(64), nullable=False, comment="所属实例ID") + content = Column(String(1024), nullable=False, comment="评论正文") + attachment_refs_json = Column(Text, nullable=True, comment="引用表单附件快照 JSON") + status = Column(String(16), nullable=False, default="normal", comment="normal/revoked") + revoked_time = Column(DateTime, nullable=True, comment="撤回时间") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id(评论作者)") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + class OaRelation(Base): """OA关联审批 oa_relation""" diff --git a/docs/sql/migrations/2026-09-20-oa-instance-comment.sql b/docs/sql/migrations/2026-09-20-oa-instance-comment.sql new file mode 100644 index 00000000..0d63a12f --- /dev/null +++ b/docs/sql/migrations/2026-09-20-oa-instance-comment.sql @@ -0,0 +1,20 @@ +-- OA 审批实例评论 +CREATE TABLE IF NOT EXISTS `oa_instance_comment` ( + `id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '主键ID', + `instance_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属实例ID', + `content` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '评论正文', + `attachment_refs_json` text COLLATE utf8mb4_unicode_ci COMMENT '引用表单附件快照 JSON', + `status` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'normal' COMMENT 'normal/revoked', + `revoked_time` datetime DEFAULT NULL COMMENT '撤回时间', + `tenant_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'zkxw' COMMENT '租户编号', + `order_num` int(11) DEFAULT NULL COMMENT '排序号', + `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人id(评论作者)', + `create_dept_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建人部门ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人id', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `del_flag` smallint(6) NOT NULL DEFAULT '0' COMMENT '删除标记', + PRIMARY KEY (`id`), + KEY `idx_oa_comment_tenant_inst_time` (`tenant_no`,`instance_id`,`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='OA审批实例评论';