| 1234567891011121314151617181920212223242526272829303132333435 |
- -- 电子数据字典表(案件 DuckDB)
- -- 用途:保存电子数据展示层需要的编码名称,例如案件类型、证件类型、系统类型、
- -- 即时通信应用类型等;查询接口按 code_type_code + code_value 翻译为中文名称。
- -- 说明:字典随案件存放在案件 DuckDB,EdsDictStore 会按案件 ID 加载并缓存;
- -- 新增案件从基础案件库模板复制时需要包含本表,已有案件需单独执行本脚本。
- create table if not exists eds_dict
- (
- code_type varchar not null, -- 编码分类名称,例如“即时通信应用类型”
- code_type_code varchar not null, -- 编码分类代码,例如 WACODE_0163
- code_value varchar, -- 编码值,例如 000001
- code_name varchar not null, -- 编码名称,例如 微信
- remark varchar, -- 备注
- sort integer, -- 同一分类下的展示顺序
- state integer default 1, -- 状态:1 正常,2 停用
- create_time timestamp, -- 创建时间
- update_time timestamp, -- 更新时间
- unique (code_type_code, code_value)
- );
- create index if not exists idx_eds_dict_type
- on eds_dict (code_type_code, state, sort);
- comment on table eds_dict is '电子数据编码字典';
- comment on column eds_dict.code_type is '编码分类名称';
- comment on column eds_dict.code_type_code is '编码分类代码';
- comment on column eds_dict.code_value is '编码值';
- comment on column eds_dict.code_name is '编码名称';
- comment on column eds_dict.sort is '分类内排序';
- comment on column eds_dict.state is '状态:1正常,2停用';
- -- 旧库 MySQL 数据迁移示例(在目标案件 DuckDB 中执行,源表字段:bmlx_py、bmsz、bmmc、sort、state):
- -- insert into eds_dict (code_type, code_type_code, code_value, code_name, sort, state, create_time)
- -- select bmlx_py, bmlx_py, bmsz, bmmc, sort, state, now()
- -- from <旧库>.eds_dict
- -- on conflict (code_type_code, code_value) do nothing;
|