修改问题、添加监管数据报送模块

这个提交包含在:
apple
2026-11-24 16:05:24 +08:00
父节点 fb47c07f7c
当前提交 c5760c74eb
共修改 74 个文件,包含 2631 行新增和 41 行删除
@@ -0,0 +1,73 @@
-- Reporting configuration is scoped to the authenticated organization. No target data is seeded.
CREATE TABLE dg_reporting_config (
config_id VARCHAR(36) NOT NULL,
organization_id BIGINT NOT NULL,
config_kind VARCHAR(16) NOT NULL,
config_code VARCHAR(64) NOT NULL,
config_name VARCHAR(160) NOT NULL,
parent_id VARCHAR(36) NULL,
root_id VARCHAR(36) NOT NULL,
enabled INT NOT NULL DEFAULT 0,
state_json LONGTEXT NOT NULL,
credential_ref VARCHAR(512) NULL,
version BIGINT NOT NULL DEFAULT 0,
command_sha256 CHAR(64) NOT NULL,
create_dept BIGINT NOT NULL,
create_by BIGINT NOT NULL,
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_by BIGINT NOT NULL,
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (organization_id,config_id),
UNIQUE KEY uk_reporting_code (organization_id,config_kind,config_code),
KEY idx_reporting_parent (organization_id,parent_id,enabled),
KEY idx_reporting_root (organization_id,root_id),
CONSTRAINT ck_reporting_kind CHECK (config_kind IN ('DEPARTMENT','SYSTEM','TOPIC')),
CONSTRAINT ck_reporting_enabled CHECK (enabled IN (0,1)),
CONSTRAINT ck_reporting_version CHECK (version>=0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE dg_reporting_audit (
audit_id VARCHAR(36) NOT NULL,
organization_id BIGINT NOT NULL,
object_id VARCHAR(36) NOT NULL,
action_name VARCHAR(40) NOT NULL,
actor_id BIGINT NOT NULL,
object_version BIGINT NOT NULL,
reason VARCHAR(1000) NULL,
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (audit_id),
KEY idx_reporting_audit (organization_id,object_id,create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE dg_reporting_template (
template_id VARCHAR(36) NOT NULL,
organization_id BIGINT NOT NULL,
file_sha256 CHAR(64) NOT NULL,
record_element VARCHAR(128) NOT NULL,
fields_json LONGTEXT NOT NULL,
create_by BIGINT NOT NULL,
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (organization_id,template_id),
UNIQUE KEY uk_reporting_template (organization_id,file_sha256,record_element)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE dg_reporting_standard (
standard_id VARCHAR(36) NOT NULL,
organization_id BIGINT NOT NULL,
standard_code VARCHAR(128) NOT NULL,
standard_name VARCHAR(160) NOT NULL,
version_label VARCHAR(64) NOT NULL,
standard_status VARCHAR(16) NOT NULL,
definition_json LONGTEXT NOT NULL,
difference_confirmation VARCHAR(1000) NULL,
command_sha256 CHAR(64) NOT NULL,
version BIGINT NOT NULL DEFAULT 0,
create_by BIGINT NOT NULL,
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_by BIGINT NOT NULL,
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (organization_id,standard_id),
UNIQUE KEY uk_reporting_standard (organization_id,standard_code,version_label),
CONSTRAINT ck_reporting_standard_status CHECK (standard_status IN ('DRAFT','PUBLISHED','DISABLED')),
CONSTRAINT ck_reporting_standard_version CHECK (version>=0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;