USE sop_db;

-- 2024-09-18
UPDATE sys_privilege
SET name='数据驾驶舱', url='dataCockpit', `type`='MENU', parent_id=NULL, `sequence`=11, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1100;
UPDATE sys_privilege
SET name='智能客服', url='aiCustomerManage', `type`='MENU', parent_id=NULL, `sequence`=12, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=2053;
UPDATE sys_privilege
SET name='流程检查统计', url='FlowCheck', `type`='MENU', parent_id=1100, `sequence`=3, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1101;
UPDATE sys_privilege
SET name='服务单元分析', url='serviceAnalyse', `type`='MENU', parent_id=1100, `sequence`=1, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1102;
UPDATE sys_privilege
SET name='SOP预警监控', url='sopAnalyse', `type`='MENU', parent_id=1100, `sequence`=4, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1103;
UPDATE sys_privilege
SET name='项目进度分析', url='sopSchedule', `type`='MENU', parent_id=1100, `sequence`=2, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1104;
UPDATE sys_privilege
SET name='资源保障分析', url='deviceMonitor', `type`='MENU', parent_id=1100, `sequence`=5, property=NULL, related='1107,1108,1109,1110', enable=1, default_auth=0, front_display=1
WHERE id=1105;
UPDATE sys_privilege
SET name='质量监控分析', url='qualityAnalyse', `type`='MENU', parent_id=1100, `sequence`=6, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
WHERE id=1106;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1107, '设备商供货数量分布接口', '/api/admin/resource/security/device_supplier_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1108, '人力数量分布接口', '/api/admin/resource/security/human_supplier_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1109, '大区考勤异常数统计接口', '/api/admin/resource/security/area_ding_exception_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1110, '人力供应商考勤异常数统计', '/api/admin/resource/security/human_ding_exception_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);

-- 2024-09-20
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1111, '大区经理查阅统计', '/api/admin/flow/msg/refer/area_manager/report', 'URL', 1101, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1112, '区域协调人查阅统计', '/api/admin/flow/msg/refer/regional_coordinator/report', 'URL', 1101, 1, 'AUTH', NULL, 1, 1, 1);
UPDATE sys_privilege
SET name='流程检查统计', url='FlowCheck', `type`='MENU', parent_id=1100, `sequence`=3, property=NULL, related='1111,1112', enable=1, default_auth=0, front_display=1
WHERE id=1101;

UPDATE sys_privilege
SET name='设备商供货数量分布接口', url='/api/admin/resource/security/device_supplier/report', `type`='URL', parent_id=1105, `sequence`=1, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=1
WHERE id=1107;
UPDATE sys_privilege
SET name='人力数量分布接口', url='/api/admin/resource/security/human_supplier/report', `type`='URL', parent_id=1105, `sequence`=1, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=1
WHERE id=1108;
UPDATE sys_privilege
SET name='大区考勤异常数统计接口', url='/api/admin/resource/security/area_ding_exception/report', `type`='URL', parent_id=1105, `sequence`=1, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=1
WHERE id=1109;
UPDATE sys_privilege
SET name='人力供应商考勤异常数统计', url='/api/admin/resource/security/human_ding_exception/report', `type`='URL', parent_id=1105, `sequence`=1, property='AUTH', related=NULL, enable=1, default_auth=1, front_display=1
WHERE id=1110;

DELETE FROM sys_privilege
WHERE id=1073;
DELETE FROM sys_privilege
WHERE id=1074;
DELETE FROM sys_privilege
WHERE id=1075;
DELETE FROM sys_privilege
WHERE id=1076;
DELETE FROM sys_privilege
WHERE id=1077;
DELETE FROM sys_privilege
WHERE id=1078;
DELETE FROM sys_privilege
WHERE id=1079;
DELETE FROM sys_privilege
WHERE id=1080;
DELETE FROM sys_privilege
WHERE id=1081;
DELETE FROM sys_privilege
WHERE id=1082;
DELETE FROM sys_privilege
WHERE id=1083;
DELETE FROM sys_privilege
WHERE id=1084;
DELETE FROM sys_privilege
WHERE id=1085;
DELETE FROM sys_privilege
WHERE id=1086;
DELETE FROM sys_privilege
WHERE id=1087;
DELETE FROM sys_privilege
WHERE id=1088;
DELETE FROM sys_privilege
WHERE id=1089;
DELETE FROM sys_privilege
WHERE id=1090;
DELETE FROM sys_privilege
WHERE id=1091;
DELETE FROM sys_privilege
WHERE id=1092;
DELETE FROM sys_privilege
WHERE id=1093;

