-- --------------------------------------------------------------------------------------------
-- 微信消息模板
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS wechat_message_template;   
CREATE TABLE `wechat_message_template` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `name` BIGINT DEFAULT NULL COMMENT '活动(activity_info)',
  user_id DATETIME DEFAULT NULL COMMENT '参与人(xjr_user)',
  STATUS INT DEFAULT 0 COMMENT '状态(0:待确认 1:未参与 2:已参与)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动登记表';


ALTER TABLE  `textbook`   
  CHANGE `textbook_type` `textbook_type` VARCHAR(20) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL   COMMENT '教材分类(xjr_dictionary_item[textbook_type])',
  ADD COLUMN `textbook_category` VARCHAR(30) NULL   COMMENT '教材类型' AFTER `work_total_count`;

-- --------------------------------------------------------------------------------------------
-- 奖学金发放记录表
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS base_student_scholarship_release;   
CREATE TABLE `base_student_scholarship_release` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `base_student_scholarship_applicant_id` BIGINT DEFAULT NULL COMMENT '奖学金申请id',
  `amount` DOUBLE DEFAULT NULL COMMENT '发放金额',
  `release_date` DATETIME DEFAULT NULL COMMENT '发放日期',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='奖学金发放记录表';


ALTER TABLE `base_student_scholarship_applicant`   
  ADD COLUMN `bank_user_name` VARCHAR(50) NULL   COMMENT '银行账户名称' AFTER `release_status`;

ALTER TABLE `base_student_scholarship_applicant`   
  CHANGE `release_status` `release_status` INT DEFAULT 0  NOT NULL   COMMENT '发放状态（2:全部发放 1:部分发放 0:未发放）';

DROP TABLE IF EXISTS base_employment_information;
CREATE TABLE `base_employment_information` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATE DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATE DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `job_name` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '就业岗位名称',
  `salary` VARCHAR(100) DEFAULT NULL COMMENT '薪资待遇',
  `industry_information` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '行业信息',
  `develop_prospect` VARCHAR(500) DEFAULT NULL COMMENT '发展前景',
  `employ_advice` VARCHAR(500) DEFAULT NULL COMMENT '就业建议',
  `major_set` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '关联专业方向',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='就业信息维护';

ALTER TABLE `base_student_scholarship_applicant`   
  ADD COLUMN `review_status` INT DEFAULT 0  NULL   COMMENT '评审状态' AFTER `bank_user_name`;


-- --------------------------------------------------------------------------------------------
-- 第二课堂
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS second_course;   
CREATE TABLE `second_course` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `base_semester_id` BIGINT DEFAULT NULL COMMENT '学期id',
  `name` VARCHAR(100) DEFAULT NULL COMMENT '课程名称',
  `content` VARCHAR(1000) DEFAULT NULL COMMENT '课程主要内容',
  `place` VARCHAR(100) DEFAULT NULL COMMENT '开课地点',
  `teacher_name` VARCHAR(40) DEFAULT NULL COMMENT '讲课老师',
  `cover_id` BIGINT DEFAULT NULL COMMENT '封面图片',
  `enroll_range` TEXT DEFAULT 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 second_course_time;   
CREATE TABLE `second_course_time` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `second_course_id` BIGINT DEFAULT NULL COMMENT '第二课堂id',
  `class_time` VARCHAR(50) DEFAULT NULL COMMENT '上课日期',
  `time_period` INT DEFAULT NULL COMMENT '时段（1=上午 2=下午 3=晚上）',
  `start_time` TIME DEFAULT NULL COMMENT '开始时间',
  `end_time` TIME DEFAULT NULL COMMENT '结束时间',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='第二课堂开课时间';

-- --------------------------------------------------------------------------------------------
-- 第二课堂参与范围
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS second_course_enroll_range;   
CREATE TABLE `second_course_enroll_range` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `second_course_id` BIGINT DEFAULT NULL COMMENT '第二课堂id',
  `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
  `dept_id` BIGINT DEFAULT NULL COMMENT '部门id',
  `user_id` BIGINT DEFAULT NULL COMMENT '用户id',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='第二课堂参与范围';


-- --------------------------------------------------------------------------------------------
-- 第二课堂报名表
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS second_course_enroll;   
CREATE TABLE `second_course_enroll` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  `second_course_id` BIGINT DEFAULT NULL COMMENT '第二课堂id',
  `user_id` BIGINT DEFAULT NULL COMMENT '用户id',
  `status` BIGINT DEFAULT NULL COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='第二课堂报名表';

ALTER TABLE `activity_enroll`   
  ADD INDEX (`user_id`);
ALTER TABLE `activity_enroll`   
  ADD INDEX (`activity_info_id`);
  
ALTER TABLE `second_course_enroll`   
  ADD INDEX (`user_id`);
ALTER TABLE `second_course_enroll`   
  ADD INDEX (`second_course_id`);
  
ALTER TABLE `base_teacher`   
  ADD INDEX (`user_id`);
ALTER TABLE `base_student`   
  ADD INDEX (`user_id`);

DROP TABLE IF EXISTS wf_repair_declaration;   
CREATE TABLE `wf_repair_declaration` (
  `id` BIGINT NOT NULL,
  `user_id` BIGINT DEFAULT NULL COMMENT '申请人',
  `application_time` DATETIME DEFAULT NULL COMMENT '申请时间',
  `department` BIGINT DEFAULT NULL COMMENT '所在部门',
  `department_leader` BIGINT DEFAULT NULL COMMENT '部门领导',
  `telephone` VARCHAR(500) DEFAULT NULL COMMENT '联系电话',
  `repair_location` VARCHAR(500) DEFAULT NULL COMMENT '维修地点',
  `maintenance_description` VARCHAR(700) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '维修情况说明',
  `upkeep_classify` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '维修分类',
  `is_artificial` VARCHAR(50) DEFAULT NULL COMMENT '是否人为损坏',
  `is_cash` VARCHAR(50) DEFAULT NULL COMMENT '是否现金赔偿',
  `indemnity` VARCHAR(50) DEFAULT NULL COMMENT '赔偿金额',
  `maintenance_feedback` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '维修反馈',
  `annex` BIGINT DEFAULT NULL COMMENT '附件',
  `qr_code` BIGINT DEFAULT NULL COMMENT '二维码',
  `status` INT DEFAULT NULL COMMENT '流程状态',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='维修申报流程';

-- --------------------------------------------------------------------------------------------
-- 流程提醒记录表
-- --------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS xjr_workflow_alert_record;   
CREATE TABLE `xjr_workflow_alert_record` (
  `id` BIGINT NOT NULL,
  `send_time` DATETIME DEFAULT NULL COMMENT '提醒时间',
  `user_id` BIGINT DEFAULT NULL COMMENT '被提醒人id',
  `process_name` VARCHAR(200) DEFAULT NULL COMMENT '流程名称',
  `process_id` BIGINT DEFAULT NULL COMMENT '进程id',
  `type` INT DEFAULT NULL COMMENT '提醒类别(1:超时提醒...)',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='流程提醒记录表';