-- ---------------------------------------------------------------------------------
-- 课时统计
-- ---------------------------------------------------------------------------------
DROP TABLE IF EXISTS class_time_statistics;
CREATE TABLE `class_time_statistics` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `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 NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `year` INT DEFAULT NULL COMMENT '统计年份',
  `month` INT DEFAULT NULL COMMENT '统计月份',
  `start_date` DATE DEFAULT NULL COMMENT '开始日期',
  `end_date` DATE DEFAULT NULL COMMENT '结束日期',
  `all_class_time` DOUBLE(8,1) DEFAULT NULL COMMENT '总课时',
  `total_amount` DOUBLE(8,2) DEFAULT NULL COMMENT '总金额',
  `class_time_amount` DOUBLE(8,2)  DEFAULT NULL COMMENT '总课时费用',
  `beyond_class_time_amount` DOUBLE(8,2)  DEFAULT NULL COMMENT '总外聘教师超课时费',
  `status` INT DEFAULT 0 COMMENT '状态(0:数据统计中 1:统计完成 2:已解锁 3:已锁定)',
  `weight_set_json` LONGTEXT DEFAULT NULL COMMENT '权重json',
  `cost_set_json` LONGTEXT DEFAULT NULL COMMENT '权重json',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课时统计';


-- ---------------------------------------------------------------------------------
-- 课时统计-教师详情
-- ---------------------------------------------------------------------------------
DROP TABLE IF EXISTS class_time_statistics_record;
CREATE TABLE `class_time_statistics_record` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `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 NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `class_time_statistics_id` BIGINT DEFAULT NULL COMMENT '课时统计(class_time_statistics)',
  `user_id` BIGINT DEFAULT NULL COMMENT '教师id(xjr_user)',
  `employ_type` VARCHAR(20) DEFAULT NULL COMMENT '聘用类型',
  `all_class_time` DOUBLE(8,1) DEFAULT NULL COMMENT '总课时',
  `total_amount` DOUBLE(8,2) DEFAULT NULL COMMENT '总金额',
  `class_time_amount` DOUBLE(8,2)  DEFAULT NULL COMMENT '课时费用',
  `beyond_class_time_amount` DOUBLE(8,2)  DEFAULT NULL COMMENT '外聘教师超课时费',
  `week_data` LONGTEXT DEFAULT NULL COMMENT '每周数据',
  
  `class_time1` FLOAT(4,1) DEFAULT NULL COMMENT '教研会',
  `class_time2` FLOAT(4,1) DEFAULT NULL COMMENT '督导听课',
  `class_time3` FLOAT(4,1) DEFAULT NULL COMMENT '临近三年退休政策',
  `class_time4` FLOAT(4,1) DEFAULT NULL COMMENT '出题',
  `class_time5` FLOAT(4,1) DEFAULT NULL COMMENT '阅卷',
  `class_time6` FLOAT(4,1) DEFAULT NULL COMMENT '周末培优',
  `class_time7` FLOAT(4,1) DEFAULT NULL COMMENT '早自习',
  `class_time8` FLOAT(4,1) DEFAULT NULL COMMENT '正课(包含调顶课时)',
  `class_time9` FLOAT(4,1) DEFAULT NULL COMMENT '晚辅(包含调顶课时)',
  `class_time10` FLOAT(4,1) DEFAULT NULL COMMENT '顶课',
  `class_time11` FLOAT(4,1) DEFAULT NULL COMMENT '调课',

  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课时统计-教师详情';


-- ---------------------------------------------------------------------------------
-- 课时统计-设置
-- ---------------------------------------------------------------------------------
DROP TABLE IF EXISTS class_time_statistics_set;
CREATE TABLE `class_time_statistics_set` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `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 NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `json_content` TEXT DEFAULT NULL COMMENT '权重内容',
  `category` INT DEFAULT NULL COMMENT '类别(1:权重 2:费用设置)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课时统计-设置';


-- ---------------------------------------------------------------------------------
-- 课时删除
-- ---------------------------------------------------------------------------------
DROP TABLE IF EXISTS class_time_delete;
CREATE TABLE `class_time_delete` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `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 NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `type` VARCHAR(50) DEFAULT NULL COMMENT '删除类型(xjr_dictionary_item[class_time_delete])',
  `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
  `remark` VARCHAR(500) DEFAULT NULL COMMENT '删除说明',
  `start_date` DATE DEFAULT NULL COMMENT '开始日期',
  `end_date` DATE DEFAULT NULL COMMENT '结束日期',
  `status` INT DEFAULT 0 COMMENT '状态(0:生效 1:锁定 2:作废)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='课时删除';

-- ---------------------------------------------------------------------------------
-- 节假日调课设置
-- ---------------------------------------------------------------------------------
DROP TABLE IF EXISTS class_time_calendar;
CREATE TABLE `class_time_calendar` (
  `id` BIGINT NOT NULL COMMENT '主键编号',
  `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 NOT NULL COMMENT '删除标记',
  `enabled_mark` INT NOT NULL COMMENT '有效标志',
  `supplement_date` DATE DEFAULT NULL COMMENT '补班日期',
  `replace_date` DATE DEFAULT NULL COMMENT '补课日期',
  `status` INT DEFAULT 0 COMMENT '状态(0:生效 1:锁定 2:作废)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='节假日调课设置';


ALTER TABLE `base_student_assessment_inspection`   
  CHANGE `assessment_date` `assessment_date` DATE NULL   COMMENT '考核时间';

ALTER TABLE `base_student_assessment_inspection`   
  ADD COLUMN `total_score` DOUBLE NULL   COMMENT '扣除总分' AFTER `personal_student_user_ids`;

ALTER TABLE `base_student_assessment_student_relation`   
  ADD COLUMN `score` DOUBLE DEFAULT 0  NULL   COMMENT '被扣分数' AFTER `major_name`;


ALTER TABLE `class_time_statistics_record`   
  ADD COLUMN `all_class_time_data` LONGTEXT NULL   COMMENT '总课时数据' AFTER `class_time11`;


ALTER TABLE `wf_teacher_course_time`   
  ADD COLUMN `enabled_mark` INT DEFAULT 1  NULL   COMMENT '状态(0:作废 1:生效 2:锁定)' AFTER `teacher_ids`;

