Files
MES/yawei-mes/.sql/2025-11-21_01_周启威_报工质检单编码规则.sql
2026-04-02 10:39:03 +08:00

23 lines
964 B
SQL
Raw Permalink 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.

-- 插入主表
INSERT INTO `sys_code_rule` (
`remark`, `create_by`, `create_time`, `update_by`, `update_time`,
`number`, `name`, `basic_domain`, `status`
) VALUES (
'报工质检单号生成规则BGZJ + 年月日 + 3位流水号每天重置',
'admin', NOW(), 'admin', NOW(),
'BGZJ', '报工质检编码规则', 'ReportQuality', 'active'
);
-- 获取主表ID并批量插入子表
SET @new_rule_id = LAST_INSERT_ID();
INSERT INTO `sys_code_rule_entry` (
`rule_id`, `sort`, `type_id`, `length_flow`, `max_flow`,
`date_format`, `constant_char`, `element_source_table`, `source_attribute`,
`source_value`, `code_cover`, `max_date`
) VALUES
(@new_rule_id, 1, 'B', NULL, NULL, '', 'BGZJ', NULL, NULL, NULL, '', NULL),
(@new_rule_id, 2, 'C', NULL, NULL, 'yyyyMMdd', '', NULL, NULL, NULL, '', NULL),
(@new_rule_id, 3, 'A', 3, 1, '', '', NULL, NULL, NULL, '0', NULL);
COMMIT;