-- =============================================
-- 项目人员表扩展测试数据
-- 使用多个真实用户ID和项目ID，使用UUID()生成member_id
-- @author AI Assistant
-- @date 2025/01/27
-- =============================================

-- 清空现有数据（可选）
-- DELETE FROM project_member WHERE project_id IN ('0b71a1259c49918c6595c9720ad1db5d', '7f321271c13483aa31cb743d604603a5', '8e0da59bd0c640b5b65dccd72606ea39', '96e0debf78187300f144d7f3450a2477', 'bbd28ed8627d6bd9fd8fa7476af6242a', 'd446d998d7c40005bf9af53ac264ef6e', 'd6c5b8408a42a8390297751756ecff23', 'eb64015cf2d0b40574c1d6f476876822', 'fb7e3b731ee496cec46ca1db64117676');

-- 插入项目人员测试数据
INSERT INTO project_member (
    member_id,
    project_id, 
    user_id, 
    role_type, 
    job_code, 
    job_desc, 
    join_date, 
    status, 
    remark
) VALUES
-- 项目1: 0b71a1259c49918c6595c9720ad1db5d
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '0ab4a72af4184a1614d4c25a5bb65ece', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-15', 'ACTIVE', '项目总负责人'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '0bc98a66761915e31fbf86e468d6ba20', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-15', 'ACTIVE', '负责项目安全管理'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '149c94f937a7d36cda70a81f343d090a', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-15', 'ACTIVE', '负责项目质量管理'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '15129b4764ced7900ef5d51c20cefa35', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-15', 'ACTIVE', '负责现场施工管理'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '1632433c2073532a074b0079cca5eb18', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-15', 'ACTIVE', '负责地面施工工作'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '1995a0da943d188506548bd42a2ee39d', 'CONSTRUCTOR', 'DRIVER', '司机', '2025-01-15', 'ACTIVE', '负责设备运输和人员接送'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '1b2641edb4c9a8f14658edaa8e6a36e3', 'CONSTRUCTOR', 'ASCENDING', '登高人员', '2025-01-15', 'ACTIVE', '负责高空作业'),
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '1d476bc4de6d71f6a43497d943adec9c', 'CONSTRUCTOR', 'ANTI_THUNDER', '防雷人员', '2025-01-15', 'ACTIVE', '负责防雷设施安装'),

