-- ============================================================
-- 开发/演示种子数据
-- 仅用于本地开发，不入 Flyway migration
-- 用法: ./scripts/seed-dev.sh
-- 所有用户初始密码: [REDACTED] (BCrypt: $2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm)
-- ============================================================

SET FOREIGN_KEY_CHECKS = 0;

TRUNCATE TABLE `tUserPermission`;
TRUNCATE TABLE `tUser`;
TRUNCATE TABLE `tStaff`;
TRUNCATE TABLE `tPermissionCategory`;
TRUNCATE TABLE `tModule`;

SET FOREIGN_KEY_CHECKS = 1;

-- ============================================================
-- ① tStaff (37 行) — 与 prototype 用户列表 1:1
-- ============================================================
INSERT INTO `tStaff`
  (`iIncrement`, `tCreateDate`, `sStaffNo`, `sStaffName`, `sDepartment`, `sCreatedBy`, `bDeleted`)
VALUES
  (1, '2023-10-26 17:00:00', 'STAFF001', '管广飞',     '工艺技术',   'admin',     b'0'),
  (2, '2023-10-26 17:00:00', 'STAFF002', '李斌',       '印前制作',   'admin',     b'0'),
  (3, '2023-11-20 10:00:00', 'STAFF003', '朱财喜',     '印刷车间',   'admin',     b'0'),
  (4, '2024-10-08 13:00:00', 'STAFF004', '李金辉',     '机修',       'admin',     b'0'),
  (5, '2023-11-22 13:00:00', 'STAFF005', '汪鑫',       '工艺技术',   'admin',     b'0'),
  (6, '2023-11-27 15:00:00', 'STAFF006', '钱豹',       '物控部',     'admin',     b'0'),
  (7, '2024-11-11 15:00:00', 'STAFF007', '张寅飞',     '印前制作',   'lib',       b'0'),
  (8, '2025-06-03 21:00:00', 'STAFF008', '孟威',       '工艺技术',   'admin',     b'0'),
  (9, '2025-06-05 11:00:00', 'STAFF009', '杭仁萍',     '跟单',       'mengw',     b'0'),
  (10,'2025-06-11 10:00:00', 'STAFF010', '李丹',       '客服部',     'hangrp',    b'0'),
  (11,'2025-06-11 10:00:00', 'STAFF011', '王宽明',     '印刷车间',   'lid',       b'0'),
  (12,'2025-06-11 10:00:00', 'STAFF012', '潘茹',       '工艺技术',   'lid',       b'0'),
  (13,'2025-06-11 10:00:00', 'STAFF013', '耿广东',     '工艺技术',   'lid',       b'0'),
  (14,'2025-06-17 14:00:00', 'STAFF014', '余涛',       '印刷车间',   'hangrp',    b'0'),
  (15,'2025-06-26 10:00:00', 'STAFF015', '廖赵军',     '财务部',     'hangrp',    b'0'),
  (16,'2025-07-28 13:00:00', 'STAFF016', '曹建勇',     '物控部',     'limq',      b'0'),
  (17,'2025-07-29 13:00:00', 'STAFF017', '陈淑贤',     '品质管理部', 'csx',       b'0'),
  (18,'2025-08-18 09:00:00', 'STAFF018', '张红英',     '模烫车间',   'admin',     b'0'),
  (19,'2025-08-21 11:00:00', 'STAFF019', '吕政彦',     '总经理办公室','hangrp',   b'0'),
  (20,'2025-09-01 11:00:00', 'STAFF020', '陈鑫涛',     '品质管理部', 'csx',       b'0'),
  (21,'2025-09-04 11:00:00', 'STAFF021', '陆鑫',       '工艺技术',   'zhangz',    b'0'),
  (22,'2025-09-05 11:00:00', 'STAFF022', '陆鑫-储运部','工艺技术',   'luxin',     b'0'),
  (23,'2025-09-08 15:00:00', 'STAFF023', '朱咸兵',     '工艺技术',   'qianb',     b'0'),
  (24,'2025-09-12 16:00:00', 'STAFF024', '孟臻晟',     '装订车间',   'admin',     b'0'),
  (25,'2025-10-16 13:00:00', 'STAFF025', '彭敏',       '计划管理',   'pengm',     b'0'),
  (26,'2025-10-22 10:00:00', 'STAFF026', '张伟',       '印刷车间',   'zhangw',    b'0'),
  (27,'2025-11-04 16:00:00', 'STAFF027', '李娜',       '质检部',     'lid',       b'0'),
  (28,'2025-11-15 09:00:00', 'STAFF028', '王军',       '装订车间',   'admin',     b'0'),
  (29,'2025-12-01 11:00:00', 'STAFF029', '赵敏',       '财务部',     'zhaom',     b'0'),
  (30,'2025-12-08 14:00:00', 'STAFF030', '周强',       '物控部',     'qianb',     b'0'),
  (31,'2026-01-05 09:00:00', 'STAFF031', '吴丽',       '人事部',     'wul',       b'0'),
  (32,'2026-01-18 13:00:00', 'STAFF032', '郑涛',       '工艺技术',   'zhengt',    b'0'),
  (33,'2026-02-02 10:00:00', 'STAFF033', '冯静',       '客服部',     'fengj',     b'0'),
  (34,'2026-02-20 15:00:00', 'STAFF034', '孙磊',       '装订车间',   'admin',     b'0'),
  (35,'2026-03-08 11:00:00', 'STAFF035', '马超',       '机修',       'ljh',       b'0'),
  (36,'2026-03-22 09:00:00', 'STAFF036', '朱子纯',     '总经理办公室','admin',    b'0'),
  (37,'2023-10-26 17:00:00', 'STAFF037', '系统管理员', NULL,         'admin',     b'0');

