-- -----------------------------------------------------------
-- 材料缴交任务类别调整
-- -----------------------------------------------------------
DROP PROCEDURE IF EXISTS createCom;
DELIMITER $$
CREATE
    PROCEDURE createCom()
BEGIN
    IF NOT EXISTS(SELECT 1 FROM information_schema.columns  WHERE table_name='material_type' AND COLUMN_NAME = 'material_category') THEN
ALTER TABLE `material_type`   
  ADD COLUMN `material_category` VARCHAR(50) NULL   COMMENT '任务类型(可多选 xjr_dictionary_detail[material_category])' AFTER `name`,
  ADD COLUMN `folder_id` BIGINT NULL   COMMENT '文件模板' AFTER `material_category`,
  ADD COLUMN `form_release_id` BIGINT NULL   COMMENT '表单发布(xjr_form_release)' AFTER `folder_id`;
    END IF;
END$$
DELIMITER ;
CALL createCom;
DROP PROCEDURE createCom;

-- -----------------------------------------------------------
-- 材料缴交任务
-- -----------------------------------------------------------
DROP PROCEDURE IF EXISTS createCom;
DELIMITER $$
CREATE
    PROCEDURE createCom()
BEGIN
    IF NOT EXISTS(SELECT 1 FROM information_schema.columns  WHERE table_name='material_task' AND COLUMN_NAME = 'material_category') THEN
ALTER TABLE `material_task`   
  ADD COLUMN `material_category` VARCHAR(50) NULL   COMMENT '任务类型(可多选 xjr_dictionary_detail[material_category])';

    END IF;
END$$
DELIMITER ;
CALL createCom;
DROP PROCEDURE createCom;


-- ------------------------------------------------
-- 攀宝学期对应
-- ------------------------------------------------
DROP TABLE IF EXISTS pb_semester_config;
CREATE TABLE `pb_semester_config` (
  `id` BIGINT NOT NULL,
  `create_user_id` BIGINT DEFAULT NULL,
  `create_date` DATETIME(3) DEFAULT NULL,
  `modify_user_id` BIGINT DEFAULT NULL,
  `modify_date` DATETIME(3) DEFAULT NULL,
  `delete_mark` INT DEFAULT NULL,
  `enabled_mark` INT DEFAULT NULL,
  `base_semester_id` BIGINT DEFAULT NULL COMMENT '学期',
  `beltcode` VARCHAR(30) DEFAULT NULL COMMENT '攀宝学期code',
  `beltname` VARCHAR(30) DEFAULT NULL COMMENT '攀宝学期名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='攀宝学期对应';


ALTER TABLE `pb_v_xsxxsfytb`   
  ADD INDEX (`Studentcode`),
  ADD INDEX (`qfje`);


