From 81a56229be49d08770f43d10a30b0026965c478f Mon Sep 17 00:00:00 2001 From: Dftre <3066417822@qq.com> Date: Mon, 1 Jul 2024 04:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=E5=88=B0ru?= =?UTF-8?q?oyi=E6=9C=80=E6=96=B0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- ruoyi-admin/pom.xml | 2 +- ruoyi-auth/pom.xml | 2 +- ruoyi-auth/ruoyi-auth-common/pom.xml | 2 +- ruoyi-auth/ruoyi-auth-starter/pom.xml | 2 +- ruoyi-auth/ruoyi-oauth-justauth/pom.xml | 2 +- ruoyi-auth/ruoyi-oauth-wx/pom.xml | 2 +- ruoyi-auth/ruoyi-tfa-email/pom.xml | 2 +- ruoyi-auth/ruoyi-tfa-phone/pom.xml | 2 +- ruoyi-common/pom.xml | 2 +- .../common/core/domain/entity/SysMenu.java | 156 ++++++------- ruoyi-framework/pom.xml | 2 +- ruoyi-middleware/pom.xml | 2 +- .../ruoyi-middleware-minio/pom.xml | 2 +- .../ruoyi-middleware-redis/pom.xml | 2 +- .../ruoyi-middleware-starter/pom.xml | 2 +- ruoyi-models/pom.xml | 4 +- ruoyi-models/ruoyi-generator/pom.xml | 2 +- ruoyi-models/ruoyi-models-starter/pom.xml | 2 +- ruoyi-models/ruoyi-online/pom.xml | 2 +- ruoyi-models/ruoyi-quartz/pom.xml | 2 +- ruoyi-pay/pom.xml | 2 +- ruoyi-pay/ruoyi-pay-alipay/pom.xml | 2 +- ruoyi-pay/ruoyi-pay-common/pom.xml | 2 +- ruoyi-pay/ruoyi-pay-sqb/pom.xml | 2 +- ruoyi-pay/ruoyi-pay-starter/pom.xml | 2 +- ruoyi-pay/ruoyi-pay-wx/pom.xml | 2 +- ruoyi-plugins/pom.xml | 4 +- ruoyi-plugins/ruoyi-ehcache/pom.xml | 2 +- ruoyi-plugins/ruoyi-mybatis-jpa/pom.xml | 2 +- ruoyi-plugins/ruoyi-mybatis-plus/pom.xml | 2 +- ruoyi-plugins/ruoyi-plugins-starter/pom.xml | 2 +- ruoyi-plugins/ruoyi-websocket/pom.xml | 2 +- ruoyi-system/pom.xml | 2 +- .../service/impl/SysMenuServiceImpl.java | 211 +++++++----------- .../resources/mapper/system/SysMenuMapper.xml | 12 +- sql/gen.sql | 14 +- sql/oauth.sql | 24 +- sql/online.sql | 28 +-- sql/pay.sql | 50 ++--- sql/ry_20230223.sql | 159 ++++++------- 41 files changed, 333 insertions(+), 393 deletions(-) diff --git a/pom.xml b/pom.xml index fb5769b..ba27712 100644 --- a/pom.xml +++ b/pom.xml @@ -5,14 +5,14 @@ com.ruoyi ruoyi - 3.8.7.3.4 + 3.8.8.3.1 ruoyi http://www.ruoyi.vip 若依Geek管理系统 - 3.8.7.3.4 + 3.8.8.3.1 UTF-8 UTF-8 17 diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 1d36343..f9e8a19 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 jar diff --git a/ruoyi-auth/pom.xml b/ruoyi-auth/pom.xml index 1091c5b..b40735a 100644 --- a/ruoyi-auth/pom.xml +++ b/ruoyi-auth/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-auth-common/pom.xml b/ruoyi-auth/ruoyi-auth-common/pom.xml index db0109d..42a6b6f 100644 --- a/ruoyi-auth/ruoyi-auth-common/pom.xml +++ b/ruoyi-auth/ruoyi-auth-common/pom.xml @@ -4,7 +4,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-auth-starter/pom.xml b/ruoyi-auth/ruoyi-auth-starter/pom.xml index dd1a0c5..facde56 100644 --- a/ruoyi-auth/ruoyi-auth-starter/pom.xml +++ b/ruoyi-auth/ruoyi-auth-starter/pom.xml @@ -5,7 +5,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-oauth-justauth/pom.xml b/ruoyi-auth/ruoyi-oauth-justauth/pom.xml index 63297cf..bba4daf 100644 --- a/ruoyi-auth/ruoyi-oauth-justauth/pom.xml +++ b/ruoyi-auth/ruoyi-oauth-justauth/pom.xml @@ -4,7 +4,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-oauth-wx/pom.xml b/ruoyi-auth/ruoyi-oauth-wx/pom.xml index d0add5e..f049465 100644 --- a/ruoyi-auth/ruoyi-oauth-wx/pom.xml +++ b/ruoyi-auth/ruoyi-oauth-wx/pom.xml @@ -5,7 +5,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-tfa-email/pom.xml b/ruoyi-auth/ruoyi-tfa-email/pom.xml index 16904d5..ab58de6 100644 --- a/ruoyi-auth/ruoyi-tfa-email/pom.xml +++ b/ruoyi-auth/ruoyi-tfa-email/pom.xml @@ -4,7 +4,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-auth/ruoyi-tfa-phone/pom.xml b/ruoyi-auth/ruoyi-tfa-phone/pom.xml index dd9df67..a6b60a0 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/pom.xml +++ b/ruoyi-auth/ruoyi-tfa-phone/pom.xml @@ -5,7 +5,7 @@ ruoyi-auth com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index a845aac..52edb27 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index 0d859ff..de86bd7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -19,8 +19,7 @@ import jakarta.validation.constraints.Size; * @author ruoyi */ @Schema(title = "菜单权限") -public class SysMenu extends BaseEntity -{ +public class SysMenu extends BaseEntity { private static final long serialVersionUID = 1L; /** 菜单ID */ @@ -55,6 +54,9 @@ public class SysMenu extends BaseEntity @Schema(title = "路由参数") private String query; + /** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */ + private String routeName; + /** 是否为外链(0是 1否) */ @Schema(title = "是否为外链", description = "0是 1否") private String isFrame; @@ -70,7 +72,7 @@ public class SysMenu extends BaseEntity /** 显示状态(0显示 1隐藏) */ @Schema(title = "显示状态", description = "0显示 1隐藏") private String visible; - + /** 菜单状态(0正常 1停用) */ @Schema(title = "菜单状态", description = "0正常 1停用") private String status; @@ -87,194 +89,172 @@ public class SysMenu extends BaseEntity @Schema(title = "子菜单") private List children = new ArrayList(); - public Long getMenuId() - { + public Long getMenuId() { return menuId; } - public void setMenuId(Long menuId) - { + public void setMenuId(Long menuId) { this.menuId = menuId; } @NotBlank(message = "菜单名称不能为空") @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") - public String getMenuName() - { + public String getMenuName() { return menuName; } - public void setMenuName(String menuName) - { + public void setMenuName(String menuName) { this.menuName = menuName; } - public String getParentName() - { + public String getParentName() { return parentName; } - public void setParentName(String parentName) - { + public void setParentName(String parentName) { this.parentName = parentName; } - public Long getParentId() - { + public Long getParentId() { return parentId; } - public void setParentId(Long parentId) - { + public void setParentId(Long parentId) { this.parentId = parentId; } @NotNull(message = "显示顺序不能为空") - public Integer getOrderNum() - { + public Integer getOrderNum() { return orderNum; } - public void setOrderNum(Integer orderNum) - { + public void setOrderNum(Integer orderNum) { this.orderNum = orderNum; } @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") - public String getPath() - { + public String getPath() { return path; } - public void setPath(String path) - { + public void setPath(String path) { this.path = path; } @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") - public String getComponent() - { + public String getComponent() { return component; } - public void setComponent(String component) - { + public void setComponent(String component) { this.component = component; } - public String getQuery() - { + public String getQuery() { return query; } - public void setQuery(String query) - { + public void setQuery(String query) { this.query = query; } - public String getIsFrame() - { + public String getRouteName() { + return routeName; + } + + public void setRouteName(String routeName) { + this.routeName = routeName; + } + + public String getIsFrame() { return isFrame; } - public void setIsFrame(String isFrame) - { + public void setIsFrame(String isFrame) { this.isFrame = isFrame; } - public String getIsCache() - { + public String getIsCache() { return isCache; } - public void setIsCache(String isCache) - { + public void setIsCache(String isCache) { this.isCache = isCache; } @NotBlank(message = "菜单类型不能为空") - public String getMenuType() - { + public String getMenuType() { return menuType; } - public void setMenuType(String menuType) - { + public void setMenuType(String menuType) { this.menuType = menuType; } - public String getVisible() - { + public String getVisible() { return visible; } - public void setVisible(String visible) - { + public void setVisible(String visible) { this.visible = visible; } - public String getStatus() - { + public String getStatus() { return status; } - public void setStatus(String status) - { + public void setStatus(String status) { this.status = status; } @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") - public String getPerms() - { + public String getPerms() { return perms; } - public void setPerms(String perms) - { + public void setPerms(String perms) { this.perms = perms; } - public String getIcon() - { + public String getIcon() { return icon; } - public void setIcon(String icon) - { + public void setIcon(String icon) { this.icon = icon; } - public List getChildren() - { + public List getChildren() { return children; } - public void setChildren(List children) - { + public void setChildren(List children) { this.children = children; } - + @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("menuId", getMenuId()) - .append("menuName", getMenuName()) - .append("parentId", getParentId()) - .append("orderNum", getOrderNum()) - .append("path", getPath()) - .append("component", getComponent()) - .append("isFrame", getIsFrame()) - .append("IsCache", getIsCache()) - .append("menuType", getMenuType()) - .append("visible", getVisible()) - .append("status ", getStatus()) - .append("perms", getPerms()) - .append("icon", getIcon()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("menuId", getMenuId()) + .append("menuName", getMenuName()) + .append("parentId", getParentId()) + .append("orderNum", getOrderNum()) + .append("path", getPath()) + .append("component", getComponent()) + .append("query", getQuery()) + .append("routeName", getRouteName()) + .append("isFrame", getIsFrame()) + .append("IsCache", getIsCache()) + .append("menuType", getMenuType()) + .append("visible", getVisible()) + .append("status ", getStatus()) + .append("perms", getPerms()) + .append("icon", getIcon()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); } } diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 5c21cdb..ec0d561 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-middleware/pom.xml b/ruoyi-middleware/pom.xml index c662a62..20f2140 100644 --- a/ruoyi-middleware/pom.xml +++ b/ruoyi-middleware/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-middleware/ruoyi-middleware-minio/pom.xml b/ruoyi-middleware/ruoyi-middleware-minio/pom.xml index 77aa06c..8510bed 100644 --- a/ruoyi-middleware/ruoyi-middleware-minio/pom.xml +++ b/ruoyi-middleware/ruoyi-middleware-minio/pom.xml @@ -4,7 +4,7 @@ ruoyi-middleware com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-middleware/ruoyi-middleware-redis/pom.xml b/ruoyi-middleware/ruoyi-middleware-redis/pom.xml index 308ec46..10eec4b 100644 --- a/ruoyi-middleware/ruoyi-middleware-redis/pom.xml +++ b/ruoyi-middleware/ruoyi-middleware-redis/pom.xml @@ -4,7 +4,7 @@ ruoyi-middleware com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-middleware/ruoyi-middleware-starter/pom.xml b/ruoyi-middleware/ruoyi-middleware-starter/pom.xml index dce4609..870ca1e 100644 --- a/ruoyi-middleware/ruoyi-middleware-starter/pom.xml +++ b/ruoyi-middleware/ruoyi-middleware-starter/pom.xml @@ -4,7 +4,7 @@ ruoyi-middleware com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-models/pom.xml b/ruoyi-models/pom.xml index a5daf80..9c26324 100644 --- a/ruoyi-models/pom.xml +++ b/ruoyi-models/pom.xml @@ -4,14 +4,14 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 ruoyi-models - 3.8.7.3.4 + 3.8.8.3.1 diff --git a/ruoyi-models/ruoyi-generator/pom.xml b/ruoyi-models/ruoyi-generator/pom.xml index 1297050..a06ab91 100644 --- a/ruoyi-models/ruoyi-generator/pom.xml +++ b/ruoyi-models/ruoyi-generator/pom.xml @@ -5,7 +5,7 @@ ruoyi-models com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-models/ruoyi-models-starter/pom.xml b/ruoyi-models/ruoyi-models-starter/pom.xml index 9c19187..08f9377 100644 --- a/ruoyi-models/ruoyi-models-starter/pom.xml +++ b/ruoyi-models/ruoyi-models-starter/pom.xml @@ -4,7 +4,7 @@ ruoyi-models com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-models/ruoyi-online/pom.xml b/ruoyi-models/ruoyi-online/pom.xml index d794716..bfb1fe6 100644 --- a/ruoyi-models/ruoyi-online/pom.xml +++ b/ruoyi-models/ruoyi-online/pom.xml @@ -5,7 +5,7 @@ ruoyi-models com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-models/ruoyi-quartz/pom.xml b/ruoyi-models/ruoyi-quartz/pom.xml index 7bb470c..496cee0 100644 --- a/ruoyi-models/ruoyi-quartz/pom.xml +++ b/ruoyi-models/ruoyi-quartz/pom.xml @@ -4,7 +4,7 @@ ruoyi-models com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/pom.xml b/ruoyi-pay/pom.xml index 89bb1d1..e93462b 100644 --- a/ruoyi-pay/pom.xml +++ b/ruoyi-pay/pom.xml @@ -4,7 +4,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/ruoyi-pay-alipay/pom.xml b/ruoyi-pay/ruoyi-pay-alipay/pom.xml index c5b1503..af4ccde 100644 --- a/ruoyi-pay/ruoyi-pay-alipay/pom.xml +++ b/ruoyi-pay/ruoyi-pay-alipay/pom.xml @@ -4,7 +4,7 @@ ruoyi-pay com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/ruoyi-pay-common/pom.xml b/ruoyi-pay/ruoyi-pay-common/pom.xml index ee49f7a..725e13b 100644 --- a/ruoyi-pay/ruoyi-pay-common/pom.xml +++ b/ruoyi-pay/ruoyi-pay-common/pom.xml @@ -5,7 +5,7 @@ ruoyi-pay com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/ruoyi-pay-sqb/pom.xml b/ruoyi-pay/ruoyi-pay-sqb/pom.xml index d15e58d..f482079 100644 --- a/ruoyi-pay/ruoyi-pay-sqb/pom.xml +++ b/ruoyi-pay/ruoyi-pay-sqb/pom.xml @@ -5,7 +5,7 @@ ruoyi-pay com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/ruoyi-pay-starter/pom.xml b/ruoyi-pay/ruoyi-pay-starter/pom.xml index 27d88bb..ac7966b 100644 --- a/ruoyi-pay/ruoyi-pay-starter/pom.xml +++ b/ruoyi-pay/ruoyi-pay-starter/pom.xml @@ -5,7 +5,7 @@ ruoyi-pay com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-pay/ruoyi-pay-wx/pom.xml b/ruoyi-pay/ruoyi-pay-wx/pom.xml index ae5a6e4..10da987 100644 --- a/ruoyi-pay/ruoyi-pay-wx/pom.xml +++ b/ruoyi-pay/ruoyi-pay-wx/pom.xml @@ -4,7 +4,7 @@ ruoyi-pay com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-plugins/pom.xml b/ruoyi-plugins/pom.xml index c3949a4..837a95a 100644 --- a/ruoyi-plugins/pom.xml +++ b/ruoyi-plugins/pom.xml @@ -4,14 +4,14 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 ruoyi-plugins - 3.8.7.3.4 + 3.8.8.3.1 3.10.8 3.5.5 diff --git a/ruoyi-plugins/ruoyi-ehcache/pom.xml b/ruoyi-plugins/ruoyi-ehcache/pom.xml index 0c017bf..580286d 100644 --- a/ruoyi-plugins/ruoyi-ehcache/pom.xml +++ b/ruoyi-plugins/ruoyi-ehcache/pom.xml @@ -4,7 +4,7 @@ ruoyi-plugins com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-plugins/ruoyi-mybatis-jpa/pom.xml b/ruoyi-plugins/ruoyi-mybatis-jpa/pom.xml index 4dc40d1..6994e53 100644 --- a/ruoyi-plugins/ruoyi-mybatis-jpa/pom.xml +++ b/ruoyi-plugins/ruoyi-mybatis-jpa/pom.xml @@ -4,7 +4,7 @@ ruoyi-plugins com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-plugins/ruoyi-mybatis-plus/pom.xml b/ruoyi-plugins/ruoyi-mybatis-plus/pom.xml index 263f2c2..b3ab16b 100644 --- a/ruoyi-plugins/ruoyi-mybatis-plus/pom.xml +++ b/ruoyi-plugins/ruoyi-mybatis-plus/pom.xml @@ -4,7 +4,7 @@ ruoyi-plugins com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-plugins/ruoyi-plugins-starter/pom.xml b/ruoyi-plugins/ruoyi-plugins-starter/pom.xml index 74d1b3c..0b4107f 100644 --- a/ruoyi-plugins/ruoyi-plugins-starter/pom.xml +++ b/ruoyi-plugins/ruoyi-plugins-starter/pom.xml @@ -4,7 +4,7 @@ ruoyi-plugins com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-plugins/ruoyi-websocket/pom.xml b/ruoyi-plugins/ruoyi-websocket/pom.xml index 43225d6..66fccdb 100644 --- a/ruoyi-plugins/ruoyi-websocket/pom.xml +++ b/ruoyi-plugins/ruoyi-websocket/pom.xml @@ -4,7 +4,7 @@ ruoyi-plugins com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 21ef483..9bba1f9 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 3.8.7.3.4 + 3.8.8.3.1 4.0.0 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 225c280..f6371e0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -8,8 +8,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.TreeSelect; @@ -31,8 +33,7 @@ import com.ruoyi.system.service.ISysMenuService; * @author ruoyi */ @Service -public class SysMenuServiceImpl implements ISysMenuService -{ +public class SysMenuServiceImpl implements ISysMenuService { public static final String PREMISSION_STRING = "perms[\"{0}\"]"; @Autowired @@ -51,8 +52,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 菜单列表 */ @Override - public List selectMenuList(Long userId) - { + public List selectMenuList(Long userId) { return selectMenuList(new SysMenu(), userId); } @@ -63,16 +63,12 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 菜单列表 */ @Override - public List selectMenuList(SysMenu menu, Long userId) - { + public List selectMenuList(SysMenu menu, Long userId) { List menuList = null; // 管理员显示所有菜单信息 - if (SysUser.isAdmin(userId)) - { + if (SysUser.isAdmin(userId)) { menuList = menuMapper.selectMenuList(menu); - } - else - { + } else { menu.getParams().put("userId", userId); menuList = menuMapper.selectMenuListByUserId(menu); } @@ -86,14 +82,11 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 权限列表 */ @Override - public Set selectMenuPermsByUserId(Long userId) - { + public Set selectMenuPermsByUserId(Long userId) { List perms = menuMapper.selectMenuPermsByUserId(userId); Set permsSet = new HashSet<>(); - for (String perm : perms) - { - if (StringUtils.isNotEmpty(perm)) - { + for (String perm : perms) { + if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } @@ -107,14 +100,11 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 权限列表 */ @Override - public Set selectMenuPermsByRoleId(Long roleId) - { + public Set selectMenuPermsByRoleId(Long roleId) { List perms = menuMapper.selectMenuPermsByRoleId(roleId); Set permsSet = new HashSet<>(); - for (String perm : perms) - { - if (StringUtils.isNotEmpty(perm)) - { + for (String perm : perms) { + if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } @@ -128,15 +118,11 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 菜单列表 */ @Override - public List selectMenuTreeByUserId(Long userId) - { + public List selectMenuTreeByUserId(Long userId) { List menus = null; - if (SecurityUtils.isAdmin(userId)) - { + if (SecurityUtils.isAdmin(userId)) { menus = menuMapper.selectMenuTreeAll(); - } - else - { + } else { menus = menuMapper.selectMenuTreeByUserId(userId); } return getChildPerms(menus, 0); @@ -149,8 +135,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 选中菜单列表 */ @Override - public List selectMenuListByRoleId(Long roleId) - { + public List selectMenuListByRoleId(Long roleId) { SysRole role = roleMapper.selectRoleById(roleId); return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); } @@ -162,40 +147,35 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 路由列表 */ @Override - public List buildMenus(List menus) - { + public List buildMenus(List menus) { List routers = new LinkedList(); - for (SysMenu menu : menus) - { + for (SysMenu menu : menus) { RouterVo router = new RouterVo(); router.setHidden("1".equals(menu.getVisible())); router.setName(getRouteName(menu)); router.setPath(getRouterPath(menu)); router.setComponent(getComponent(menu)); router.setQuery(menu.getQuery()); - router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), + menu.getPath())); List cMenus = menu.getChildren(); - if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) - { + if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { router.setAlwaysShow(true); router.setRedirect("noRedirect"); router.setChildren(buildMenus(cMenus)); - } - else if (isMenuFrame(menu)) - { + } else if (isMenuFrame(menu)) { router.setMeta(null); List childrenList = new ArrayList(); RouterVo children = new RouterVo(); children.setPath(menu.getPath()); children.setComponent(menu.getComponent()); - children.setName(StringUtils.capitalize(menu.getPath())); - children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + children.setName(getRouteName(menu.getRouteName(), menu.getPath())); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), + StringUtils.equals("1", menu.getIsCache()), menu.getPath())); children.setQuery(menu.getQuery()); childrenList.add(children); router.setChildren(childrenList); - } - else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) - { + } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); router.setPath("/"); List childrenList = new ArrayList(); @@ -203,7 +183,7 @@ public class SysMenuServiceImpl implements ISysMenuService String routerPath = innerLinkReplaceEach(menu.getPath()); children.setPath(routerPath); children.setComponent(UserConstants.INNER_LINK); - children.setName(StringUtils.capitalize(routerPath)); + children.setName(getRouteName(menu.getRouteName(), routerPath)); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); childrenList.add(children); router.setChildren(childrenList); @@ -220,22 +200,18 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 树结构列表 */ @Override - public List buildMenuTree(List menus) - { + public List buildMenuTree(List menus) { List returnList = new ArrayList(); List tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); - for (Iterator iterator = menus.iterator(); iterator.hasNext();) - { + for (Iterator iterator = menus.iterator(); iterator.hasNext();) { SysMenu menu = (SysMenu) iterator.next(); // 如果是顶级节点, 遍历该父节点的所有子节点 - if (!tempList.contains(menu.getParentId())) - { + if (!tempList.contains(menu.getParentId())) { recursionFn(menus, menu); returnList.add(menu); } } - if (returnList.isEmpty()) - { + if (returnList.isEmpty()) { returnList = menus; } return returnList; @@ -248,8 +224,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 下拉树结构列表 */ @Override - public List buildMenuTreeSelect(List menus) - { + public List buildMenuTreeSelect(List menus) { List menuTrees = buildMenuTree(menus); return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); } @@ -261,8 +236,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 菜单信息 */ @Override - public SysMenu selectMenuById(Long menuId) - { + public SysMenu selectMenuById(Long menuId) { return menuMapper.selectMenuById(menuId); } @@ -273,8 +247,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public boolean hasChildByMenuId(Long menuId) - { + public boolean hasChildByMenuId(Long menuId) { int result = menuMapper.hasChildByMenuId(menuId); return result > 0; } @@ -286,8 +259,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public boolean checkMenuExistRole(Long menuId) - { + public boolean checkMenuExistRole(Long menuId) { int result = roleMenuMapper.checkMenuExistRole(menuId); return result > 0; } @@ -299,8 +271,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public int insertMenu(SysMenu menu) - { + public int insertMenu(SysMenu menu) { return menuMapper.insertMenu(menu); } @@ -311,8 +282,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public int updateMenu(SysMenu menu) - { + public int updateMenu(SysMenu menu) { return menuMapper.updateMenu(menu); } @@ -323,8 +293,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public int deleteMenuById(Long menuId) - { + public int deleteMenuById(Long menuId) { return menuMapper.deleteMenuById(menuId); } @@ -335,12 +304,10 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public boolean checkMenuNameUnique(SysMenu menu) - { + public boolean checkMenuNameUnique(SysMenu menu) { Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); - if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) - { + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -352,15 +319,24 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 路由名称 */ - public String getRouteName(SysMenu menu) - { - String routerName = StringUtils.capitalize(menu.getPath()); + public String getRouteName(SysMenu menu) { // 非外链并且是一级目录(类型为目录) - if (isMenuFrame(menu)) - { - routerName = StringUtils.EMPTY; + if (isMenuFrame(menu)) { + return StringUtils.EMPTY; } - return routerName; + return getRouteName(menu.getRouteName(), menu.getPath()); + } + + /** + * 获取路由名称,如没有配置路由名称则取路由地址 + * + * @param routerName 路由名称 + * @param path 路由地址 + * @return 路由名称(驼峰格式) + */ + public String getRouteName(String name, String path) { + String routerName = StringUtils.isNotEmpty(name) ? name : path; + return StringUtils.capitalize(routerName); } /** @@ -369,23 +345,19 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 路由地址 */ - public String getRouterPath(SysMenu menu) - { + public String getRouterPath(SysMenu menu) { String routerPath = menu.getPath(); // 内链打开外网方式 - if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) - { + if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { routerPath = innerLinkReplaceEach(routerPath); } // 非外链并且是一级目录(类型为目录) if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) - && UserConstants.NO_FRAME.equals(menu.getIsFrame())) - { + && UserConstants.NO_FRAME.equals(menu.getIsFrame())) { routerPath = "/" + menu.getPath(); } // 非外链并且是一级目录(类型为菜单) - else if (isMenuFrame(menu)) - { + else if (isMenuFrame(menu)) { routerPath = "/"; } return routerPath; @@ -397,19 +369,14 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 组件信息 */ - public String getComponent(SysMenu menu) - { + public String getComponent(SysMenu menu) { String component = UserConstants.LAYOUT; - if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) - { + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { component = menu.getComponent(); - } - else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) - { + } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 + && isInnerLink(menu)) { component = UserConstants.INNER_LINK; - } - else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) - { + } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { component = UserConstants.PARENT_VIEW; } return component; @@ -421,8 +388,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 结果 */ - public boolean isMenuFrame(SysMenu menu) - { + public boolean isMenuFrame(SysMenu menu) { return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) && menu.getIsFrame().equals(UserConstants.NO_FRAME); } @@ -433,8 +399,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 结果 */ - public boolean isInnerLink(SysMenu menu) - { + public boolean isInnerLink(SysMenu menu) { return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); } @@ -444,27 +409,23 @@ public class SysMenuServiceImpl implements ISysMenuService * @param menu 菜单信息 * @return 结果 */ - public boolean isParentView(SysMenu menu) - { + public boolean isParentView(SysMenu menu) { return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); } /** * 根据父节点的ID获取所有子节点 * - * @param list 分类表 + * @param list 分类表 * @param parentId 传入的父节点ID * @return String */ - public List getChildPerms(List list, int parentId) - { + public List getChildPerms(List list, int parentId) { List returnList = new ArrayList(); - for (Iterator iterator = list.iterator(); iterator.hasNext();) - { + for (Iterator iterator = list.iterator(); iterator.hasNext();) { SysMenu t = (SysMenu) iterator.next(); // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 - if (t.getParentId() == parentId) - { + if (t.getParentId() == parentId) { recursionFn(list, t); returnList.add(t); } @@ -476,17 +437,14 @@ public class SysMenuServiceImpl implements ISysMenuService * 递归列表 * * @param list 分类表 - * @param t 子节点 + * @param t 子节点 */ - private void recursionFn(List list, SysMenu t) - { + private void recursionFn(List list, SysMenu t) { // 得到子节点列表 List childList = getChildList(list, t); t.setChildren(childList); - for (SysMenu tChild : childList) - { - if (hasChild(list, tChild)) - { + for (SysMenu tChild : childList) { + if (hasChild(list, tChild)) { recursionFn(list, tChild); } } @@ -495,15 +453,12 @@ public class SysMenuServiceImpl implements ISysMenuService /** * 得到子节点列表 */ - private List getChildList(List list, SysMenu t) - { + private List getChildList(List list, SysMenu t) { List tlist = new ArrayList(); Iterator it = list.iterator(); - while (it.hasNext()) - { + while (it.hasNext()) { SysMenu n = (SysMenu) it.next(); - if (n.getParentId().longValue() == t.getMenuId().longValue()) - { + if (n.getParentId().longValue() == t.getMenuId().longValue()) { tlist.add(n); } } @@ -513,8 +468,7 @@ public class SysMenuServiceImpl implements ISysMenuService /** * 判断是否有子节点 */ - private boolean hasChild(List list, SysMenu t) - { + private boolean hasChild(List list, SysMenu t) { return getChildList(list, t).size() > 0; } @@ -523,8 +477,7 @@ public class SysMenuServiceImpl implements ISysMenuService * * @return 替换后的内链域名 */ - public String innerLinkReplaceEach(String path) - { + public String innerLinkReplaceEach(String path) { return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." }, new String[] { "", "", "", "/" }); } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index 6762007..84e87c9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -13,6 +13,7 @@ + @@ -28,7 +29,7 @@ - select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time + select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time from sys_menu @@ -49,13 +50,13 @@