-- ============================================================
-- ② tPermissionCategory (38 行) — 与 prototype perms[] 1:1
-- ============================================================
INSERT INTO `tPermissionCategory`
  (`iIncrement`, `tCreateDate`, `sCategoryCode`, `sCategoryName`, `iParentId`, `iSortOrder`, `sCreatedBy`, `bDeleted`)
VALUES
  (1, '2023-10-01 00:00:00', 'PERM_DEFAULT',          '默认显示(必选)',     NULL, 1,  'admin', b'0'),
  (2, '2023-10-01 00:00:00', 'PERM_NO_PRICE',         '禁止查看价格',       NULL, 2,  'admin', b'0'),
  (3, '2023-10-01 00:00:00', 'PERM_CS_FOLLOWUP',      '客服跟单',           NULL, 3,  'admin', b'0'),
  (4, '2023-10-01 00:00:00', 'PERM_QUOTE_TEAM',       '报价组员工',         NULL, 4,  'admin', b'0'),
  (5, '2023-10-01 00:00:00', 'PERM_MAT_CTRL',         '物控部员工',         NULL, 5,  'admin', b'0'),
  (6, '2023-10-01 00:00:00', 'PERM_SCM_PMC',          '供应链PMC',          NULL, 6,  'admin', b'0'),
  (7, '2023-10-01 00:00:00', 'PERM_VIEW_ORDER_PRICE', '允许查看订单价格',   NULL, 7,  'admin', b'0'),
  (8, '2023-10-01 00:00:00', 'PERM_LOGISTICS',        '储运部员工',         NULL, 8,  'admin', b'0'),
  (9, '2023-10-01 00:00:00', 'PERM_EXT_SUPPLIER',     '外部供应商',         NULL, 9,  'admin', b'0'),
  (10,'2023-10-01 00:00:00', 'PERM_QC_STAFF',         '品质部员工',         NULL, 10, 'admin', b'0'),
  (11,'2023-10-01 00:00:00', 'PERM_TECH_CENTER',      '技术中心员工',       NULL, 11, 'admin', b'0'),
  (12,'2023-10-01 00:00:00', 'PERM_MECHANIC',         '机修组员工',         NULL, 12, 'admin', b'0'),
  (13,'2023-10-01 00:00:00', 'PERM_PROD_PLANNER',     '生产部计划员工',     NULL, 13, 'admin', b'0'),
  (14,'2023-10-01 00:00:00', 'PERM_OUTSRC',           '外发组员工',         NULL, 14, 'admin', b'0'),
  (15,'2023-10-01 00:00:00', 'PERM_MOLD_HEAT',        '模烫车间',           NULL, 15, 'admin', b'0'),
  (16,'2023-10-01 00:00:00', 'PERM_BINDING',          '装订车间',           NULL, 16, 'admin', b'0'),
  (17,'2023-10-01 00:00:00', 'PERM_POSTPROC',         '后加工车间',         NULL, 17, 'admin', b'0'),
  (18,'2023-10-01 00:00:00', 'PERM_QC_MGMT',          '品质部管理',         NULL, 18, 'admin', b'0'),
  (19,'2023-10-01 00:00:00', 'PERM_PREMIUM_LINE',     '精品车间',           NULL, 19, 'admin', b'0'),
  (20,'2023-10-01 00:00:00', 'PERM_HR_TEAM',          '人事组',             NULL, 20, 'admin', b'0'),
  (21,'2023-10-01 00:00:00', 'PERM_STATS_TEAM',       '统计组',             NULL, 21, 'admin', b'0'),
  (22,'2023-10-01 00:00:00', 'PERM_MECH_LEAD',        '机修主管',           NULL, 22, 'admin', b'0'),
  (23,'2023-10-01 00:00:00', 'PERM_RND_STAFF',        '样品开发部员工',     NULL, 23, 'admin', b'0'),
  (24,'2023-10-01 00:00:00', 'PERM_DESIGN',           '设计开发',           NULL, 24, 'admin', b'0'),
  (25,'2023-10-01 00:00:00', 'PERM_GM_OFFICE',        '总经办',             NULL, 25, 'admin', b'0'),
  (26,'2023-10-01 00:00:00', 'PERM_AUDIT_TEAM',       '审核组',             NULL, 26, 'admin', b'0'),
  (27,'2023-10-01 00:00:00', 'PERM_SETTLE_TEAM',      '结算组',             NULL, 27, 'admin', b'0'),
  (28,'2023-10-01 00:00:00', 'PERM_PROOF_LINE',       '打样车间',           NULL, 28, 'admin', b'0'),
  (29,'2023-10-01 00:00:00', 'PERM_PLATE_TEAM',       '制版组',             NULL, 29, 'admin', b'0'),
  (30,'2023-10-01 00:00:00', 'PERM_DOC_CTRL',         '文控组',             NULL, 30, 'admin', b'0'),
  (31,'2023-10-01 00:00:00', 'PERM_ADMIN_TEAM',       '行政组',             NULL, 31, 'admin', b'0'),
  (32,'2023-10-01 00:00:00', 'PERM_COST_TEAM',        '成本组',             NULL, 32, 'admin', b'0'),
  (33,'2023-10-01 00:00:00', 'PERM_PURCHASE_TEAM',    '采购组',             NULL, 33, 'admin', b'0'),
  (34,'2023-10-01 00:00:00', 'PERM_OA_ADMIN',         'OA管理员',           NULL, 34, 'admin', b'0'),
  (35,'2023-10-01 00:00:00', 'PERM_DEV_TEAM',         '开发组',             NULL, 35, 'admin', b'0'),
  (36,'2023-10-01 00:00:00', 'PERM_API_INTEGR',       'API对接',            NULL, 36, 'admin', b'0'),
  (37,'2023-10-01 00:00:00', 'PERM_MES_ADMIN',        'MES管理员',          NULL, 37, 'admin', b'0'),
  (38,'2023-10-01 00:00:00', 'PERM_REPORT_TEAM',      '报表组',             NULL, 38, 'admin', b'0');

