-- ========================================================
-- MySQL 初始化数据脚本
-- 与 data-dev.sql 语义一致，使用标准 MySQL 语法
-- ========================================================

INSERT IGNORE INTO sys_dept (id, dept_name, dept_code, parent_id, sort_order, status) VALUES
(1, '总裁办', 'CEO', 0, 1, 1),
(2, '技术部', 'TECH', 0, 2, 1),
(3, '财务部', 'FIN', 0, 3, 1),
(4, '人事部', 'HR', 0, 4, 1),
(5, '前端组', 'FE', 2, 1, 1),
(6, '后端组', 'BE', 2, 2, 1);

INSERT IGNORE INTO sys_user (id, username, password, real_name, phone, email, dept_id, employee_type, status) VALUES
(1, 'admin', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', '超级管理员', '13800138000', 'admin@qqflow.com', 1, 'super_admin', 0),
(2, 'zhangsan', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', '张三', '13800138001', 'zhangsan@qqflow.com', 2, 'common_user', 0),
(3, 'lisi', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', '李四', '13800138002', 'lisi@qqflow.com', 3, 'dept_manager', 0),
(4, 'wangwu', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', '王五', '13800138003', 'wangwu@qqflow.com', 4, 'flow_manager', 0);

INSERT IGNORE INTO sys_role (id, role_code, role_name, role_scope, parent_id, dept_id, username, password, status, phone) VALUES
(1, 'super_admin', '总裁办专员', 'platform', 0, 1, 'role_super_admin', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', 1, '13900000001'),
(2, 'flow_admin', '流程运维专员', 'tenant', 0, 1, 'role_flow_admin', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', 1, '13900000002'),
(3, 'normal_user', '技术部员工', 'tenant', 0, 2, 'role_normal_user', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', 1, '13900000003'),
(4, 'dept_manager', '财务部经理', 'tenant', 3, 3, 'role_dept_manager', '$2a$10$TGAG9dOoBWlslF3EjezT4eyIUgdW1X.YF4lLpNq4E8U9IaXRgZ8K2', 1, '13900000004');

INSERT IGNORE INTO sys_user_role (id, user_id, role_id) VALUES
(1, 1, 1),
(2, 2, 4),
(3, 3, 3),
(4, 4, 3);
