--2024-05-13update
ALTER TABLE t_d_form_widget MODIFY COLUMN role_type varchar(500) NULL COMMENT '角色类型';

--2024-05-14update
DROP TABLE IF EXISTS `t_b_crm_detail`;
CREATE TABLE t_b_crm_detail
(
    id BIGINT
        COMMENT '主键' NOT NULL,
    crm_no VARCHAR(100)
        COMMENT '派单号' NOT NULL,
    flow_deployment_id VARCHAR(50)
        COMMENT '流程部署id' NOT NULL,
    sop_no VARCHAR(100)
        COMMENT 'sop单号' NULL,
    status VARCHAR(20)
        COMMENT '状态，UN_PUBLISH：未发布，PUBLISH：发布' NOT NULL,
    course_name VARCHAR(255)
        COMMENT '科目名称' NOT NULL,
    exam_student_count INTEGER
        COMMENT '考生人数' NOT NULL,
    contacts VARCHAR(100)
        COMMENT '联系人' NULL,
    mobile_number VARCHAR(30)
        COMMENT '电话' NULL,
    service_scope VARCHAR(30)
        COMMENT '服务范围，SCAN：仅扫描，SCAN_MARK：扫描+阅卷' NOT NULL,
    scan_start_time BIGINT
        COMMENT '扫描开始时间' NOT NULL,
    scan_end_time BIGINT
        COMMENT '扫描结束时间' NOT NULL,
    mark_paper_start_time BIGINT
        COMMENT '阅卷开始时间' NOT NULL,
    mark_paper_end_time BIGINT
        COMMENT '阅卷结束时间' NOT NULL,
    create_id BIGINT
        COMMENT '创建人id' NULL,
    create_time BIGINT
        COMMENT '创建时间' NULL,
    update_id BIGINT
        COMMENT '更新人id' NULL,
    update_time BIGINT
        COMMENT '更新时间' NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `t_b_crm_detail_unique` (`crm_no`,`course_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='派单明细';

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3080, '导入派单明细', '/api/admin/tb/crm/detail/sop/import', 'URL', 3079, 1, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3081, '获取派单信息', '/api/admin/tb/crm/detail/sop/var/info', 'URL', 3079, 2, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3082, '派单明细sop变量保存', '/api/admin/tb/crm/detail/sop/var/save', 'URL', 3079, 3, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3083, '获取派单明细sop信息', '/api/admin/tb/crm/detail/sop/info', 'URL', 3079, 4, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3084, '创建/编辑派单明细sop', '/api/admin/tb/crm/detail/sop/save', 'URL', 3079, 5, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3085, '派单明细sop发布', '/api/admin/tb/crm/detail/sop/publish', 'URL', 3079, 6, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3086, '派单明细sop删除', '/api/admin/tb/crm/detail/sop/delete', 'URL', 3079, 7, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3087, '编辑派单明细sop', '/api/admin/tb/crm/detail/sop/edit', 'URL', 3079, 8, 'AUTH', NULL, 1, 1, 0);

-- 2024-05-15
ALTER TABLE t_b_crm ADD process_var MEDIUMTEXT
    COMMENT '过程变量' NULL after publish_time;

-- 2024-05-16
DROP TABLE IF EXISTS `t_b_engineer_allocation`;

-- 2024-05-18
UPDATE sys_privilege
SET name='sop填报接口', url='/api/admin/sop/approve', `type`='URL', parent_id=40, `sequence`=7, property='SYS', related=NULL, enable=1, default_auth=1, front_display=0
WHERE id=3042;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3088, 'sop人员配置', '/api/admin/sop/allocation', 'URL', 40, 13, 'AUTH', NULL, 1, 1, 0);

-- 2024-05-20
UPDATE sys_privilege
SET name='sop删除', url='/api/admin/sop/cancel', `type`='URL', parent_id=40, `sequence`=9, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=0
WHERE id=3045;
UPDATE sys_privilege
SET name='sop批量删除', url='/api/admin/sop/batch/cancel', `type`='URL', parent_id=40, `sequence`=10, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=0
WHERE id=3046;

-- 2024-05-21
DELETE FROM sys_privilege
WHERE id=177;

UPDATE sys_privilege
SET name='填报', url='Fill', `type`='LINK', parent_id=41, `sequence`=2, property='AUTH', related='3042', enable=1, default_auth=0, front_display=1
WHERE id=175;
UPDATE sys_privilege
SET name='计划变更报备', url='ProjectExchange', `type`='LINK', parent_id=41, `sequence`=3, property='AUTH', related='3025', enable=1, default_auth=0, front_display=1
WHERE id=176;
UPDATE sys_privilege
SET name='新增违规 ', url='AddViolation', `type`='LINK', parent_id=41, `sequence`=4, property='AUTH', related='1025', enable=1, default_auth=0, front_display=1
WHERE id=178;
UPDATE sys_privilege
SET name='上报质量问题', url='ProblemSubmit', `type`='LINK', parent_id=41, `sequence`=5, property='AUTH', related='1031', enable=1, default_auth=0, front_display=1
WHERE id=179;
UPDATE sys_privilege
SET name='编辑', url='Edit', `type`='LINK', parent_id=41, `sequence`=6, property='AUTH', related='3047,3048', enable=1, default_auth=0, front_display=1
WHERE id=3037;
UPDATE sys_privilege
SET name='删除', url='Cancel', `type`='LINK', parent_id=41, `sequence`=7, property='AUTH', related='3045', enable=1, default_auth=0, front_display=1
WHERE id=3038;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3089, '人员配置', 'Allocation', 'LINK', 41, 1, 'AUTH', '3045', 1, 0, 1);

UPDATE sys_privilege
SET name='填报', url='Fill', `type`='LINK', parent_id=42, `sequence`=2, property='AUTH', related='3042', enable=1, default_auth=0, front_display=1
WHERE id=184;
UPDATE sys_privilege
SET name='计划变更报备', url='ProjectExchange', `type`='LINK', parent_id=42, `sequence`=3, property='AUTH', related='3025', enable=1, default_auth=0, front_display=1
WHERE id=185;
UPDATE sys_privilege
SET name='新增违规 ', url='AddViolation', `type`='LINK', parent_id=42, `sequence`=4, property='AUTH', related='1025', enable=1, default_auth=0, front_display=1
WHERE id=186;
UPDATE sys_privilege
SET name='上报质量问题', url='ProblemSubmit', `type`='LINK', parent_id=42, `sequence`=5, property='AUTH', related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=187;
UPDATE sys_privilege
SET name='编辑', url='Edit', `type`='LINK', parent_id=42, `sequence`=6, property='AUTH', related='3047,3048', enable=1, default_auth=0, front_display=1
WHERE id=3039;
UPDATE sys_privilege
SET name='删除', url='Cancel', `type`='LINK', parent_id=42, `sequence`=7, property='AUTH', related='3088', enable=1, default_auth=0, front_display=1
WHERE id=3040;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3090, '人员配置', 'Allocation', 'LINK', 42, 1, 'AUTH', '3088', 1, 0, 1);

UPDATE sys_privilege
SET name='创建sop', url='CreateSop', `type`='LINK', parent_id=51, `sequence`=4, property='AUTH', related='3080,3081,3082,3083,3084,3085,3086,3087', enable=1, default_auth=0, front_display=1
WHERE id=3079;

DROP TABLE IF EXISTS `t_b_sop_quick_search`;
CREATE TABLE `t_b_sop_quick_search` (
                                        `id` bigint NOT NULL COMMENT '主键',
                                        `type` varchar(20) NOT NULL COMMENT '流程类型，OFFICE_SOP_FLOW：教务处SOP，CLOUD_MARK_SOP_FLOW：研究生SOP，DING_EXCEPTION_FLOW：考勤异常审核流程，PROJECT_EXCHANGE_FLOW：项目计划变更流程，QUALITY_PROBLEM_FLOW：质量问题反馈流程',
                                        `flow_deployment_id` varchar(50) NOT NULL COMMENT '流程部署id',
                                        `version` int NOT NULL COMMENT '版本号',
                                        `user_id` bigint NOT NULL COMMENT '用户id',
                                        `name` varchar(100) NOT NULL COMMENT '内容名称',
                                        `content` mediumtext NOT NULL COMMENT '内容',
                                        `content_type` varchar(20) NOT NULL COMMENT '内容类型，VIEW：显示列表，SEARCH：快捷搜索',
                                        PRIMARY KEY (`id`),
                                        UNIQUE KEY `t_b_sop_quick_search_unique` (`type`,`name`,`content_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='sop快捷搜索表';

INSERT INTO sys_config
(id, org_id, config_key, config_name, config_value, remark, enable, sort, create_id, create_time, update_id, update_time)
VALUES(40, NULL, 'sop.quick.count', 'sop快捷条数', '10', NULL, 1, 1, 1, NULL, NULL, NULL);

-- 2024-05-22
UPDATE sys_privilege
SET name='教务处SOP管理', url='office', `type`='MENU', parent_id=40, `sequence`=1, property=NULL, related='3034,3035,3091,3092,3093', enable=1, default_auth=0, front_display=1
WHERE id=41;
UPDATE sys_privilege
SET name='研究生SOP管理', url='cloudMark', `type`='MENU', parent_id=40, `sequence`=2, property=NULL, related='3034,3035,3091,3092,3093', enable=1, default_auth=0, front_display=1
WHERE id=42;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3091, 'sop快捷搜索保存', '/api/admin/sop/quick/save', 'URL', 40, 14, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3092, 'sop快捷搜索列表', '/api/admin/sop/quick/list', 'URL', 40, 15, 'AUTH', NULL, 1, 1, 0);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(3093, 'sop快捷搜索删除', '/api/admin/sop/quick/delete', 'URL', 40, 16, 'AUTH', NULL, 1, 1, 0);