-- 项目2: 7f321271c13483aa31cb743d604603a5
(UUID(), '7f321271c13483aa31cb743d604603a5', '1dae46a6ecbc2408c8b137187fc13d06', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-16', 'ACTIVE', '项目总负责人'),
(UUID(), '7f321271c13483aa31cb743d604603a5', '1f319a6f25b65ebd50711707e5e08d1a', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-16', 'ACTIVE', '负责项目安全管理'),
(UUID(), '7f321271c13483aa31cb743d604603a5', '22ff9d065f3ad826f5e22ba18a20248c', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-16', 'ACTIVE', '负责项目质量管理'),
(UUID(), '7f321271c13483aa31cb743d604603a5', '2fd0581e10f4c4f70e5148de3d61bc06', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-16', 'ACTIVE', '负责现场施工管理'),
(UUID(), '7f321271c13483aa31cb743d604603a5', '3042cb085eb41721faa8f4d985921424', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-16', 'ACTIVE', '负责地面施工工作'),
(UUID(), '7f321271c13483aa31cb743d604603a5', '3169163eb58fff961955179fbdc22507', 'CONSTRUCTOR', 'DRIVER', '司机', '2025-01-16', 'ACTIVE', '负责设备运输和人员接送'),

-- 项目3: 8e0da59bd0c640b5b65dccd72606ea39
(UUID(), '8e0da59bd0c640b5b65dccd72606ea39', '324afaf4e89213b6f5fcf1fa57663940', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-17', 'ACTIVE', '项目总负责人'),
(UUID(), '8e0da59bd0c640b5b65dccd72606ea39', '375f87a103e5bcad6e6a402177044891', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-17', 'ACTIVE', '负责项目安全管理'),
(UUID(), '8e0da59bd0c640b5b65dccd72606ea39', '3b5f2db9bac776be536d893f726deeba', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-17', 'ACTIVE', '负责项目质量管理'),
(UUID(), '8e0da59bd0c640b5b65dccd72606ea39', '44d335410542c5fd4989780dd11dca66', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-17', 'ACTIVE', '负责现场施工管理'),
(UUID(), '8e0da59bd0c640b5b65dccd72606ea39', '4e171ce81c18183bc8f06da8bd47a3d8', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-17', 'ACTIVE', '负责地面施工工作'),

-- 项目4: 96e0debf78187300f144d7f3450a2477
(UUID(), '96e0debf78187300f144d7f3450a2477', '0ab4a72af4184a1614d4c25a5bb65ece', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-18', 'ACTIVE', '项目总负责人'),
(UUID(), '96e0debf78187300f144d7f3450a2477', '0bc98a66761915e31fbf86e468d6ba20', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-18', 'ACTIVE', '负责项目安全管理'),
(UUID(), '96e0debf78187300f144d7f3450a2477', '149c94f937a7d36cda70a81f343d090a', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-18', 'ACTIVE', '负责项目质量管理'),
(UUID(), '96e0debf78187300f144d7f3450a2477', '15129b4764ced7900ef5d51c20cefa35', 'CONSTRUCTOR', 'ASCENDING', '登高人员', '2025-01-18', 'ACTIVE', '负责高空作业'),
(UUID(), '96e0debf78187300f144d7f3450a2477', '1632433c2073532a074b0079cca5eb18', 'CONSTRUCTOR', 'ANTI_THUNDER', '防雷人员', '2025-01-18', 'ACTIVE', '负责防雷设施安装'),

-- 项目5: bbd28ed8627d6bd9fd8fa7476af6242a
(UUID(), 'bbd28ed8627d6bd9fd8fa7476af6242a', '1995a0da943d188506548bd42a2ee39d', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-19', 'ACTIVE', '项目总负责人'),
(UUID(), 'bbd28ed8627d6bd9fd8fa7476af6242a', '1b2641edb4c9a8f14658edaa8e6a36e3', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-19', 'ACTIVE', '负责项目安全管理'),
(UUID(), 'bbd28ed8627d6bd9fd8fa7476af6242a', '1d476bc4de6d71f6a43497d943adec9c', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-19', 'ACTIVE', '负责项目质量管理'),
(UUID(), 'bbd28ed8627d6bd9fd8fa7476af6242a', '1dae46a6ecbc2408c8b137187fc13d06', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-19', 'ACTIVE', '负责现场施工管理'),
(UUID(), 'bbd28ed8627d6bd9fd8fa7476af6242a', '1f319a6f25b65ebd50711707e5e08d1a', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-19', 'ACTIVE', '负责地面施工工作'),

-- 项目6: d446d998d7c40005bf9af53ac264ef6e
(UUID(), 'd446d998d7c40005bf9af53ac264ef6e', '22ff9d065f3ad826f5e22ba18a20248c', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-20', 'ACTIVE', '项目总负责人'),
(UUID(), 'd446d998d7c40005bf9af53ac264ef6e', '2fd0581e10f4c4f70e5148de3d61bc06', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-20', 'ACTIVE', '负责项目安全管理'),
(UUID(), 'd446d998d7c40005bf9af53ac264ef6e', '3042cb085eb41721faa8f4d985921424', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-20', 'ACTIVE', '负责项目质量管理'),
(UUID(), 'd446d998d7c40005bf9af53ac264ef6e', '3169163eb58fff961955179fbdc22507', 'CONSTRUCTOR', 'DRIVER', '司机', '2025-01-20', 'ACTIVE', '负责设备运输和人员接送'),

-- 项目7: d6c5b8408a42a8390297751756ecff23
(UUID(), 'd6c5b8408a42a8390297751756ecff23', '324afaf4e89213b6f5fcf1fa57663940', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-21', 'ACTIVE', '项目总负责人'),
(UUID(), 'd6c5b8408a42a8390297751756ecff23', '375f87a103e5bcad6e6a402177044891', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-21', 'ACTIVE', '负责项目安全管理'),
(UUID(), 'd6c5b8408a42a8390297751756ecff23', '3b5f2db9bac776be536d893f726deeba', 'CONSTRUCTOR', 'ASCENDING', '登高人员', '2025-01-21', 'ACTIVE', '负责高空作业'),
(UUID(), 'd6c5b8408a42a8390297751756ecff23', '44d335410542c5fd4989780dd11dca66', 'CONSTRUCTOR', 'ANTI_THUNDER', '防雷人员', '2025-01-21', 'ACTIVE', '负责防雷设施安装'),

-- 项目8: eb64015cf2d0b40574c1d6f476876822
(UUID(), 'eb64015cf2d0b40574c1d6f476876822', '4e171ce81c18183bc8f06da8bd47a3d8', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-22', 'ACTIVE', '项目总负责人'),
(UUID(), 'eb64015cf2d0b40574c1d6f476876822', '0ab4a72af4184a1614d4c25a5bb65ece', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-22', 'ACTIVE', '负责项目安全管理'),
(UUID(), 'eb64015cf2d0b40574c1d6f476876822', '0bc98a66761915e31fbf86e468d6ba20', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-22', 'ACTIVE', '负责项目质量管理'),
(UUID(), 'eb64015cf2d0b40574c1d6f476876822', '149c94f937a7d36cda70a81f343d090a', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-22', 'ACTIVE', '负责现场施工管理'),

-- 项目9: fb7e3b731ee496cec46ca1db64117676
(UUID(), 'fb7e3b731ee496cec46ca1db64117676', '15129b4764ced7900ef5d51c20cefa35', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-23', 'ACTIVE', '项目总负责人'),
(UUID(), 'fb7e3b731ee496cec46ca1db64117676', '1632433c2073532a074b0079cca5eb18', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-23', 'ACTIVE', '负责项目安全管理'),
(UUID(), 'fb7e3b731ee496cec46ca1db64117676', '1995a0da943d188506548bd42a2ee39d', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-23', 'ACTIVE', '负责项目质量管理'),
(UUID(), 'fb7e3b731ee496cec46ca1db64117676', '1b2641edb4c9a8f14658edaa8e6a36e3', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-23', 'ACTIVE', '负责地面施工工作'),
(UUID(), 'fb7e3b731ee496cec46ca1db64117676', '1d476bc4de6d71f6a43497d943adec9c', 'CONSTRUCTOR', 'DRIVER', '司机', '2025-01-23', 'ACTIVE', '负责设备运输和人员接送');

-- =============================================
-- 查询示例
-- =============================================

-- 查询所有项目的在职人员
-- SELECT * FROM project_member WHERE status = 'ACTIVE';

-- 查询特定项目的所有人员
-- SELECT * FROM project_member WHERE project_id = '0b71a1259c49918c6595c9720ad1db5d' AND status = 'ACTIVE';

-- 查询所有项目经理
-- SELECT * FROM project_member WHERE role_type = 'PROJECT_MANAGER' AND status = 'ACTIVE';

-- 按项目统计人员数量
-- SELECT project_id, COUNT(*) as member_count FROM project_member WHERE status = 'ACTIVE' GROUP BY project_id;

-- 按角色类型统计人员数量
-- SELECT role_type, COUNT(*) as count FROM project_member WHERE status = 'ACTIVE' GROUP BY role_type;

-- 查询特定用户参与的所有项目
-- SELECT DISTINCT project_id FROM project_member WHERE user_id = '0ab4a72af4184a1614d4c25a5bb65ece' AND status = 'ACTIVE'; 