/* ============================================================================ 首页菜单(s_menu)—— 根菜单项 用途:登录后的默认落地页(前端 router 的 HOME_PATH = /dashboard)。 本次与原「表格测试」菜单一起补上:页面路由必须先存在,菜单才点得通。 说明: 1. 幂等:菜单按 b_id 判断存在性,重复运行无副作用。 2. 排序:b_xh = 0,排在「表格测试(1)」之前,作为根菜单第一项。 3. b_parent_id 为 null 即根节点;b_depth = 0; b_path 约定节点编码前后均带 /,根级为 /dashboard/。 4. 权限:不建权限点。g3soft 超管提权可见;普通账号需另配 s_power(menu.dashboard) + s_user_power,做法见 13_table_test_menu.sql 末尾注释。 ============================================================================ */ if not exists (select 1 from dbo.s_menu where b_id = 'dashboard') begin insert into dbo.s_menu (b_id, b_parent_id, b_depth, b_path, b_name, b_i18n, b_menu_type, b_route, b_icon, b_xh, b_canuse) values ('dashboard', null, 0, '/dashboard/', N'首页', 'menu.dashboard', 'page', '/dashboard', 'layout-dashboard', 0, 1); end GO /* ---------------------------------------------------------------------------- 多语言(s_i18n):菜单名。已存在同键同语言的行不覆盖(人工翻译优先)。 ---------------------------------------------------------------------------- */ declare @i18n table (k varchar(150) primary key, v nvarchar(1000) not null); insert into @i18n (k, v) values ('menu.dashboard', N'首页'); insert into dbo.s_i18n (b_key, b_locale, b_value, b_canuse) select i.k, t.b_id, i.v, 1 from @i18n i cross join (select b_id from dbo.s_i18n_type where b_default = 1) t where not exists (select 1 from dbo.s_i18n x where x.b_key = i.k and x.b_locale = t.b_id); GO select '菜单' as 项, count(*) as 行数 from dbo.s_menu where b_id = 'dashboard'; GO