-- ============================================================
-- 物业人员管理 - c_service 和 c_route 配置
-- 给 PC Web端 (AppId=8000418004) 授权访问 property.* 接口
-- ============================================================

-- 1. 插入 10 个接口到 c_service
INSERT INTO c_service (service_id, service_code, business_type_cd, name, seq, messageQueueName, is_instance, url, method, timeout, retry_count, provide_app_id, create_time, status_cd)
VALUES
('SVCPROPLOC', 'property.queryLocationTracks',    'API', '轨迹查询', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPATT', 'property.queryAttendanceRecords', 'API', '打卡记录', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPPAT', 'property.queryPatrolRecords',     'API', '巡更记录', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPCLN', 'property.queryCleaningRecords',   'API', '作业记录', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPREP', 'property.queryRepairOrders',      'API', '工单列表', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPUSR', 'property.queryUsers',             'API', '人员列表', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPMSG', 'property.queryMessages',          'API', '消息通知', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPRED', 'property.readMessage',            'API', '标记已读', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPSUB', 'property.submitRepairOrder',      'API', '提交工单', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0'),
('SVCPROPUPD', 'property.updateRepairStatus',     'API', '更新工单', 1, null, 'CMD', 'http://user-service', 'POST', 60, 3, '8000418002', NOW(), '0');

-- 2. c_route 授权 PC Web端 (8000418004) 访问新接口
INSERT INTO c_route (app_id, service_id, invoke_model, order_type_cd, invoke_limit_times, status_cd)
SELECT '8000418004', service_id, 'S', 'Q', -1, '0'
FROM c_service WHERE service_id IN ('SVCPROPLOC','SVCPROPATT','SVCPROPPAT','SVCPROPCLN','SVCPROPREP','SVCPROPUSR','SVCPROPMSG','SVCPROPRED','SVCPROPSUB','SVCPROPUPD');
