-- =============================================
-- 项目人员表测试数据
-- 基于项目ID: 0b71a1259c49918c6595c9720ad1db5d
-- 使用真实用户ID，使用UUID()生成member_id
-- @author AI Assistant
-- @date 2025/01/27
-- =============================================

-- 清空现有数据（可选）
-- DELETE FROM project_member WHERE project_id = '0b71a1259c49918c6595c9720ad1db5d';

-- 插入项目人员测试数据
INSERT INTO project_member (
    member_id,
    project_id, 
    user_id, 
    role_type, 
    job_code, 
    job_desc, 
    join_date, 
    status, 
    remark
) VALUES
-- 项目经理
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '008ecfac153be83890c42f9fed0a48cd', 'PROJECT_MANAGER', 'PROJECT_MANAGER', '项目经理', '2025-01-15', 'ACTIVE', '项目总负责人'),

-- 安全员
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '014d6fd83182ac03d05967e16748ab80', 'SAFETY_OFFICER', 'SAFETY_MANAGER', '安全经理', '2025-01-15', 'ACTIVE', '负责项目安全管理'),

-- 质量员
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '0465342288d0637398b64ca73da76090', 'QUALITY_OFFICER', 'QUALITY_MANAGER', '质量经理', '2025-01-15', 'ACTIVE', '负责项目质量管理'),

-- 施工组长
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '008ecfac153be83890c42f9fed0a48cd', 'TEAM_LEADER', 'SITE_MANAGER', '现场经理', '2025-01-15', 'ACTIVE', '负责现场施工管理'),

-- 地勤人员
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '014d6fd83182ac03d05967e16748ab80', 'CONSTRUCTOR', 'GROUND_SERVICE', '地勤人员', '2025-01-15', 'ACTIVE', '负责地面施工工作'),

-- 司机
(UUID(), '0b71a1259c49918c6595c9720ad1db5d', '0465342288d0637398b64ca73da76090', 'CONSTRUCTOR', 'DRIVER', '司机', '2025-01-15', 'ACTIVE', '负责设备运输和人员接送');

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

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

-- 查询项目的项目经理
-- SELECT * FROM project_member WHERE project_id = '0b71a1259c49918c6595c9720ad1db5d' AND role_type = 'PROJECT_MANAGER' AND status = 'ACTIVE';

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