deason 1 жил өмнө
parent
commit
eca13eb166

+ 46 - 33
install/mysql/init/exam_reserve_db.sql

@@ -1,3 +1,25 @@
+create table t_system_property
+(
+    id          bigint       not null auto_increment,
+    create_time bigint       not null comment '创建时间',
+    update_time bigint       not null comment '更新时间',
+    `key`       varchar(50)  not null comment '属性键',
+    value       varchar(500) not null comment '属性值',
+    PRIMARY KEY (id)
+) comment '系统属性表';
+
+
+create table t_org
+(
+    id          bigint      not null auto_increment,
+    create_time bigint      not null comment '创建时间',
+    update_time bigint      not null comment '更新时间',
+    enable      bit(1)      not null comment '是否启用',
+    name        varchar(50) not null comment '机构名称',
+    PRIMARY KEY (id)
+) comment '机构表';
+
+
 create table t_user
 (
     id          bigint      not null auto_increment,
@@ -10,7 +32,7 @@ create table t_user
     password    varchar(32) not null comment '密码',
     mobile      varchar(20) comment '联系方式',
     category_id bigint comment '所属教学点ID,角色为教学点管理员,必填',
-    org_id      bigint comment '所属租户机构ID(预留字段)',
+    org_id      bigint      not null comment '所属机构ID(学校)',
     PRIMARY KEY (id)
 ) comment '用户表';
 
@@ -20,6 +42,7 @@ create table t_student
     id              bigint      not null auto_increment,
     create_time     bigint      not null comment '创建时间',
     update_time     bigint      not null comment '更新时间',
+    org_id          bigint      not null comment '所属机构ID(学校)',
     name            varchar(50) not null comment '考生姓名',
     identity_number varchar(20) not null comment '证件号',
     student_code    varchar(20) not null comment '学号',
@@ -31,7 +54,6 @@ create table t_student
     category_id     bigint      not null comment '所属教学点ID',
     apply_number    int         not null comment '允许预约时段数量',
     apply_finished  bit(1)      not null comment '预约时段是否全部完成',
-    org_id          bigint comment '所属租户机构ID(预留字段)',
     PRIMARY KEY (id)
 ) comment '考生表';
 
@@ -42,6 +64,7 @@ create table t_category
     create_time bigint      not null comment '创建时间',
     update_time bigint      not null comment '更新时间',
     enable      bit(1)      not null comment '是否启用',
+    org_id      bigint      not null comment '所属机构ID(学校)',
     parent_id   bigint      not null default 0 comment '父级ID,顶级值为0',
     code        varchar(20) not null comment '分类代码',
     name        varchar(50) not null comment '分类名称',
@@ -88,6 +111,7 @@ create table t_apply_task
     create_time             bigint      not null comment '创建时间',
     update_time             bigint      not null comment '更新时间',
     enable                  bit(1)      not null comment '是否启用',
+    org_id                  bigint      not null comment '所属机构ID(学校)',
     name                    varchar(50) not null comment '任务名称',
     allow_apply_days        int         not null comment '考前多少天,禁止考生自主预约',
     allow_apply_cancel_days int         not null comment '考前多少天,禁止考生自主取消预约',
@@ -114,14 +138,14 @@ create table t_time_period
 
 create table t_student_apply
 (
-    id             bigint      not null auto_increment,
-    create_time    bigint      not null comment '创建时间',
-    update_time    bigint      not null comment '更新时间',
-    student_id     bigint      not null comment '考生ID',
-    exam_site_id   bigint      not null comment '预约的考点ID',
-    exam_room_id   bigint      not null comment '预约的考场ID',
-    time_period_id varchar(50) not null comment '预约时段ID',
-    cancel         bit(1)      not null comment '是否取消预约',
+    id             bigint not null auto_increment,
+    create_time    bigint not null comment '创建时间',
+    update_time    bigint not null comment '更新时间',
+    student_id     bigint not null comment '考生ID',
+    exam_site_id   bigint not null comment '预约的考点ID',
+    exam_room_id   bigint not null comment '预约的考场ID',
+    time_period_id bigint not null comment '预约时段ID',
+    cancel         bit(1) not null comment '是否取消预约',
     ticketNumber   varchar(50) comment '准考证号',
     seatNumber     varchar(20) comment '座位号',
     PRIMARY KEY (id)
@@ -130,14 +154,15 @@ create table t_student_apply
 
 create table t_student_import_task
 (
-    id          bigint       not null auto_increment,
-    create_time bigint       not null comment '创建时间',
-    update_time bigint       not null comment '更新时间',
-    operate_id  bigint       not null comment '操作人ID',
-    type        varchar(20)  not null comment '导入类型',
-    status      varchar(20)  not null comment '执行状态',
-    file_path   varchar(200) not null comment '导入文件相对路径',
-    message     text comment '执行结果信息',
+    id            bigint       not null auto_increment,
+    create_time   bigint       not null comment '创建时间',
+    update_time   bigint       not null comment '更新时间',
+    operate_id    bigint       not null comment '操作人ID',
+    apply_task_id bigint       not null comment '所属预约任务ID',
+    type          varchar(20)  not null comment '导入类型',
+    status        varchar(20)  not null comment '执行状态',
+    file_path     varchar(200) not null comment '导入文件相对路径',
+    message       text comment '执行结果信息',
     PRIMARY KEY (id)
 ) comment '考生导入任务表';
 
@@ -154,20 +179,9 @@ create table t_operate_log
 ) comment '操作日志表';
 
 
-create table t_system_property
-(
-    id          bigint       not null auto_increment,
-    create_time bigint       not null comment '创建时间',
-    update_time bigint       not null comment '更新时间',
-    `key`       varchar(50)  not null comment '属性键',
-    value       varchar(500) not null comment '属性值',
-    PRIMARY KEY (id)
-) comment '系统属性表';
-
-
-
-insert into t_system_property(`key`, value, create_time, update_time)
-values ('ORG_TITLE', '广东开发大学', now(), now());
+-- 基础数据
+insert into t_org(id, name, enable, create_time, update_time)
+values (1, '广东开发大学', 1, now(), now());
 
 insert into t_system_property(`key`, value, create_time, update_time)
 values ('CATEGORY_LEVEL', '[{"level":1,"title":"城市"},{"level":2,"title":"教学点"}]', now(), now());
@@ -176,4 +190,3 @@ insert into t_user (role, name, login_name, password, mobile, category_id, org_i
 values ('ADMIN', '学校管理员', 'admin', UPPER(SHA2('123456', 256)), null, null, 1, 1, now(), now());
 
 
-