Files
shanxia2.0/docs/data-migration/phase-0-foundation/seed_sys_dept_from_prod_v1.sql
T
zlwuandCursor 10c3c5470c chore: sync local PL/CRM/BX and migration work to new Gogs host
Bundle pending backend/web-admin feature updates, data-migration scripts,
and related docs so the V1.5 branch on the Tencent Cloud Gogs matches the
current workspace (excluding local secrets).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 09:19:21 +08:00

58 lines
2.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- P0-2:部门种子(来自上一次生产迁移后备份)
-- 源:docs/sql/shanxia2.0-生产-v1.sql(sys_dept,2026-07-12 数据迁移脚本重建)
-- 目标:生产库 shanxia2.0.sys_dept
-- 用法:逐步执行;先盘点再决定是否 DELETE 后重灌本表(勿连带清其他表)
--
-- 建议顺序:
-- 1) SELECT id, parent_id, dept_name, order_num, del_flag FROM sys_dept WHERE del_flag=0;
-- 2) 若需按 v1 全量对齐本表:先 DELETE 仅 sys_dept(或按 id 覆盖)
-- 3) 执行下方 INSERT(已用 INSERT ... ON DUPLICATE KEY UPDATE 幂等)
SET NAMES utf8mb4;
INSERT INTO `sys_dept` (
`id`, `parent_id`, `dept_name`, `dept_category_code`, `status`,
`leader`, `leader_phone`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
) VALUES
(
'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '0', '安庆市山峡化工有限公司', 'gs', '1',
NULL, NULL, 'shanxia2.0', 0, '数据迁移脚本重建',
'd3000000000000000000000000000001', '', '2026-07-12 19:26:36',
'd3000000000000000000000000000001', '2026-07-12 19:26:36', 0
),
(
'C65CAAE057914CCCAE2A81BE627A43ED', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '人力资源部', 'bm', '1',
NULL, NULL, 'shanxia2.0', 20, '数据迁移脚本重建',
'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-07-12 19:26:36',
'd3000000000000000000000000000001', '2026-07-12 19:26:36', 0
),
(
'D65CAAE057914CCCAE2A81BE627A43EE', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '生产现场部', 'bm', '1',
NULL, NULL, 'shanxia2.0', 30, '数据迁移脚本重建',
'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-07-12 19:26:36',
'd3000000000000000000000000000001', '2026-07-12 19:26:36', 0
),
(
'E65CAAE057914CCCAE2A81BE627A43EA', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '销售部', 'bm', '1',
NULL, NULL, 'shanxia2.0', 10, '数据迁移脚本重建',
'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-07-12 19:26:36',
'd3000000000000000000000000000001', '2026-07-12 19:26:36', 0
),
(
'F65CAAE057914CCCAE2A81BE627A43EF', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '财务部门', 'bm', '1',
NULL, NULL, 'shanxia2.0', 15, '用户迁移前新增',
'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-07-12 19:32:37',
'd3000000000000000000000000000001', '2026-07-12 19:32:37', 0
)
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`),
`dept_name` = VALUES(`dept_name`),
`dept_category_code` = VALUES(`dept_category_code`),
`status` = VALUES(`status`),
`order_num` = VALUES(`order_num`),
`remark` = VALUES(`remark`),
`update_by` = VALUES(`update_by`),
`update_time` = VALUES(`update_time`),
`del_flag` = 0;