|
@@ -6,15 +6,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jiayue.ssi.constant.Constants;
|
|
|
import com.jiayue.ssi.constant.UserConstants;
|
|
|
import com.jiayue.ssi.entity.SysMenu;
|
|
|
-import com.jiayue.ssi.entity.SysParameter;
|
|
|
import com.jiayue.ssi.entity.vo.MetaVo;
|
|
|
import com.jiayue.ssi.entity.vo.RouterVo;
|
|
|
import com.jiayue.ssi.mapper.SysMenuMapper;
|
|
|
-import com.jiayue.ssi.mapper.SysParameterMapper;
|
|
|
import com.jiayue.ssi.service.SysMenuService;
|
|
|
-import com.jiayue.ssi.service.SysParameterService;
|
|
|
import com.jiayue.ssi.util.SecurityContextUtil;
|
|
|
-import com.jiayue.ssi.util.StringUtils;
|
|
|
+import com.jiayue.ssi.util.RyStringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -46,7 +43,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
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()),
|
|
|
+ router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), RyStringUtils.equals("1", menu.getIsCache()),
|
|
|
menu.getPath()));
|
|
|
List<SysMenu> cMenus = menu.getChildren();
|
|
|
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
|
|
@@ -59,9 +56,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
RouterVo children = new RouterVo();
|
|
|
children.setPath(menu.getPath());
|
|
|
children.setComponent(menu.getComponent());
|
|
|
- children.setName(StringUtils.capitalize(menu.getPath()));
|
|
|
+ children.setName(RyStringUtils.capitalize(menu.getPath()));
|
|
|
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(),
|
|
|
- StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
|
|
+ RyStringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
|
|
children.setQuery(menu.getQuery());
|
|
|
childrenList.add(children);
|
|
|
router.setChildren(childrenList);
|
|
@@ -73,7 +70,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
String routerPath = innerLinkReplaceEach(menu.getPath());
|
|
|
children.setPath(routerPath);
|
|
|
children.setComponent(UserConstants.INNER_LINK);
|
|
|
- children.setName(StringUtils.capitalize(routerPath));
|
|
|
+ children.setName(RyStringUtils.capitalize(routerPath));
|
|
|
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
|
|
|
childrenList.add(children);
|
|
|
router.setChildren(childrenList);
|
|
@@ -144,12 +141,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
*/
|
|
|
public String getComponent(SysMenu menu) {
|
|
|
String component = UserConstants.LAYOUT;
|
|
|
- if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) {
|
|
|
+ if (RyStringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) {
|
|
|
component = menu.getComponent();
|
|
|
- } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0
|
|
|
+ } else if (RyStringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0
|
|
|
&& isInnerLink(menu)) {
|
|
|
component = UserConstants.INNER_LINK;
|
|
|
- } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) {
|
|
|
+ } else if (RyStringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) {
|
|
|
component = UserConstants.PARENT_VIEW;
|
|
|
}
|
|
|
return component;
|
|
@@ -172,7 +169,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
* @return 结果
|
|
|
*/
|
|
|
public boolean isInnerLink(SysMenu menu) {
|
|
|
- return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
|
|
|
+ return menu.getIsFrame().equals(UserConstants.NO_FRAME) && RyStringUtils.ishttp(menu.getPath());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -193,10 +190,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
* @return 路由名称
|
|
|
*/
|
|
|
public String getRouteName(SysMenu menu) {
|
|
|
- String routerName = StringUtils.capitalize(menu.getPath());
|
|
|
+ String routerName = RyStringUtils.capitalize(menu.getPath());
|
|
|
// 非外链并且是一级目录(类型为目录)
|
|
|
if (isMenuFrame(menu)) {
|
|
|
- routerName = StringUtils.EMPTY;
|
|
|
+ routerName = RyStringUtils.EMPTY;
|
|
|
}
|
|
|
return routerName;
|
|
|
}
|
|
@@ -266,7 +263,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
* @return 替换后的内链域名
|
|
|
*/
|
|
|
public String innerLinkReplaceEach(String path) {
|
|
|
- return StringUtils.replaceEach(path, new String[] {Constants.HTTP, Constants.HTTPS, Constants.WWW, "."},
|
|
|
+ return RyStringUtils.replaceEach(path, new String[] {Constants.HTTP, Constants.HTTPS, Constants.WWW, "."},
|
|
|
new String[] {"", "", "", "/"});
|
|
|
}
|
|
|
|
|
@@ -278,9 +275,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|
|
*/
|
|
|
@Override
|
|
|
public String checkMenuNameUnique(SysMenu menu) {
|
|
|
- Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
|
|
+ Long menuId = RyStringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
|
|
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
|
|
- if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) {
|
|
|
+ if (RyStringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) {
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
}
|
|
|
return UserConstants.UNIQUE;
|