Quellcode durchsuchen

[update] message:1初始化脚本

kelei vor 6 Monaten
Ursprung
Commit
9d30c9b65d

+ 284 - 0
admin/src/main/resources/mysql/ddl/init-table.sql

@@ -0,0 +1,284 @@
+drop table if exists tb_app_user;
+create table tb_app_user
+(
+    id int auto_increment comment '主键'
+        primary key,
+    union_id varchar(255) null,
+    tel varchar(15) null comment '手机号',
+    name varchar(32) null comment '用户名',
+    sex int null comment '性别-{0:女,1:男}',
+    open_id varchar(255) null,
+    icon varchar(255) null comment '机构id',
+    app_id varchar(255) null,
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '小程序用户';
+
+drop table if exists tb_area;
+create table tb_area
+(
+    id int auto_increment comment '主键'
+        primary key,
+    garden_id int null comment '果园id',
+    name varchar(255) null comment '区域名称',
+    wkt varchar(255) null comment '坐标',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '区域';
+
+drop table if exists tb_foster_record;
+create table tb_foster_record
+(
+    id int auto_increment comment '主键'
+        primary key,
+    app_user_id int null comment '小程序用户id',
+    tree_id int null comment '树id',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '领养记录';
+
+drop table if exists tb_garden;
+create table tb_garden
+(
+    id int auto_increment comment '主键'
+        primary key,
+    user_id int null comment '用户id',
+    base_map_url varchar(255) null comment '底图',
+    qr_code varchar(255) null comment '二维码',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '果园';
+
+drop table if exists tb_menu;
+create table tb_menu
+(
+    id int auto_increment comment '主键'
+        primary key,
+    menu_name varchar(32) null comment '菜单名称',
+    menu_code varchar(32) null comment '菜单编码',
+    parent_id int null comment '父节点',
+    is_admin int default 0 null comment '0:嘉谷和医院的菜单,1:嘉谷的菜单',
+    menu_sort int null comment '菜单排序',
+    type int null comment '菜单类型-{0:父级菜单 1:菜单,2:权限}',
+    permission varchar(100) null comment '权限',
+    url varchar(100) null comment '前端页面路径',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '菜单表';
+
+drop table if exists tb_poster_lib;
+create table tb_poster_lib
+(
+    id int auto_increment comment '主键'
+        primary key,
+    url varchar(255) null comment '海报url',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '海报库';
+
+drop table if exists tb_role;
+create table tb_role
+(
+    id int auto_increment comment '主键'
+        primary key,
+    role_name varchar(35) not null comment '角色名称',
+    role_code varchar(50) null comment '角色编码',
+    is_admin int default 0 null comment '管理员角色-{0:不是,1:是}',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '角色表';
+
+drop table if exists tb_role_menu;
+create table tb_role_menu
+(
+    id int auto_increment comment '主键'
+        primary key,
+    role_id int not null comment '角色id',
+    menu_id int not null comment '菜单id',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '角色菜单关系表';
+
+drop table if exists tb_tenant;
+create table tb_tenant
+(
+    id int auto_increment comment '主键'
+        primary key,
+    tenant_name varchar(100) null comment '租户名称',
+    parent_id int default 0 null comment '父级id',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time timestamp null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time timestamp null comment '更新时间'
+)
+    comment '系统租户表';
+
+drop table if exists tb_tree;
+create table tb_tree
+(
+    id int auto_increment comment '主键'
+        primary key,
+    garden_id int null comment '果园id',
+    area_id int null comment '区域id',
+    wkt varchar(255) null comment '坐标',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '树';
+
+drop table if exists tb_tree_image;
+create table tb_tree_image
+(
+    id int auto_increment comment '主键'
+        primary key,
+    tree_id varchar(255) null comment '树id',
+    url varchar(255) null comment '图片地址',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '树照片';
+
+drop table if exists tb_tree_poster_content;
+create table tb_tree_poster_content
+(
+    id int auto_increment comment '主键'
+        primary key,
+    poster_url varchar(255) null comment '海报url',
+    content varchar(255) null comment '悄悄话内容',
+    app_user_id int null comment '小程序用户id',
+    tree_id int null comment '树id',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '果树海报悄悄话';
+
+drop table if exists tb_user;
+create table tb_user
+(
+    id int auto_increment comment '主键'
+        primary key,
+    username varchar(32) null comment '账号',
+    password varchar(100) null comment '密码',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间',
+    constraint username
+        unique (username)
+)
+    comment '用户表';
+
+drop table if exists tb_user_role;
+create table tb_user_role
+(
+    id int auto_increment comment '主键'
+        primary key,
+    user_id int not null comment '用户id',
+    role_id int not null comment '角色id',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '用户角色表';
+
+drop table if exists tb_whisper;
+create table tb_whisper
+(
+    id int auto_increment comment '主键'
+        primary key,
+    content varchar(255) null comment '文案内容',
+    status int default 1 null comment '状态-{0.不可用 1.可用}',
+    tenant_id int default 0 null comment '租户号',
+    version int default 1 null comment '乐观锁',
+    is_deleted int default 0 null comment '是否删除',
+    created_by varchar(32) null comment '创建人',
+    created_time datetime null comment '创建时间',
+    updated_by varchar(32) null comment '更新人',
+    updated_time datetime null comment '更新时间'
+)
+    comment '悄悄话';
+

+ 116 - 0
admin/src/main/resources/mysql/dml/init-data.sql

@@ -0,0 +1,116 @@
+INSERT INTO foster.tb_tenant (id, tenant_name, parent_id, status, version, is_deleted, created_by, created_time,
+                              updated_by, updated_time)
+VALUES (1, '飞鸟', 0, 1, 1, 0, 'kelei', '2024-05-08 14:47:04', 'kelei', '2024-05-08 14:47:13');
+
+INSERT INTO foster.tb_user (id, username, password, status, tenant_id, version, is_deleted, created_by, created_time,
+                            updated_by, updated_time)
+VALUES (1, 'kelei', 'e10adc3949ba59abbe56e057f20f883e', 1, 1, 1, 0, 'kelei', '2024-05-08 14:46:51', 'kelei',
+        '2024-05-08 14:46:35');
+
+INSERT INTO foster.tb_user_role (id, user_id, role_id, status, tenant_id, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (1, 1, 1, 1, 1, 1, 0, 'kelei', '2024-05-08 14:49:08', 'kelei', '2024-05-08 14:49:17');
+
+INSERT INTO foster.tb_role (id, role_name, role_code, is_admin, status, tenant_id, version, is_deleted, created_by,
+                            created_time, updated_by, updated_time)
+VALUES (1, '系统管理员', 'sys_admin', 1, 1, 1, 1, 0, 'kelei', '2024-05-08 14:48:22', 'kelei', '2024-05-08 14:48:31');
+
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (1, 1, 1, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (2, 1, 2, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (3, 1, 3, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (4, 1, 4, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (5, 1, 5, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (6, 1, 6, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (7, 1, 7, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (8, 1, 8, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (9, 1, 9, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (10, 1, 10, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (11, 1, 11, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (12, 1, 12, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (13, 1, 13, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+INSERT INTO foster.tb_role_menu (id, role_id, menu_id, status, version, is_deleted, created_by, created_time,
+                                 updated_by, updated_time)
+VALUES (14, 1, 14, 1, 1, 0, 'kelei', '2024-05-08 14:51:38', 'kelei', '2024-05-08 14:51:38');
+
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (1, '设置', 'MENU_SETTING', 0, 0, 1, 0, null, '/test/api', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (2, '账号设置', 'MENU_ACCOUNT_SETTING', 1, 0, 0, 1, null, 'system/Users', 1, 1, 0, 'kelei', '2024-05-08 17:03:54',
+        'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (3, '新增账号', 'MENU_ACCOUNT_ADD', 2, 0, 2, 2, 'ACCOUNT:ADD', '', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (4, '角色设置', 'MENU_ROLE_SETTING', 1, 0, 1, 1, null, 'system/Roles', 1, 1, 0, 'kelei', '2024-05-08 17:03:54',
+        'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (5, '角色权限设置', 'MENU_ROLE_PERMISSION_SETTING', 4, 0, 6, 2, null, '/test/api', 1, 1, 0, 'kelei',
+        '2024-05-08 17:03:54', 'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (6, '新增角色', 'MENU_ROLE_ADD', 4, 0, 2, 2, 'ROLE:ADD', '', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (7, '新增组织机构', 'MENU_TENANT_ADD', 8, 1, 6, 2, 'MENU_TENANT_ADD', '/test/api', 1, 1, 0, 'kelei',
+        '2024-05-08 17:03:54', 'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (8, '组织机构设置', 'MENU_TENANT', 1, 1, 2, 1, null, 'system/Tenant', 1, 1, 1, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (9, '果园', 'MENU_GARDEN_MANAGE', 0, 0, 2, 0, null, '/test/api', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (10, '区域管理', 'MENU_AREA_MANAGE', 9, 0, 1, 1, null, 'garden/Areas', 1, 1, 0, 'kelei', '2024-05-08 17:03:54',
+        'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (11, '果树管理', 'MENU_TREE_MANAGE', 9, 0, 2, 1, null, 'garden/tree', 1, 1, 0, 'kelei', '2024-05-08 17:03:54',
+        'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (12, '海报库', 'MENU_POSTER', 1, 0, 3, 1, null, 'system/poster', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (13, '悄悄话库', 'MENU_WHISPER', 1, 0, 4, 1, null, 'system/whisper', 1, 1, 0, 'kelei', '2024-05-08 17:03:54',
+        'kelei', '2024-05-08 17:03:54');
+INSERT INTO foster.tb_menu (id, menu_name, menu_code, parent_id, is_admin, menu_sort, type, permission, url, status,
+                            version, is_deleted, created_by, created_time, updated_by, updated_time)
+VALUES (14, '果园管理', 'MENU_GARDEN', 9, 0, 3, 1, null, 'garden/Gardens', 1, 1, 0, 'kelei', '2024-05-08 17:03:54', 'kelei',
+        '2024-05-08 17:03:54');