-- ============================================================
-- ③ tUser (37 行) — 密码全部 BCrypt("666666")
--   admin (id=1) 是登录入口；其他用户参考 prototype 列表
-- ============================================================
INSERT INTO `tUser`
  (`iIncrement`, `tCreateDate`, `sUserNo`, `sUserName`, `iStaffId`, `sUserType`, `sLanguage`,
   `bCanModifyDocs`, `sPasswordHash`, `tLastLoginDate`, `sCreatedBy`, `bDeleted`)
VALUES
  ( 1,'2023-10-26 17:05:58','admin','admin',         37,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-06 12:28:49','admin',b'0'),
  ( 2,'2023-10-26 17:02:01','ggf','管广飞',           1,'超级管理员','en',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-02-27 17:48:11','admin',b'0'),
  ( 3,'2023-10-26 17:02:58','lib','李斌',             2,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-01-28 16:53:32','admin',b'0'),
  ( 4,'2023-11-20 10:29:09','zhucx','朱财喜',         3,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-03-23 10:08:29','admin',b'0'),
  ( 5,'2024-10-08 13:48:59','ljh','李金辉',           4,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-06 11:14:04','yfz',b'0'),
  ( 6,'2023-11-22 13:22:35','wx','汪鑫',              5,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-03-23 11:57:13','admin',b'0'),
  ( 7,'2023-11-27 15:30:11','qianb','钱豹',           6,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-28 16:49:04','admin',b'0'),
  ( 8,'2024-11-11 15:59:52','zyf','张寅飞',           7,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2025-09-11 11:42:12','ljh',b'0'),
  ( 9,'2025-06-03 21:26:07','mengw','孟威',           8,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-06 13:56:22','admin',b'0'),
  (10,'2025-06-05 11:11:56','hangrp','杭仁萍',        9,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-30 14:18:28','mengw',b'0'),
  (11,'2025-06-11 10:34:29','lid','李丹',            10,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-27 13:47:58','hangrp',b'0'),
  (12,'2025-06-11 10:40:22','wkm','王宽明',          11,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-25 16:07:38','lid',b'0'),
  (13,'2025-06-11 10:41:07','panr','潘茹',           12,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2025-06-17 09:04:46','lid',b'0'),
  (14,'2025-06-11 10:41:37','gengd','耿广东',        13,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2025-07-04 14:40:02','lid',b'0'),
  (15,'2025-06-17 14:32:49','yut','余涛',            14,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-03 18:39:34','hangrp',b'0'),
  (16,'2025-06-26 10:57:28','lzj','廖赵军',          15,'超级管理员','zh',b'0','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm',NULL,'hangrp',b'0'),
  (17,'2025-07-28 13:59:21','caojy','曹建勇',        16,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-02-02 13:58:14','limq',b'0'),
  (18,'2025-07-29 13:26:58','csx','陈淑贤',          17,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-24 15:05:52','csx',b'0'),
  (19,'2025-08-18 09:34:47','zhy','张红英',          18,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2025-12-24 16:24:52','admin',b'0'),
  (20,'2025-08-21 11:16:12','lzy','吕政彦',          19,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-16 08:54:24','hangrp',b'0'),
  (21,'2025-09-01 11:22:00','cxt','陈鑫涛',          20,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-03-23 10:12:47','csx',b'0'),
  (22,'2025-09-04 11:48:44','luxin','陆鑫',          21,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-05 17:56:03','zhangz',b'0'),
  (23,'2025-09-05 11:28:37','ZY0006','陆鑫-储运部',  22,'普通用户',  'zh',b'0','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2025-11-19 09:11:27','luxin',b'0'),
  (24,'2025-09-08 15:00:29','zhuxb','朱咸兵',        23,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-27 13:40:15','qianb',b'0'),
  (25,'2025-09-12 16:24:07','mengzs','孟臻晟',       24,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-07 09:17:57','admin',b'0'),
  (26,'2025-10-16 13:30:32','pengm','彭敏',          25,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-06 11:28:33','pengm',b'0'),
  (27,'2025-10-22 10:12:00','zhangw','张伟',         26,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-03-15 09:22:14','zhangw',b'0'),
  (28,'2025-11-04 16:08:21','lin','李娜',            27,'普通用户',  'zh',b'0','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-02 14:50:33','lid',b'0'),
  (29,'2025-11-15 09:30:11','wangj','王军',          28,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-15 17:10:55','admin',b'0'),
  (30,'2025-12-01 11:00:00','zhaom','赵敏',          29,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-01 08:45:00','zhaom',b'0'),
  (31,'2025-12-08 14:22:33','zhouq','周强',          30,'普通用户',  'zh',b'0','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-20 10:30:21','qianb',b'0'),
  (32,'2026-01-05 09:15:42','wul','吴丽',            31,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-04-25 15:18:09','wul',b'0'),
  (33,'2026-01-18 13:55:27','zhengt','郑涛',         32,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-02 11:40:58','zhengt',b'0'),
  (34,'2026-02-02 10:08:14','fengj','冯静',          33,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-04 16:25:17','fengj',b'0'),
  (35,'2026-02-20 15:32:48','sunl','孙磊',           34,'普通用户',  'zh',b'0','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-05 09:55:36','admin',b'0'),
  (36,'2026-03-08 11:48:09','mac','马超',            35,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-06 14:12:25','ljh',b'0'),
  (37,'2026-03-22 09:00:00','zhuzc','朱子纯',        36,'超级管理员','zh',b'1','$2b$10$VbvCPbg8oq6tDr19eZOObOMvr2Cm.7UIVX3HwAQzWLS83r57lxCcm','2026-05-07 13:00:00','admin',b'0');

-- ============================================================
-- ④ tUserPermission — admin 全部 38 权限 + 几个普通用户给少量权限
-- ============================================================
-- admin (iUserId=1) 全部 38 个权限
INSERT INTO `tUserPermission` (`tCreateDate`, `iUserId`, `iCategoryId`, `sCreatedBy`)
SELECT '2024-01-01 00:00:00', 1, c.iIncrement, 'admin'
FROM `tPermissionCategory` c;

-- 几个普通用户/超管给典型权限组合
INSERT INTO `tUserPermission` (`tCreateDate`, `iUserId`, `iCategoryId`, `sCreatedBy`) VALUES
  -- ggf (id=2) 工艺技术 → 默认 + 技术中心 + 设计开发
  ('2024-01-01 00:00:00',  2,  1, 'admin'),
  ('2024-01-01 00:00:00',  2, 11, 'admin'),
  ('2024-01-01 00:00:00',  2, 24, 'admin'),
  -- lib (id=3) 印前 → 默认 + 制版组 + 文控组
  ('2024-01-01 00:00:00',  3,  1, 'admin'),
  ('2024-01-01 00:00:00',  3, 29, 'admin'),
  ('2024-01-01 00:00:00',  3, 30, 'admin'),
  -- qianb (id=7) 物控部 → 默认 + 物控部员工 + 供应链PMC + 采购组
  ('2024-01-01 00:00:00',  7,  1, 'admin'),
  ('2024-01-01 00:00:00',  7,  5, 'admin'),
  ('2024-01-01 00:00:00',  7,  6, 'admin'),
  ('2024-01-01 00:00:00',  7, 33, 'admin'),
  -- csx (id=18) 品质 → 默认 + 品质员工 + 品质管理
  ('2024-01-01 00:00:00', 18,  1, 'admin'),
  ('2024-01-01 00:00:00', 18, 10, 'admin'),
  ('2024-01-01 00:00:00', 18, 18, 'admin'),
  -- ZY0006 (id=23) 普通用户 → 仅默认 + 储运
  ('2024-01-01 00:00:00', 23,  1, 'admin'),
  ('2024-01-01 00:00:00', 23,  8, 'admin'),
  -- lin (id=28) 普通用户 → 仅默认
  ('2024-01-01 00:00:00', 28,  1, 'admin'),
  -- zhaom (id=30) 财务 → 默认 + 成本组 + 结算组
  ('2024-01-01 00:00:00', 30,  1, 'admin'),
  ('2024-01-01 00:00:00', 30, 27, 'admin'),
  ('2024-01-01 00:00:00', 30, 32, 'admin');

-- ============================================================
-- ⑤ tModule (8 行) — 业务模块树根 + 叶子
-- ============================================================
INSERT INTO `tModule`
  (`iIncrement`, `tCreateDate`, `sDisplayType`, `sProcedureName`, `sModuleType`, `sManageDeptEn`,
   `bShowPermission`, `sModuleNameZh`, `iParentId`, `iSortOrder`, `sCreatedBy`, `bDeleted`)
VALUES
  (1,'2024-01-01 00:00:00','系统配置','sys_root',          '系统',     'SYS',  b'1','系统管理',     NULL, 10,'admin',b'0'),
  (2,'2024-01-01 00:00:00','系统配置','sys_user_mgmt',     '用户管理', 'SYS',  b'1','用户管理',        1, 11,'admin',b'0'),
  (3,'2024-01-01 00:00:00','系统配置','sys_perm_mgmt',     '权限管理', 'SYS',  b'1','权限管理',        1, 12,'admin',b'0'),
  (4,'2024-01-01 00:00:00','系统配置','sys_module_mgmt',   '模块管理', 'SYS',  b'1','模块管理',        1, 13,'admin',b'0'),
  (5,'2024-01-01 00:00:00','前端业务','biz_sales',          '业务',     'SAL',  b'1','销售管理',     NULL, 20,'admin',b'0'),
  (6,'2024-01-01 00:00:00','前端业务','biz_purchase',       '业务',     'PUR',  b'1','采购管理',     NULL, 30,'admin',b'0'),
  (7,'2024-01-01 00:00:00','前端业务','biz_inventory',      '业务',     'INV',  b'1','库存管理',     NULL, 40,'admin',b'0'),
  (8,'2024-01-01 00:00:00','前端业务','biz_quality',        '业务',     'QC',   b'1','质量管理',     NULL, 50,'admin',b'0');

-- 重置自增起点（37 + 1）
ALTER TABLE `tStaff`               AUTO_INCREMENT = 38;
ALTER TABLE `tUser`                AUTO_INCREMENT = 38;
ALTER TABLE `tPermissionCategory`  AUTO_INCREMENT = 39;
ALTER TABLE `tModule`              AUTO_INCREMENT = 9;

SELECT '=== Seed 完成 ===' AS info;
SELECT 'tStaff'              AS tbl, COUNT(*) AS row_count FROM `tStaff`
UNION ALL SELECT 'tPermissionCategory',  COUNT(*) FROM `tPermissionCategory`
UNION ALL SELECT 'tUser',                COUNT(*) FROM `tUser`
UNION ALL SELECT 'tUserPermission',      COUNT(*) FROM `tUserPermission`
UNION ALL SELECT 'tModule',              COUNT(*) FROM `tModule`;
