mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 19:09:19 +08:00
feat: 菜单侧栏标题与标签标题拆分并支持 tab_title 回退
This commit is contained in:
+6
-1
@@ -35,10 +35,15 @@ public class CreateMenuDTO {
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
* 菜单标题(侧栏展示)
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标签页标题(可空;空则回退 title)
|
||||
*/
|
||||
private String tabTitle;
|
||||
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
|
||||
+6
-1
@@ -35,10 +35,15 @@ public class UpdateMenuDTO {
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
* 菜单标题(侧栏展示)
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标签页标题(可空;空则回退 title)
|
||||
*/
|
||||
private String tabTitle;
|
||||
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
|
||||
+7
-1
@@ -45,11 +45,17 @@ public class MenuPO {
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
* 菜单标题(侧栏展示)
|
||||
*/
|
||||
@TableField("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标签页标题(可空;空则回退 title;ALWAYS 保证清空可写库)
|
||||
*/
|
||||
@TableField(value = "tab_title", updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String tabTitle;
|
||||
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
|
||||
+6
-1
@@ -42,10 +42,15 @@ public class MenuVO {
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
* 菜单标题(侧栏展示)
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标签页标题(可空;空则回退 title)
|
||||
*/
|
||||
private String tabTitle;
|
||||
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
|
||||
+7
-1
@@ -62,11 +62,17 @@ public class UserMenuVO {
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 路由标题
|
||||
* 侧栏菜单标题
|
||||
* 对应数据库: title 字段
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标签页标题(可空;空则前端回退 title)
|
||||
* 对应数据库: tab_title 字段
|
||||
*/
|
||||
private String tabTitle;
|
||||
|
||||
/**
|
||||
* 路由图标:优先为 icon_svg 原文,否则为 Iconify 名
|
||||
* 对应数据库: icon_svg / icon
|
||||
|
||||
+11
@@ -64,6 +64,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuPO> implements
|
||||
// 创建菜单
|
||||
MenuPO menu = new MenuPO();
|
||||
BeanCopyUtils.copyProperties(createMenuDTO, menu);
|
||||
normalizeBlankTabTitle(menu);
|
||||
|
||||
// 设置默认值
|
||||
if (menu.getSuperMenu() == null) {
|
||||
@@ -128,6 +129,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuPO> implements
|
||||
// 更新菜单
|
||||
BeanCopyUtils.copyProperties(updateMenuDTO, existingMenu);
|
||||
existingMenu.setId(id); // 确保ID正确设置
|
||||
normalizeBlankTabTitle(existingMenu);
|
||||
|
||||
// 设置更新人ID
|
||||
existingMenu.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
@@ -432,6 +434,15 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuPO> implements
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* 空白 tabTitle 落库为 null,便于「空则回退 title」语义
|
||||
*/
|
||||
private void normalizeBlankTabTitle(MenuPO menu) {
|
||||
if (menu.getTabTitle() != null && menu.getTabTitle().isBlank()) {
|
||||
menu.setTabTitle(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为VO
|
||||
*/
|
||||
|
||||
+4
@@ -181,6 +181,10 @@ public class UserMenuServiceImpl implements UserMenuService {
|
||||
meta.setId(menu.getId());
|
||||
meta.setParentId(menu.getParentId());
|
||||
meta.setTitle(menu.getTitle());
|
||||
// 标签标题:非空才下发;空则前端回退用 title
|
||||
if (menu.getTabTitle() != null && !menu.getTabTitle().isBlank()) {
|
||||
meta.setTabTitle(menu.getTabTitle().trim());
|
||||
}
|
||||
// 侧栏图标:有 SVG 时写入 meta.icon,供 VbenIcon 优先渲染
|
||||
if (menu.getIconSvg() != null && !menu.getIconSvg().isBlank()) {
|
||||
meta.setIcon(menu.getIconSvg().trim());
|
||||
|
||||
Reference in New Issue
Block a user