RuoYi-Vue-Plus/ruoyi-modules/ruoyi-md-form/docs/init_table.sql

73 lines
3.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

create table form
(
id bigint unsigned auto_increment comment '主键ID'
primary key,
code varchar(32) not null comment 'code',
name varchar(32) not null comment '表单名称',
agent_id bigint not null,
constraint un_code
unique (agent_id, code)
)
comment '动态表单' collate = utf8mb4_bin;
create table form_field_dict
(
id bigint auto_increment comment '主键ID'
primary key,
config_type varchar(50) not null comment '类型:单位类型、往来单位、税率、费用分类、费用科目、仓库管理',
name varchar(100) not null comment '名称',
code varchar(100) not null comment '',
parent_id bigint unsigned null comment '父级ID也可以是关联的id',
other_fields json null comment '其他字段(JSON格式)',
sort_order int default 0 null comment '排序',
status tinyint default 1 not null comment '状态(1:启用,0:禁用)',
created_by bigint unsigned not null comment '创建人',
updated_by bigint unsigned null comment '更新人',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间',
agent_id bigint not null,
deleted tinyint default 0 not null comment '是否删除(0:否,1:是)'
)
comment '动态表单字段字典表';
create index idx_agent_id_config_type
on form_field_dict (agent_id, config_type);
create table form_template
(
id bigint unsigned auto_increment comment '主键ID'
primary key,
form_id bigint unsigned not null comment 'form id',
version int not null comment '版本',
created_by bigint unsigned not null comment '创建人',
updated_by bigint unsigned null comment '更新人',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间',
agent_id bigint not null,
constraint un_name_version
unique (agent_id, form_id, version)
)
comment '动态表单模板' collate = utf8mb4_bin;
create table form_template_field
(
id bigint unsigned auto_increment comment '主键ID'
primary key,
template_id bigint unsigned null comment 'form_template 的id',
code varchar(32) not null comment '编码',
title varchar(32) not null comment '标题',
show_title varchar(32) not null comment 'show标题',
type varchar(32) not null comment '字段类型',
fixed tinyint(1) not null comment '固定0不固定1固定',
ext json not null comment '扩展属性(JSON格式)',
created_by bigint unsigned not null comment '创建人',
updated_by bigint unsigned null comment '更新人',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间',
agent_id bigint not null,
constraint un_template_id_code
unique (agent_id, template_id, code)
)
comment '动态表单模板字段' collate = utf8mb4_bin;