Files
FTC25009/sql/bas_config_menus.sql
2026-06-24 09:13:18 +08:00

82 lines
3.3 KiB
Transact-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.
-- 基础信息菜单接入:托盘规则、点位配置
-- 目标库:FTC25009-WMS
DECLARE @basMenuId bigint = 2004;
DECLARE @trayRuleMenuId bigint = 2190;
DECLARE @stationPointMenuId bigint = 2200;
DECLARE @menuIdIsIdentity bit = COLUMNPROPERTY(OBJECT_ID(N'dbo.sys_menu'), 'menu_id', 'IsIdentity');
IF @menuIdIsIdentity = 1
SET IDENTITY_INSERT dbo.sys_menu ON;
IF NOT EXISTS (SELECT 1 FROM dbo.sys_menu WHERE menu_id = @trayRuleMenuId)
BEGIN
INSERT INTO dbo.sys_menu (
menu_id, menu_name, parent_id, order_num, path, component, query, route_name,
is_frame, is_cache, menu_type, visible, status, perms, icon,
create_by, create_time, update_by, update_time, remark
)
VALUES (
@trayRuleMenuId, N'托盘规则', @basMenuId, 6, N'trayRule', N'bas/trayRule/index', NULL, N'',
1, 0, N'C', N'0', N'0', N'bas:trayRule:list', N'list',
N'admin', GETDATE(), N'', NULL, N''
);
END
IF NOT EXISTS (SELECT 1 FROM dbo.sys_menu WHERE menu_id = @stationPointMenuId)
BEGIN
INSERT INTO dbo.sys_menu (
menu_id, menu_name, parent_id, order_num, path, component, query, route_name,
is_frame, is_cache, menu_type, visible, status, perms, icon,
create_by, create_time, update_by, update_time, remark
)
VALUES (
@stationPointMenuId, N'点位配置', @basMenuId, 7, N'stationpoint', N'bas/stationpoint/index', NULL, N'',
1, 0, N'C', N'0', N'0', N'bas:stationpoint:list', N'list',
N'admin', GETDATE(), N'', NULL, N''
);
END
ELSE
BEGIN
UPDATE dbo.sys_menu
SET menu_name = N'点位配置',
update_time = GETDATE()
WHERE menu_id = @stationPointMenuId;
END
DECLARE @button table(menu_id bigint, menu_name nvarchar(50), parent_id bigint, order_num int, perms nvarchar(100));
INSERT INTO @button(menu_id, menu_name, parent_id, order_num, perms)
VALUES
(2191, N'托盘规则查询', @trayRuleMenuId, 1, N'bas:trayRule:query'),
(2192, N'托盘规则新增', @trayRuleMenuId, 2, N'bas:trayRule:add'),
(2193, N'托盘规则修改', @trayRuleMenuId, 3, N'bas:trayRule:edit'),
(2194, N'托盘规则删除', @trayRuleMenuId, 4, N'bas:trayRule:remove'),
(2195, N'托盘规则导出', @trayRuleMenuId, 5, N'bas:trayRule:export'),
(2201, N'点位配置查询', @stationPointMenuId, 1, N'bas:stationpoint:query'),
(2202, N'点位配置新增', @stationPointMenuId, 2, N'bas:stationpoint:add'),
(2203, N'点位配置修改', @stationPointMenuId, 3, N'bas:stationpoint:edit'),
(2204, N'点位配置删除', @stationPointMenuId, 4, N'bas:stationpoint:remove'),
(2205, N'点位配置导出', @stationPointMenuId, 5, N'bas:stationpoint:export');
INSERT INTO dbo.sys_menu (
menu_id, menu_name, parent_id, order_num, path, component, query, route_name,
is_frame, is_cache, menu_type, visible, status, perms, icon,
create_by, create_time, update_by, update_time, remark
)
SELECT b.menu_id, b.menu_name, b.parent_id, b.order_num, N'#', N'', NULL, N'',
1, 0, N'F', N'0', N'0', b.perms, N'#',
N'admin', GETDATE(), N'', NULL, N''
FROM @button b
WHERE NOT EXISTS (SELECT 1 FROM dbo.sys_menu m WHERE m.menu_id = b.menu_id);
UPDATE m
SET m.menu_name = b.menu_name,
m.update_time = GETDATE()
FROM dbo.sys_menu m
INNER JOIN @button b ON b.menu_id = m.menu_id;
IF @menuIdIsIdentity = 1
SET IDENTITY_INSERT dbo.sys_menu OFF;
GO