Files
shanxia2.0/backend/scripts/migrate_20260820_duty_time_range_dict.sql
T
zlwuandCursor b9ff9c9d67 feat(duty): make duty time range a single-select dict like work plans
Add duty_time_range dictionary with day/night presets, parse typed ranges on ensure, and replace time pickers with allow-create select in the schedule dialog.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 21:58:18 +08:00

75 lines
1.7 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.
-- backend/scripts/migrate_20260820_duty_time_range_dict.sql
-- 值班排班:值班时段字典(可单选 + allow-create)
-- 可重复执行
SET NAMES utf8mb4;
INSERT INTO `sys_dict_type` (
`id`, `dict_name`, `dict_type`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
)
SELECT
'DUTYDICTTYPE00000000000000000003',
'值班时段',
'duty_time_range',
'shanxia2.0',
92,
'值班排班时段选项',
'',
'',
NOW(),
'',
NOW(),
0
FROM DUAL
WHERE NOT EXISTS (
SELECT 1 FROM `sys_dict_type`
WHERE `dict_type` = 'duty_time_range'
AND `tenant_no` = 'shanxia2.0'
AND `del_flag` = 0
);
INSERT INTO `sys_dict_data` (
`id`, `dict_label`, `dict_value`, `tag_type`, `dict_type`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
)
SELECT * FROM (
SELECT
'DUTYDICTDATA0000000000000000006' AS id,
'08:00–18:00' AS dict_label,
'08:00|18:00|0' AS dict_value,
'' AS tag_type,
'duty_time_range' AS dict_type,
'shanxia2.0' AS tenant_no,
1 AS order_num,
NULL AS remark,
'' AS create_by,
'' AS create_dept_id,
NOW() AS create_time,
'' AS update_by,
NOW() AS update_time,
0 AS del_flag
UNION ALL SELECT
'DUTYDICTDATA0000000000000000007',
'18:00–次日07:00',
'18:00|07:00|1',
'',
'duty_time_range',
'shanxia2.0',
2,
NULL,
'',
'',
NOW(),
'',
NOW(),
0
) AS t
WHERE NOT EXISTS (
SELECT 1 FROM `sys_dict_data` d
WHERE d.tenant_no = t.tenant_no
AND d.dict_type = t.dict_type
AND d.dict_value = t.dict_value
AND d.del_flag = 0
);