菜单管理功能加强,新增功能项:是否隐藏菜单(某些页面不需要显示在左侧菜单栏中),是否缓存菜单(可解决切换Tab重新渲染的问题)

pull/127/head
dqjdda 2019-08-27 14:16:37 +08:00
parent e6146cb1c8
commit 8fc04d4af4
5 changed files with 19 additions and 1 deletions

View File

@ -34,6 +34,7 @@ public class Menu implements Serializable {
@NotNull @NotNull
private Long sort; private Long sort;
@NotBlank
@Column(name = "path") @Column(name = "path")
private String path; private String path;
@ -41,6 +42,12 @@ public class Menu implements Serializable {
private String icon; private String icon;
@Column(columnDefinition = "bit(1) default 0")
private Boolean cache;
@Column(columnDefinition = "bit(1) default 0")
private Boolean hidden;
/** /**
* ID * ID
*/ */

View File

@ -15,4 +15,6 @@ public class MenuMetaVo implements Serializable {
private String title; private String title;
private String icon; private String icon;
private Boolean noCache;
} }

View File

@ -19,6 +19,8 @@ public class MenuVo implements Serializable {
private String path; private String path;
private Boolean hidden;
private String redirect; private String redirect;
private String component; private String component;

View File

@ -27,6 +27,10 @@ public class MenuDTO {
private Boolean iFrame; private Boolean iFrame;
private Boolean cache;
private Boolean hidden;
private String icon; private String icon;
private List<MenuDTO> children; private List<MenuDTO> children;

View File

@ -92,6 +92,8 @@ public class MenuServiceImpl implements MenuService {
menu.setIFrame(resources.getIFrame()); menu.setIFrame(resources.getIFrame());
menu.setPid(resources.getPid()); menu.setPid(resources.getPid());
menu.setSort(resources.getSort()); menu.setSort(resources.getSort());
menu.setCache(resources.getCache());
menu.setHidden(resources.getHidden());
menuRepository.save(menu); menuRepository.save(menu);
} }
@ -158,6 +160,7 @@ public class MenuServiceImpl implements MenuService {
MenuVo menuVo = new MenuVo(); MenuVo menuVo = new MenuVo();
menuVo.setName(menuDTO.getName()); menuVo.setName(menuDTO.getName());
menuVo.setPath(menuDTO.getPath()); menuVo.setPath(menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
// 如果不是外链 // 如果不是外链
if(!menuDTO.getIFrame()){ if(!menuDTO.getIFrame()){
@ -169,7 +172,7 @@ public class MenuServiceImpl implements MenuService {
menuVo.setComponent(menuDTO.getComponent()); menuVo.setComponent(menuDTO.getComponent());
} }
} }
menuVo.setMeta(new MenuMetaVo(menuDTO.getName(),menuDTO.getIcon())); menuVo.setMeta(new MenuMetaVo(menuDTO.getName(),menuDTO.getIcon(),!menuDTO.getCache()));
if(menuDTOList!=null && menuDTOList.size()!=0){ if(menuDTOList!=null && menuDTOList.size()!=0){
menuVo.setAlwaysShow(true); menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect"); menuVo.setRedirect("noredirect");