-- -------------------------------------------------------------------------------------------------------------------
-- 实习计划带队老师表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS internship_plan_teacher;
CREATE TABLE `internship_plan_teacher` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `internship_plan_manage_id` BIGINT NOT NULL COMMENT '所属实习计划id(internship_plan_manage)',
  `user_id` BIGINT NOT NULL COMMENT '带队老师id(xjr_user)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='实习计划带队老师表';

ALTER TABLE internship_plan_teacher
  ADD INDEX (internship_plan_manage_id);



-- -------------------------------------------------------------------------------------------------------------------
-- 实习计划班级表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS internship_plan_class;
CREATE TABLE `internship_plan_class` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `internship_plan_teacher_id` BIGINT NOT NULL COMMENT '带队老师(internship_plan_teacher)',
  `internship_plan_manage_id` BIGINT NOT NULL COMMENT '所属实习计划id(internship_plan)',
  `class_id` BIGINT NOT NULL COMMENT '班级id(base_class)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='实习计划班级表';

ALTER TABLE internship_plan_class
  ADD INDEX (internship_plan_manage_id),
  ADD INDEX (internship_plan_teacher_id);
ALTER TABLE internship_plan_class
  ADD INDEX (class_id);


-- -------------------------------------------------------------------------------------------------------------------
-- 实习计划学生表，增加字段
-- -------------------------------------------------------------------------------------------------------------------
ALTER TABLE internship_plan_manage_participant
  ADD COLUMN teacher_id BIGINT NULL COMMENT '带队老师(xjr_user)' AFTER class_name,
  ADD COLUMN result VARCHAR (50) NULL COMMENT '实习结果评价' AFTER teacher_id;


-- -------------------------------------------------------------------------------------------------------------------
-- 实习计划学生表，增加字段
-- -------------------------------------------------------------------------------------------------------------------
ALTER TABLE internship_plan_manage_participant
  ADD COLUMN teacher_id BIGINT NULL COMMENT '带队老师(xjr_user)' AFTER class_name,
  ADD COLUMN result VARCHAR (50) NULL COMMENT '实习结果评价' AFTER teacher_id;

-- -------------------------------------------------------------------------------------------------------------------
-- 实习计划表，增加状态字段
-- -------------------------------------------------------------------------------------------------------------------
ALTER TABLE internship_plan_manage
  ADD COLUMN STATUS INT NULL COMMENT '状态(0:草稿 1:实习中 2:已结束)' AFTER academic_year;

ALTER TABLE internship_plan_manage
  ADD COLUMN internship_unit_id BIGINT NULL COMMENT '实习单位id(company_coop)' AFTER STATUS;


-- -------------------------------------------------------------------------------------------------------------------
-- 实习带队教师收集表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS internship_teacher_collect;
CREATE TABLE `internship_teacher_collect` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `base_semester_id` BIGINT NOT NULL COMMENT '所属学期(base_semester)',
  `name` VARCHAR(100) DEFAULT NULL COMMENT '名称',
  `start_date` DATE NOT NULL COMMENT '开始日期',
  `end_date` DATE NOT NULL COMMENT '结束日期',
  `status` INT DEFAULT 0 COMMENT '状态(0:草稿 1:收集中 2:已结束)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='实习带队教师收集表';

-- -------------------------------------------------------------------------------------------------------------------
-- 实习带队教师报名表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS internship_teacher_collect_enroll;
CREATE TABLE `internship_teacher_collect_enroll` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `internship_teacher_collect_id` BIGINT NOT NULL COMMENT '实习带队教师收集表(internship_teacher_collect)',
  `remarks` VARCHAR(500) DEFAULT NULL COMMENT '说明',
  `user_id` BIGINT NOT NULL COMMENT '报名教师(xjr_user)',
  `folder_id` BIGINT DEFAULT NULL COMMENT '附件(xjr_file)',
  `status` INT DEFAULT NULL COMMENT '审核状态(null:未审核 0:未通过 1:通过)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='实习带队教师报名表';


-- -------------------------------------------------------------------------------------------------------------------
-- 学生特异体质登记表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS student_special_constitution;
CREATE TABLE `student_special_constitution` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `reason` VARCHAR(500) DEFAULT NULL COMMENT '缘由',
  `student_user_id` BIGINT NOT NULL COMMENT '登记学生(xjr_user)',
  `class_id` BIGINT DEFAULT NULL COMMENT '所属班级(base_class)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生特异体质登记表';


-- -------------------------------------------------------------------------------------------------------------------
-- 学生自主实习申请表
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS student_internship_alone_apply;
CREATE TABLE `student_internship_alone_apply` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `reason` VARCHAR(500) DEFAULT NULL COMMENT '缘由',
  `student_user_id` BIGINT NOT NULL COMMENT '登记学生(xjr_user)',
  `class_id` BIGINT DEFAULT NULL COMMENT '所属班级(base_class)',
  `internship_plan_manage_id` BIGINT NOT NULL COMMENT '所属实习计划id(internship_plan_manage)',
  `folder_id` BIGINT DEFAULT NULL COMMENT '申请附件(xjr_file)',
  `report_content` VARCHAR(1000) DEFAULT NULL COMMENT '实习报告内容',
  `contract_folder_id` BIGINT DEFAULT NULL COMMENT '合同附件(xjr_file)',
  `wages_folder_id` BIGINT DEFAULT NULL COMMENT '工资流水附件(xjr_file)',
  `summarize_folder_id` BIGINT DEFAULT NULL COMMENT '总结材料附件(xjr_file)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生自主实习申请表';


-- -------------------------------------------------------------------------------------------------------------------
-- 学生实习记录
-- -------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS student_internship_record;
CREATE TABLE `student_internship_record` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  `delete_mark` INT NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `modify_user_id` BIGINT DEFAULT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `student_user_id` BIGINT NOT NULL COMMENT '登记学生(xjr_user)',
  `record_time` DATETIME DEFAULT NULL COMMENT '实习时间',
  `record_report_type` INT DEFAULT NULL COMMENT '实行类型(0:实习综合报告 1:周报 2:月报)',
  `internship_plan_manage_id` BIGINT NOT NULL COMMENT '所属实习计划id(internship_plan_manage)',
  `is_internship_alone` INT NOT NULL COMMENT '是否自主实习(1:是 0:否)',
  `record_content` VARCHAR(1000) DEFAULT NULL COMMENT '实习报告内容',
  `folder_id` BIGINT DEFAULT NULL COMMENT '附件(xjr_file)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生实习记录表';