-- 2024-09-24
UPDATE sys_privilege
SET name='质量监控分析', url='qualityAnalyse', `type`='MENU', parent_id=1100, `sequence`=6, property=NULL, related='1113,1114,1115,1116,1117', enable=1, default_auth=0, front_display=1
WHERE id=1106;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1113, '大区质量问题统计', '/api/admin/quality/analyse/area_manager/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1114, '人力商质量问题统计', '/api/admin/quality/analyse/human_supplier/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1115, '质量问题原因分类', '/api/admin/quality/analyse/type/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1116, '报表详情', '/api/admin/quality/analyse/report/view', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(1117, '报表详情导出', '/api/admin/quality/analyse/report/view/export', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);

-- 2024-09-20
-- 删除以前的关联
delete from sys_privilege where id in (1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072) and parent_id=1102;
delete from sys_privilege where id in (1094,1095,1097) and parent_id=1104;
delete from sys_privilege where id in (1057,1058,1059,1060,1061) and parent_id=1103;

-- 服务单元、项目进度监控、sop预警报表脚本
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1140, '查询条件', 'Condition', 'CONDITION', 1102, 1, 'AUTH', '1146,1147,1148', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1141, '查询', 'Select', 'BUTTON', 1102, 1, 'AUTH', '1146,1147,1148', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1142, '列表', 'List', 'LIST', 1102, 1, 'AUTH', '1146,1147,1148', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1143, '详情', 'Detail', 'LINK', 1102, 1, 'AUTH', '1149,1150', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1146, '服务单元概况接口', '/api/admin/service/analyse/overview', 'URL', 1102, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1147, '项目整体进度接口', '/api/admin/service/analyse/progress', 'URL', 1102, 2, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1148, '区域概况接口', '/api/admin/service/analyse/province', 'URL', 1102, 3, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1149, '详情接口', '/api/admin/service/analyse/detail', 'URL', 1102, 4, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1150, '导出接口', '/api/admin/service/analyse/detail/export', 'URL', 1102, 5, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1151, '查询条件', 'Condition', 'CONDITION', 1104, 1, 'AUTH', '1155,1156,1157', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1152, '查询', 'Select', 'BUTTON', 1104, 1, 'AUTH', '1155,1156,1157', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1153, '列表', 'List', 'LIST', 1104, 1, 'AUTH', '1155,1156,1157', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1154, '详情', 'Detail', 'LINK', 1104, 1, 'AUTH', '1149,1150', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1155, '按大区进度统计接口', '/api/admin/crm/process/monitor/region', 'URL', 1104, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1156, '按人力商进度统计接口', '/api/admin/crm/process/monitor/supplier', 'URL', 1104, 2, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1157, '按区域协调人进度统计接口', '/api/admin/crm/process/monitor/coordinator', 'URL', 1104, 3, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1160, '查询条件', 'Condition', 'CONDITION', 1103, 1, 'AUTH', '1164,1165,1166', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1161, '查询', 'Select', 'BUTTON', 1103, 1, 'AUTH', '1164,1165,1166', 1, 0, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1162, '列表', 'List', 'LIST', 1103, 1, 'AUTH', '1164,1165,1166', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1163, '详情', 'Detail', 'LINK', 1103, 1, 'AUTH', '1149,1150', 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1164, '按大区预警统计接口', '/api/admin/sop/warn/monitor/region', 'URL', 1103, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1165, '按人力商预警统计接口', '/api/admin/sop/warn/monitor/supplier', 'URL', 1103, 2, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1166, '按区域协调人预警统计接口', '/api/admin/sop/warn/monitor/coordinator', 'URL', 1103, 3, 'AUTH', NULL, 1, 1, 1);

-- 2024-10-08
UPDATE sys_privilege
SET name='服务单元分析', url='serviceAnalyse', `type`='MENU', parent_id=1100, `sequence`=1, property=NULL, related='1146,1147,1148,1149,1150', enable=1, default_auth=0, front_display=1
WHERE id=1102;

UPDATE sys_privilege
SET name='项目进度分析', url='sopSchedule', `type`='MENU', parent_id=1100, `sequence`=2, property=NULL, related='1155,1156,1157,1149,1150', enable=1, default_auth=0, front_display=1
WHERE id=1104;

UPDATE sys_privilege
SET name='SOP预警监控', url='sopAnalyse', `type`='MENU', parent_id=1100, `sequence`=4, property=NULL, related='1164,1165,1166,1149,1150', enable=1, default_auth=0, front_display=1
WHERE id=1103;

DELETE FROM sys_privilege
WHERE id=1140;
DELETE FROM sys_privilege
WHERE id=1141;
DELETE FROM sys_privilege
WHERE id=1142;
DELETE FROM sys_privilege
WHERE id=1143;

DELETE FROM sys_privilege
WHERE id=1151;
DELETE FROM sys_privilege
WHERE id=1152;
DELETE FROM sys_privilege
WHERE id=1153;
DELETE FROM sys_privilege
WHERE id=1154;

DELETE FROM sys_privilege
WHERE id=1160;
DELETE FROM sys_privilege
WHERE id=1161;
DELETE FROM sys_privilege
WHERE id=1162;
DELETE FROM sys_privilege
WHERE id=1163;