-- ----------------------------
-- 专业方向招生计划详情
-- ----------------------------
DROP TABLE IF EXISTS enrollment_plan_major_set;
create table if not exists enrollment_plan_major_set
(
    id                                bigint   not null comment '主键编号',
    create_user_id                    bigint   null comment '创建人',
    create_date                       datetime null comment '创建时间',
    modify_user_id                    bigint   null comment '修改人',
    modify_date                       datetime null comment '修改时间',
    delete_mark                       int      not null comment '删除标记',
    enabled_mark                      int      not null comment '有效标志',
    sort_code                         int      null comment '序号',
    enrollment_plan_id                bigint   not null comment '招生计划维护id(enrollment_plan)',
    base_major_set_id                 bigint   not null comment '专业方向id(base_major_set)',
    base_major_set_enrollment_num     int default 0 comment '专业方向计划招生人数',
    base_major_set_enrollment_num_max int default 0 comment '专业方向最大计划招生人数',
    PRIMARY KEY (`id`)
) ENGINE = INNODB
  DEFAULT CHARSET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT '专业方向招生计划详情';
-- ----------------------------
-- 毕业学校招生计划详情
-- ----------------------------
DROP TABLE IF EXISTS enrollment_plan_graduate_school;
create table if not exists enrollment_plan_graduate_school
(
    id                           bigint   not null comment '主键编号',
    create_user_id               bigint   null comment '创建人',
    create_date                  datetime null comment '创建时间',
    modify_user_id               bigint   null comment '修改人',
    modify_date                  datetime null comment '修改时间',
    delete_mark                  int      not null comment '删除标记',
    enabled_mark                 int      not null comment '有效标志',
    sort_code                    int      null comment '序号',
    enrollment_plan_major_set_id bigint   not null comment '专业方向招生计划详情id(enrollment_plan_major_set)',
    base_graduate_school_id      bigint   not null comment '毕业学校id(base_graduate_school)',
    enrollment_num               int default 0 comment '毕业学校计划招生人数',
    PRIMARY KEY (`id`)
) ENGINE = INNODB
  DEFAULT CHARSET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT '毕业学校招生计划详情';

alter table enrollment_plan
    modify name varchar(128) null comment '计划名称';
alter table enrollment_plan
    modify start_date date null comment '开始时间';
alter table enrollment_plan
    modify end_date date null comment '结束时间';

ALTER TABLE enrollment_plan_graduate_school ADD INDEX index_enrollment_plan_major_set_id (enrollment_plan_major_set_id);
