rebuild/.setup/mysql-init.sql

309 lines
17 KiB
MySQL
Raw Normal View History

2019-01-30 01:27:20 +08:00
-- #1 database/user
2019-01-31 18:38:20 +08:00
-- UNCOMMENT IF YOU NEEDED DB/USER
2019-01-30 01:27:20 +08:00
/*
2019-01-31 18:38:20 +08:00
CREATE DATABASE rebuild10 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
2019-01-03 23:45:33 +08:00
CREATE USER 'rebuild'@'127.0.0.1' IDENTIFIED BY 'rebuild';
2019-01-31 18:38:20 +08:00
GRANT ALL PRIVILEGES ON rebuild10.* TO 'rebuild'@'127.0.0.1';
2019-01-30 01:27:20 +08:00
FLUSH PRIVILEGES;
2019-01-31 18:38:20 +08:00
USE rebuild10;
2019-01-30 01:27:20 +08:00
*/
2019-01-03 23:45:33 +08:00
2019-01-30 01:27:20 +08:00
-- #2 schemas
2019-01-26 16:05:45 +08:00
-- Generated by SchemaGen.java
2019-01-03 23:45:33 +08:00
-- ************ Entity [User] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `user` (
2019-01-03 23:45:33 +08:00
`AVATAR_URL` varchar(300) comment '头像',
`ROLE_ID` char(20) comment '角色',
`JOB_TITLE` varchar(100) comment '职务',
`DEPT_ID` char(20) comment '部门',
`FULL_NAME` varchar(100) comment '姓名',
`USER_ID` char(20) not null,
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`PASSWORD` varchar(100) not null comment '登录密码',
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`LOGIN_NAME` varchar(100) not null comment '登录名',
2019-01-04 23:41:25 +08:00
`QUICK_CODE` varchar(70),
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`IS_DISABLED` char(1) default 'F' comment '是否停用',
`EMAIL` varchar(100) comment '邮箱',
primary key (`USER_ID`),
unique index `UIX1_user` (`LOGIN_NAME`),
unique index `UIX2_user` (`EMAIL`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [Department] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `department` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`DEPT_ID` char(20) not null,
`NAME` varchar(100) not null comment '部门名称',
2019-01-04 23:41:25 +08:00
`QUICK_CODE` varchar(70),
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`IS_DISABLED` char(1) default 'F' comment '是否停用',
`PARENT_DEPT` char(20) comment '父级部门',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
primary key (`DEPT_ID`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [Role] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `role` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`ROLE_ID` char(20) not null,
`NAME` varchar(100) not null comment '角色名称',
2019-01-04 23:41:25 +08:00
`QUICK_CODE` varchar(70),
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`IS_DISABLED` char(1) default 'F' comment '是否停用',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
primary key (`ROLE_ID`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [RolePrivileges] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `role_privileges` (
2019-01-03 23:45:33 +08:00
`PRIVILEGES_ID` char(20) not null,
`ROLE_ID` char(20) not null,
`DEFINITION` varchar(100) comment '权限定义',
`ZERO_KEY` varchar(50) comment '其他权限KEY',
`ENTITY` int(11) not null default '0' comment '哪个实体',
primary key (`PRIVILEGES_ID`),
unique index `UIX1_role_privileges` (`ROLE_ID`, `ENTITY`, `ZERO_KEY`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [RoleMember] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `role_member` (
2019-01-03 23:45:33 +08:00
`ROLE_ID` char(20),
`USER_ID` char(20),
`MEMBER_ID` char(20) not null,
primary key (`MEMBER_ID`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [MetaEntity] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `meta_entity` (
2019-01-03 23:45:33 +08:00
`ENTITY_LABEL` varchar(100) not null comment 'for description',
`COMMENTS` varchar(200),
`ICON` varchar(60),
`NAME_FIELD` varchar(100),
`ENTITY_ID` char(20) not null,
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`MASTER_ENTITY` varchar(100) comment '明细实体-所属主实体',
`TYPE_CODE` smallint(6) not null,
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`PHYSICAL_NAME` varchar(100) not null,
`CREATED_BY` char(20) not null comment '创建人',
`ENTITY_NAME` varchar(100) not null,
`MODIFIED_BY` char(20) not null comment '修改人',
primary key (`ENTITY_ID`),
unique index `UIX1_meta_entity` (`TYPE_CODE`),
unique index `UIX2_meta_entity` (`ENTITY_NAME`),
unique index `UIX3_meta_entity` (`PHYSICAL_NAME`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [MetaField] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `meta_field` (
2019-01-03 23:45:33 +08:00
`FIELD_NAME` varchar(100) not null,
2019-01-04 23:41:25 +08:00
`COMMENTS` varchar(300),
2019-01-03 23:45:33 +08:00
`NULLABLE` char(1) default 'T',
2019-01-04 23:41:25 +08:00
`DEFAULT_VALUE` varchar(300),
2019-01-03 23:45:33 +08:00
`CASCADE` varchar(20) default 'ignore',
`PRECISION` smallint(6) default '6',
2019-01-04 23:41:25 +08:00
`EXT_CONFIG` varchar(700) comment '更多扩展配置JSON格式KV',
2019-01-03 23:45:33 +08:00
`BELONG_ENTITY` varchar(100) not null,
`CREATABLE` char(1) default 'T',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`DISPLAY_TYPE` varchar(100) comment '显示类型.如链接/QQ/电话其实都是文本',
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`PHYSICAL_NAME` varchar(100) not null,
`CREATED_BY` char(20) not null comment '创建人',
`FIELD_LABEL` varchar(100) not null comment 'for description',
`REF_ENTITY` varchar(100),
`UPDATABLE` char(1) default 'T',
`MODIFIED_BY` char(20) not null comment '修改人',
2019-01-04 23:41:25 +08:00
`MAX_LENGTH` smallint(6) default '300',
2019-01-03 23:45:33 +08:00
`FIELD_ID` char(20) not null,
primary key (`FIELD_ID`),
unique index `UIX1_meta_field` (`BELONG_ENTITY`, `FIELD_NAME`),
unique index `UIX2_meta_field` (`BELONG_ENTITY`, `PHYSICAL_NAME`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [PickList] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `pick_list` (
2019-01-03 23:45:33 +08:00
`ITEM_ID` char(20) not null,
`IS_DEFAULT` char(1) default 'F',
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`BELONG_FIELD` varchar(100) not null,
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null,
`TEXT` varchar(100) not null,
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`SEQ` int(11) default '0' comment '排序,小到大',
`IS_HIDE` char(1) default 'F',
primary key (`ITEM_ID`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [LayoutConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `layout_config` (
2019-01-08 00:15:23 +08:00
`APPLY_TYPE` varchar(20) not null comment 'FORM,DATALIST,NAVI',
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
2019-01-08 00:15:23 +08:00
`CONFIG_ID` char(20) not null,
`SHARE_TO` varchar(420) default 'SELF' comment '共享给哪些人,可选值: ALL/SELF/$MemberID(U/D/R)',
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null,
`CONFIG` text(21845) not null comment 'JSON格式配置',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
2019-01-08 00:15:23 +08:00
primary key (`CONFIG_ID`)
2019-01-03 23:45:33 +08:00
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [FilterConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `filter_config` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
2019-01-08 00:15:23 +08:00
`CONFIG_ID` char(20) not null,
2019-01-03 23:45:33 +08:00
`FILTER_NAME` varchar(100) not null,
2019-01-08 00:15:23 +08:00
`SHARE_TO` varchar(420) default 'SELF' comment '共享给哪些人,可选值: ALL/SELF/$MemberID(U/D/R)',
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null,
`CONFIG` text(21845) not null comment 'JSON格式配置',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
2019-01-08 00:15:23 +08:00
primary key (`CONFIG_ID`)
2019-01-03 23:45:33 +08:00
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [ViewAddonsConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `view_addons_config` (
2019-01-08 00:15:23 +08:00
`APPLY_TYPE` varchar(20) not null comment 'TAB,ADD',
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
2019-01-08 00:15:23 +08:00
`CONFIG_ID` char(20) not null,
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null,
`CONFIG` text(21845) not null comment 'JSON格式配置',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
2019-01-08 00:15:23 +08:00
primary key (`CONFIG_ID`),
unique index `UIX1_view_addons_config` (`BELONG_ENTITY`, `APPLY_TYPE`)
2019-01-03 23:45:33 +08:00
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [DashboardConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `dashboard_config` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
2019-01-08 00:15:23 +08:00
`CONFIG_ID` char(20) not null,
2019-01-03 23:45:33 +08:00
`SHARE_TO` varchar(420) default 'SELF' comment '共享给哪些人,可选值: ALL/SELF/$MemberID(U/D/R)',
`MODIFIED_BY` char(20) not null comment '修改人',
`TITLE` varchar(100) not null,
`CONFIG` text(21845) not null comment 'JSON格式配置',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
2019-01-08 00:15:23 +08:00
primary key (`CONFIG_ID`)
2019-01-03 23:45:33 +08:00
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [ChartConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `chart_config` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CHART_ID` char(20) not null,
`CREATED_BY` char(20) not null comment '创建人',
2019-01-08 00:15:23 +08:00
`CHART_TYPE` varchar(100) not null,
2019-01-03 23:45:33 +08:00
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null,
`TITLE` varchar(100) not null,
`CONFIG` text(21845) not null comment 'JSON格式配置',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
primary key (`CHART_ID`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [ShareAccess] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `share_access` (
2019-01-03 23:45:33 +08:00
`ACCESS_ID` char(20) not null,
`RECORD_ID` char(20) not null comment '记录ID',
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`RIGHTS` int(11) not null default '0' comment '共享权限(R=2,U=4,D=8,0=Auto)',
`SHARE_TO` char(20) not null comment '共享给谁 (U/D/R)',
`MODIFIED_BY` char(20) not null comment '修改人',
`BELONG_ENTITY` varchar(100) not null comment '哪个实体',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
primary key (`ACCESS_ID`)
)Engine=InnoDB;
alter table `share_access`
add index `IX1_share_access` (`BELONG_ENTITY`, `RECORD_ID`, `SHARE_TO`);
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [SystemConfig] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `system_config` (
2019-01-03 23:45:33 +08:00
`ITEM` varchar(100) not null,
`CONFIG_ID` char(20) not null,
`VALUE` varchar(600) not null,
primary key (`CONFIG_ID`),
unique index `UIX1_system_config` (`ITEM`)
)Engine=InnoDB;
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [Notification] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `notification` (
2019-01-03 23:45:33 +08:00
`TO_USER` char(20) not null,
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`FROM_USER` char(20) not null,
`UNREAD` char(1) default 'T',
`CREATED_BY` char(20) not null comment '创建人',
`MESSAGE_ID` char(20) not null,
`MODIFIED_BY` char(20) not null comment '修改人',
`MESSAGE` varchar(1000),
`RELATED_RECORD` char(20) comment '相关业务记录',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
primary key (`MESSAGE_ID`)
)Engine=InnoDB;
alter table `notification`
add index `IX1_notification` (`TO_USER`, `UNREAD`, `CREATED_ON`);
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [Attachment] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `attachment` (
2019-01-03 23:45:33 +08:00
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`FILE_SIZE` int(11) default '0' comment 'in KB',
`CREATED_BY` char(20) not null comment '创建人',
`FILE_PATH` varchar(200) not null,
`BELONG_FIELD` varchar(100),
`IN_FOLDER` char(20),
`MODIFIED_BY` char(20) not null comment '修改人',
`ATTACHMENT_ID` char(20) not null,
`BELONG_ENTITY` smallint(6) default '0',
`RELATED_RECORD` char(20) comment '相关业务记录',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`FILE_TYPE` varchar(20),
primary key (`ATTACHMENT_ID`)
)Engine=InnoDB;
alter table `attachment`
add index `IX1_attachment` (`BELONG_ENTITY`, `BELONG_FIELD`, `FILE_PATH`),
add index `IX2_attachment` (`RELATED_RECORD`),
add index `IX3_attachment` (`IN_FOLDER`, `CREATED_ON`);
2019-01-04 23:41:25 +08:00
2019-01-03 23:45:33 +08:00
-- ************ Entity [AttachmentFolder] DDL ************
2019-01-26 16:05:45 +08:00
create table if not exists `attachment_folder` (
2019-01-03 23:45:33 +08:00
`PARENT` char(20),
`MODIFIED_ON` timestamp not null default '0000-00-00 00:00:00' comment '修改时间',
`CREATED_BY` char(20) not null comment '创建人',
`NAME` varchar(100) not null,
`MODIFIED_BY` char(20) not null comment '修改人',
`CREATED_ON` timestamp not null default '0000-00-00 00:00:00' comment '创建时间',
`FOLDER_ID` char(20) not null,
primary key (`FOLDER_ID`)
)Engine=InnoDB;
2019-01-30 01:27:20 +08:00
-- #3 datas
2019-01-03 23:45:33 +08:00
-- User
2019-01-05 00:55:17 +08:00
INSERT INTO `user` (`USER_ID`, `LOGIN_NAME`, `PASSWORD`, `FULL_NAME`, `DEPT_ID`, `ROLE_ID`, `IS_DISABLED`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`, `QUICK_CODE`)
2019-01-04 23:41:25 +08:00
VALUES
('001-0000000000000000', 'system', 'system', '系统用户', '002-0000000000000001', '003-0000000000000001', 'T', CURRENT_TIMESTAMP, '001-0000000000000000', CURRENT_TIMESTAMP, '001-0000000000000000', 'XTYH'),
('001-0000000000000001', 'admin', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918', '超级管理员', '002-0000000000000001', '003-0000000000000001', 'F', CURRENT_TIMESTAMP, '001-0000000000000000', CURRENT_TIMESTAMP, '001-0000000000000000', 'CJGLY');
2019-01-03 23:45:33 +08:00
-- Department
2019-01-05 00:55:17 +08:00
INSERT INTO `department` (`DEPT_ID`, `NAME`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`, `QUICK_CODE`)
2019-01-04 23:41:25 +08:00
VALUES ('002-0000000000000001', '总部', CURRENT_TIMESTAMP, '001-0000000000000000', CURRENT_TIMESTAMP, '001-0000000000000000', 'ZB');
2019-01-03 23:45:33 +08:00
-- Role
2019-01-05 00:55:17 +08:00
INSERT INTO `role` (`ROLE_ID`, `NAME`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`, `QUICK_CODE`)
2019-01-04 23:41:25 +08:00
VALUES ('003-0000000000000001', '管理员', CURRENT_TIMESTAMP, '001-0000000000000000', CURRENT_TIMESTAMP, '001-0000000000000000', 'GLY');
2019-01-26 16:18:05 +08:00
-- Optional data
INSERT INTO `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `APPLY_TYPE`, `CONFIG`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`) VALUES ('013-016870a743fb0000', 'User', 'FORM', '[{"field":"fullName","isFull":false},{"field":"email","isFull":false},{"field":"loginName","isFull":false},{"field":"password","isFull":false},{"field":"$DIVIDER$","isFull":true,"label":"分栏"},{"field":"deptId","isFull":false},{"field":"roleId","isFull":false},{"field":"isDisabled","isFull":false}]', 'ALL', '2019-01-21 21:43:57', '001-0000000000000001', '2019-01-26 16:09:07', '001-0000000000000001');
INSERT INTO `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `APPLY_TYPE`, `CONFIG`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`) VALUES ('013-016870aa702a0001', 'Department', 'FORM', '[{"field":"name","isFull":false},{"field":"parentDept","isFull":false},{"field":"isDisabled","isFull":false}]', 'ALL', '2019-01-21 21:47:25', '001-0000000000000001', '2019-01-26 16:09:50', '001-0000000000000001');
INSERT INTO `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `APPLY_TYPE`, `CONFIG`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`) VALUES ('013-0168893255a50016', 'Role', 'FORM', '[{"field":"name","isFull":false},{"field":"isDisabled","isFull":false}]', 'ALL', '2019-01-26 16:06:44', '001-0000000000000001', '2019-01-26 16:10:11', '001-0000000000000001');