调整代码结构,增加业务菜单启动创建接口
This commit is contained in:
parent
a98f42d773
commit
c125c250ae
@ -0,0 +1,23 @@
|
||||
package ink.wgink.interfaces.init.build;
|
||||
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IInitServiceMenu
|
||||
* @Description: 构建业务菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:09
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IBuildServiceMenu {
|
||||
|
||||
/**
|
||||
* 构建菜单
|
||||
*
|
||||
* @param initMenus
|
||||
*/
|
||||
void buildMenu(List<InitMenuBO> initMenus);
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package ink.wgink.pojo.bos.menu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: InitMenuBO
|
||||
* @Description: 初始化菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:03
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class InitMenuBO {
|
||||
|
||||
private String menuCode;
|
||||
private String menuName;
|
||||
private String menuSummary;
|
||||
private String menuUrl;
|
||||
private Integer menuType;
|
||||
private String menuIcon;
|
||||
private List<InitMenuBO> subMenus;
|
||||
|
||||
public String getMenuCode() {
|
||||
return menuCode == null ? "" : menuCode.trim();
|
||||
}
|
||||
|
||||
public void setMenuCode(String menuCode) {
|
||||
this.menuCode = menuCode;
|
||||
}
|
||||
|
||||
public String getMenuName() {
|
||||
return menuName == null ? "" : menuName.trim();
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getMenuSummary() {
|
||||
return menuSummary == null ? "" : menuSummary.trim();
|
||||
}
|
||||
|
||||
public void setMenuSummary(String menuSummary) {
|
||||
this.menuSummary = menuSummary;
|
||||
}
|
||||
|
||||
public String getMenuUrl() {
|
||||
return menuUrl == null ? "javascript:void(0);" : menuUrl.trim();
|
||||
}
|
||||
|
||||
public void setMenuUrl(String menuUrl) {
|
||||
this.menuUrl = menuUrl;
|
||||
}
|
||||
|
||||
public Integer getMenuType() {
|
||||
return menuType == null ? 1 : menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(Integer menuType) {
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getMenuIcon() {
|
||||
return menuIcon == null ? "fa-icon-color-white fa fa-list" : menuIcon.trim();
|
||||
}
|
||||
|
||||
public void setMenuIcon(String menuIcon) {
|
||||
this.menuIcon = menuIcon;
|
||||
}
|
||||
|
||||
public List<InitMenuBO> getSubMenus() {
|
||||
return subMenus == null ? new ArrayList() : subMenus;
|
||||
}
|
||||
|
||||
public void setSubMenus(List<InitMenuBO> subMenus) {
|
||||
this.subMenus = subMenus;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ink.wgink.common.controller.api.access;
|
||||
|
||||
import ink.wgink.common.pojo.vos.access.WhiteListVO;
|
||||
import ink.wgink.common.service.access.IWhiteListService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: ConfigController
|
||||
* @Description: 系统配置
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/20 10:28
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "白名单")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/access/white-list")
|
||||
public class WhiteListController {
|
||||
|
||||
@Autowired
|
||||
private IWhiteListService whiteListService;
|
||||
|
||||
@ApiOperation(value = "保存白名单", notes = "保存白名单接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update")
|
||||
public SuccessResult update(@RequestBody WhiteListVO whiteListVO) {
|
||||
whiteListService.update(whiteListVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取白名单列表", notes = "获取白名单列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<String> list() {
|
||||
return whiteListService.list();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package ink.wgink.common.controller.route.access;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: ConfigRouteController
|
||||
* @Description: 配置
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/25 21:44
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "白名单路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/access/white-list")
|
||||
public class WhiteListRouteController {
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
ModelAndView mv = new ModelAndView("access/white-list/update");
|
||||
return mv;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package ink.wgink.common.dao.access;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IWhiteListDao
|
||||
* @Description: 白名单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 14:05
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IWhiteListDao extends IInitBaseTable {
|
||||
|
||||
/**
|
||||
* 保存白名单
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除白名单
|
||||
*
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete() throws RemoveException;
|
||||
|
||||
/**
|
||||
* 白名单列表
|
||||
*
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> list() throws SearchException;
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package ink.wgink.common.manager.access;
|
||||
|
||||
import ink.wgink.common.dao.access.IWhiteListDao;
|
||||
import ink.wgink.properties.BaseProperties;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @ClassName: WhiteListManager
|
||||
* @Description: 白名单管理
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 11:18
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class WhiteListManager {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WhiteListManager.class);
|
||||
private static WhiteListManager whiteListManager = WhiteListManagerBuilder.whiteListManager;
|
||||
private BaseProperties baseProperties;
|
||||
private IWhiteListDao whiteListDao;
|
||||
private Set<String> whiteListSet = new HashSet<>();
|
||||
private AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
|
||||
private WhiteListManager() {
|
||||
|
||||
}
|
||||
|
||||
public static WhiteListManager getInstance() {
|
||||
return whiteListManager;
|
||||
}
|
||||
|
||||
public Set<String> getWhiteListSet() {
|
||||
return whiteListSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否匹配
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public boolean isMatch(String path) {
|
||||
for (String whiteList : whiteListSet) {
|
||||
if (antPathMatcher.match(whiteList, path)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新白名单
|
||||
*/
|
||||
public void refreshWhiteList() {
|
||||
whiteListSet.clear();
|
||||
addBaseList();
|
||||
// 加载数据库配置
|
||||
whiteListSet.addAll(whiteListDao.list());
|
||||
}
|
||||
|
||||
private void addBaseList() {
|
||||
whiteListSet.add(baseProperties.getLoginUrl());
|
||||
whiteListSet.add(baseProperties.getLoginProcess());
|
||||
whiteListSet.add(baseProperties.getLoginFailure());
|
||||
whiteListSet.add("/oauth/**");
|
||||
whiteListSet.add("/oauth2_client/**");
|
||||
whiteListSet.add("/app/**");
|
||||
whiteListSet.add("/approute/**");
|
||||
whiteListSet.add("/wechat/**");
|
||||
whiteListSet.add("/wechat-miniapp/**");
|
||||
whiteListSet.add("/api/sms/getverificationcode/*");
|
||||
whiteListSet.add("/api/user/getsignintype/**");
|
||||
whiteListSet.add("/assets/**");
|
||||
whiteListSet.add("/page/**");
|
||||
whiteListSet.add("/route/file/**");
|
||||
whiteListSet.add("/static-files/**");
|
||||
whiteListSet.add("/web/**");
|
||||
|
||||
String assetsMatchers = baseProperties.getAssetsMatchers();
|
||||
// 资源
|
||||
if (!StringUtils.isBlank(assetsMatchers)) {
|
||||
String[] assetsMatchersArray = baseProperties.getAssetsMatchers().split(",");
|
||||
for (String assetsMatcher : assetsMatchersArray) {
|
||||
whiteListSet.add(assetsMatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBaseProperties(BaseProperties baseProperties) {
|
||||
this.baseProperties = baseProperties;
|
||||
}
|
||||
|
||||
public void setWhiteListDao(IWhiteListDao whiteListDao) {
|
||||
this.whiteListDao = whiteListDao;
|
||||
}
|
||||
|
||||
private static class WhiteListManagerBuilder {
|
||||
public static WhiteListManager whiteListManager = new WhiteListManager();
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ink.wgink.common.pojo.vos.access;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: WhiteListVO
|
||||
* @Description: 白名单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 14:25
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@ApiModel
|
||||
public class WhiteListVO {
|
||||
|
||||
@ApiModelProperty(name = "pathMatchers", value = "匹配路径")
|
||||
private List<String> pathMatchers;
|
||||
|
||||
public List<String> getPathMatchers() {
|
||||
return pathMatchers == null ? new ArrayList() : pathMatchers;
|
||||
}
|
||||
|
||||
public void setPathMatchers(List<String> pathMatchers) {
|
||||
this.pathMatchers = pathMatchers;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package ink.wgink.common.service.access;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @ClassName: IAccessWhiteListService
|
||||
* @Description: 访问白名单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 11:02
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IAccessService {
|
||||
|
||||
boolean hasPermission(HttpServletRequest request, Authentication authentication);
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package ink.wgink.common.service.access;
|
||||
|
||||
|
||||
import ink.wgink.common.pojo.vos.access.WhiteListVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IWhiteListService
|
||||
* @Description: 白名单业务
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 14:10
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IWhiteListService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param whiteListVO
|
||||
*/
|
||||
void update(WhiteListVO whiteListVO);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> list();
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ink.wgink.common.service.access.impl;
|
||||
|
||||
import ink.wgink.common.manager.access.WhiteListManager;
|
||||
import ink.wgink.common.service.access.IAccessService;
|
||||
import ink.wgink.common.service.rbac.IRbacService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @ClassName: AccessWhiteListServiceImpl
|
||||
* @Description: 访问白名单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 11:03
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service("accessWhiteList")
|
||||
public class AccessServiceImpl implements IAccessService {
|
||||
|
||||
@Autowired
|
||||
private IRbacService rbacService;
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(HttpServletRequest request, Authentication authentication) {
|
||||
boolean isAccess = WhiteListManager.getInstance().isMatch(request.getRequestURI().replace(request.getContextPath(), ""));
|
||||
if (isAccess) {
|
||||
return true;
|
||||
}
|
||||
return rbacService.hasPermission(request, authentication);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package ink.wgink.common.service.access.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.common.dao.access.IWhiteListDao;
|
||||
import ink.wgink.common.manager.access.WhiteListManager;
|
||||
import ink.wgink.common.pojo.vos.access.WhiteListVO;
|
||||
import ink.wgink.common.service.access.IWhiteListService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: WhiteListServiceImpl
|
||||
* @Description: 白名单业务
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/27 14:11
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class WhiteListServiceImpl extends DefaultBaseService implements IWhiteListService {
|
||||
|
||||
@Autowired
|
||||
private IWhiteListDao whiteListDao;
|
||||
|
||||
@Override
|
||||
public void update(WhiteListVO whiteListVO) {
|
||||
List<String> pathMatchers = whiteListVO.getPathMatchers();
|
||||
whiteListDao.delete();
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
for (String pathMatcher : pathMatchers) {
|
||||
if (StringUtils.isBlank(pathMatcher)) {
|
||||
continue;
|
||||
}
|
||||
params.put("pathMatcher", pathMatcher);
|
||||
whiteListDao.save(params);
|
||||
}
|
||||
WhiteListManager.getInstance().refreshWhiteList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> list() {
|
||||
return whiteListDao.list();
|
||||
}
|
||||
}
|
@ -1,12 +1,17 @@
|
||||
package ink.wgink.common.startup;
|
||||
|
||||
import ink.wgink.common.dao.access.IWhiteListDao;
|
||||
import ink.wgink.common.dao.env.IEnvDao;
|
||||
import ink.wgink.common.manager.access.WhiteListManager;
|
||||
import ink.wgink.common.manager.env.EnvManager;
|
||||
import ink.wgink.interfaces.init.IInitBaseMenu;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import ink.wgink.interfaces.init.IInitBaseUser;
|
||||
import ink.wgink.interfaces.init.IInitMongoData;
|
||||
import ink.wgink.properties.BaseProperties;
|
||||
import ink.wgink.properties.ServerProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
@ -27,19 +32,23 @@ import java.util.Map;
|
||||
**/
|
||||
@Component
|
||||
public class CommonStartup implements ApplicationRunner {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CommonStartup.class);
|
||||
private ApplicationContext applicationContext;
|
||||
@Autowired
|
||||
private ServerProperties serverProperties;
|
||||
@Autowired
|
||||
private BaseProperties baseProperties;
|
||||
@Autowired(required = false)
|
||||
private IInitBaseMenu initBaseMenu;
|
||||
@Autowired(required = false)
|
||||
private IInitBaseUser initBaseUser;
|
||||
private IEnvDao envDao;
|
||||
private IWhiteListDao whiteListDao;
|
||||
|
||||
public CommonStartup(ApplicationContext applicationContext, IEnvDao envDao) {
|
||||
public CommonStartup(ApplicationContext applicationContext, IEnvDao envDao, IWhiteListDao whiteListDao) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.envDao = envDao;
|
||||
this.whiteListDao = whiteListDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,10 +70,16 @@ public class CommonStartup implements ApplicationRunner {
|
||||
* 初始化管理器
|
||||
*/
|
||||
private void initManager() {
|
||||
// 初始化环境变量
|
||||
LOG.debug(">>>>>> 初始化环境变量");
|
||||
EnvManager envManager = EnvManager.getInstance();
|
||||
envManager.setEnvDao(envDao);
|
||||
envManager.refreshEnv();
|
||||
|
||||
LOG.debug(">>>>>> 初始化白名单");
|
||||
WhiteListManager whiteListManager = WhiteListManager.getInstance();
|
||||
whiteListManager.setBaseProperties(baseProperties);
|
||||
whiteListManager.setWhiteListDao(whiteListDao);
|
||||
whiteListManager.refreshWhiteList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.common.dao.access.IWhiteListDao">
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_white_list` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`path_matcher` varchar(255) DEFAULT NULL COMMENT '路径匹配',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='白名单';
|
||||
</update>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO sys_white_list(
|
||||
path_matcher
|
||||
) VALUES(
|
||||
#{pathMatcher}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="delete">
|
||||
DELETE FROM sys_white_list
|
||||
</delete>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="list" resultType="java.lang.String">
|
||||
SELECT
|
||||
path_matcher
|
||||
FROM
|
||||
sys_white_list
|
||||
</select>
|
||||
</mapper>
|
@ -2,8 +2,6 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.common.dao.env.IEnvDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="envDTO" type="ink.wgink.common.pojo.dtos.env.EnvDTO">
|
||||
<result column="env_key" property="envKey"/>
|
||||
<result column="env_explain" property="envExplain"/>
|
||||
@ -22,7 +20,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 新增环境变量 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO sys_env(
|
||||
env_key,
|
||||
env_explain,
|
||||
@ -35,12 +33,12 @@
|
||||
</insert>
|
||||
|
||||
<!-- 删除环境变量 -->
|
||||
<delete id="delete" parameterType="map" flushCache="true">
|
||||
<delete id="delete" parameterType="map">
|
||||
DELETE FROM sys_env
|
||||
</delete>
|
||||
|
||||
<!-- 更新环境变量 -->
|
||||
<update id="update" parameterType="map" flushCache="true">
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
sys_env
|
||||
SET
|
||||
@ -51,7 +49,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 环境变量列表 -->
|
||||
<select id="list" resultMap="envDTO" useCache="true">
|
||||
<select id="list" resultMap="envDTO">
|
||||
SELECT
|
||||
env_key,
|
||||
env_explain,
|
||||
@ -61,7 +59,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 获取环境变量 -->
|
||||
<select id="get" parameterType="String" resultMap="envDTO" useCache="true">
|
||||
<select id="get" parameterType="String" resultMap="envDTO">
|
||||
SELECT
|
||||
env_key,
|
||||
env_explain,
|
@ -0,0 +1,182 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<form class="layui-form" lay-filter="dataForm">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-sm8 layui-col-xs12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a href="javascript:void(0);"><cite>白名单(符合AndMatcher规则)</cite></a>
|
||||
</span>
|
||||
<button id="whiteListPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="cardBody" class="layui-card-body" style="padding: 15px; overflow: auto">
|
||||
<div class="layui-form-item">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="60">
|
||||
<col>
|
||||
<col width="60">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>开放路径</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="whiteListBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交更新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var $win = $(window);
|
||||
var windowHeight = $(window).height();
|
||||
|
||||
$('#cardBody').css({
|
||||
height: (windowHeight - 170) +'px'
|
||||
})
|
||||
|
||||
var whiteList;
|
||||
|
||||
// 系统参数配置
|
||||
function WhiteListInit(idPrefix, classPrefix, pathMatchers) {
|
||||
var pathMatcherArray = [];
|
||||
|
||||
function getTr(index, pathMatcher) {
|
||||
return '<tr>' +
|
||||
' <td style="text-align: center;">'+ (index + 1) +'</td>'+
|
||||
' <td>' +
|
||||
' <input type="text" id="'+ idPrefix +'Key'+ index +'" placeholder="输入放行路径" class="layui-input '+ classPrefix +'-key" value="'+ (pathMatcher ? pathMatcher : '') +'" data-index="'+ index +'">' +
|
||||
' </td>' +
|
||||
' <td style="text-align: center;">' +
|
||||
' <button type="button" class="layui-btn layui-btn-xs layui-btn-danger '+ classPrefix +'-remove-btn" data-index="'+ index +'">' +
|
||||
' <i class="fa fa-times" aria-hidden="true"></i>' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
function refreshTr() {
|
||||
var trs = '';
|
||||
for(var i = 0; i < pathMatcherArray.length; i++) {
|
||||
var item = pathMatcherArray[i];
|
||||
trs += getTr(i, item);
|
||||
}
|
||||
$('#'+ idPrefix +'Body').empty();
|
||||
$('#'+ idPrefix +'Body').append(trs);
|
||||
}
|
||||
|
||||
$(document).on('keyup', '.'+ classPrefix +'-key', function() {
|
||||
var index = this.dataset.index;
|
||||
this.value = this.value.replace(/\s/g, '');
|
||||
pathMatcherArray[index] = this.value;
|
||||
});
|
||||
|
||||
$(document).on('click', '#'+ idPrefix +'PlusBtn', function() {
|
||||
pathMatcherArray.push('');
|
||||
refreshTr();
|
||||
})
|
||||
|
||||
$(document).on('click', '.'+ classPrefix +'-remove-btn', function() {
|
||||
var index = this.dataset.index;
|
||||
pathMatcherArray.splice(index, 1);
|
||||
refreshTr();
|
||||
})
|
||||
|
||||
this.init = function() {
|
||||
if(!pathMatchers) {
|
||||
return;
|
||||
}
|
||||
for(var i = 0, item; item = pathMatchers[i++];) {
|
||||
pathMatcherArray.push(item)
|
||||
}
|
||||
refreshTr();
|
||||
}
|
||||
this.list = function() {
|
||||
return pathMatcherArray;
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/access/white-list/list', []), {}, null, function(code, data) {
|
||||
whiteList = new WhiteListInit('whiteList', 'white-list', data);
|
||||
whiteList.init();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
console.log(whiteList.list())
|
||||
top.restAjax.put(top.restAjax.path('api/access/white-list/update', []), {
|
||||
pathMatchers: whiteList.list()
|
||||
}, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg('更新成功', {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -2,7 +2,6 @@ package ink.wgink.login.base.controller.route.config;
|
||||
|
||||
import ink.wgink.interfaces.app.IAppSignBaseService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.login.base.manager.ConfigManager;
|
||||
import ink.wgink.login.base.service.IDingDingService;
|
||||
import ink.wgink.login.base.service.IUKeyService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -12,8 +11,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -24,7 +21,7 @@ import java.util.Map;
|
||||
* @Date: 2021/2/25 21:44
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "配置接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "配置路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/config")
|
||||
public class ConfigRouteController {
|
||||
|
@ -9,8 +9,6 @@ import ink.wgink.login.base.security.user.UserSecurityConfig;
|
||||
import ink.wgink.login.base.service.user.UserDetailServiceImpl;
|
||||
import ink.wgink.login.base.service.user.UserLoginService;
|
||||
import ink.wgink.properties.BaseProperties;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
@ -57,23 +55,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
baseProperties.getLoginFailure(),
|
||||
"/oauth/**",
|
||||
"/oauth2_client/**",
|
||||
"/app/**",
|
||||
"/approute/**",
|
||||
"/wechat/**",
|
||||
"/wechat-miniapp/**",
|
||||
"/route/file/**",
|
||||
"/api/sms/getverificationcode/*",
|
||||
"/api/user/getsignintype/**"
|
||||
};
|
||||
String assetsMatchers = baseProperties.getAssetsMatchers();
|
||||
String[] fullAntMatchers;
|
||||
if (!StringUtils.isBlank(assetsMatchers)) {
|
||||
String[] assetsMatchersArray = baseProperties.getAssetsMatchers().split(",");
|
||||
fullAntMatchers = ArrayUtils.addAll(defaultAntMatchers, assetsMatchersArray);
|
||||
} else {
|
||||
fullAntMatchers = defaultAntMatchers;
|
||||
}
|
||||
|
||||
LoginFailureHandler loginFailureHandler = new LoginFailureHandler(baseProperties.getLoginFailure());
|
||||
http
|
||||
.formLogin()
|
||||
@ -90,11 +72,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.disable()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers(fullAntMatchers)
|
||||
.antMatchers(defaultAntMatchers)
|
||||
.permitAll()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.anyRequest().access("@rbacService.hasPermission(request, authentication)")
|
||||
.anyRequest().access("@accessWhiteList.hasPermission(request, authentication)")
|
||||
.and()
|
||||
.exceptionHandling().accessDeniedHandler(new AccessDenyHandler())
|
||||
.and()
|
||||
|
@ -23,16 +23,15 @@ import org.springframework.stereotype.Component;
|
||||
public class LoginBaseStartUp implements ApplicationRunner {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LoginBaseStartUp.class);
|
||||
|
||||
@Autowired
|
||||
private IConfigDao configDao;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
LOG.debug("初始化配置");
|
||||
LOG.debug(">>>>>> 初始化配置");
|
||||
ConfigManager configManager = ConfigManager.getInstance();
|
||||
configManager.setConfigDao(configDao);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.login.base.dao.config.IConfigDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="configDTO" type="ink.wgink.login.base.pojo.dtos.config.ConfigDTO">
|
||||
<result property="configKey" column="config_key"/>
|
||||
<result property="configValue" column="config_value"/>
|
||||
@ -19,7 +17,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 新增配置 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO sys_config(
|
||||
config_key,
|
||||
config_value
|
||||
@ -30,7 +28,7 @@
|
||||
</insert>
|
||||
|
||||
<!-- 更新配置 -->
|
||||
<update id="update" parameterType="map" flushCache="true">
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
sys_config
|
||||
SET
|
||||
@ -40,7 +38,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 配置列表 -->
|
||||
<select id="list" resultMap="configDTO" useCache="true">
|
||||
<select id="list" resultMap="configDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -48,7 +46,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 获取配置 -->
|
||||
<select id="get" parameterType="String" resultMap="configDTO" useCache="true">
|
||||
<select id="get" parameterType="String" resultMap="configDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
|
@ -0,0 +1,42 @@
|
||||
package ink.wgink.module.dictionary.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildDataMenu
|
||||
* @Description: 构建字典菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/30 15:57
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildDataMenu implements IBuildServiceMenu {
|
||||
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取系统管理
|
||||
InitMenuBO parentMenu = initMenus.get(0);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("数据字典");
|
||||
initMenu.setMenuSummary("数据字典");
|
||||
initMenu.setMenuUrl("/route/data/list-tree");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-list");
|
||||
subMenus.add(initMenu);
|
||||
|
||||
initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("行政区划");
|
||||
initMenu.setMenuSummary("行政区划");
|
||||
initMenu.setMenuUrl("/route/area/list-tree");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-list");
|
||||
subMenus.add(initMenu);
|
||||
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ink.wgink.service.department.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildDepartmentMenu
|
||||
* @Description: 构建部门菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:21
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildDepartmentMenu implements IBuildServiceMenu {
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取用户管理
|
||||
InitMenuBO parentMenu = initMenus.get(1);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("机构部门管理");
|
||||
initMenu.setMenuSummary("机构部门管理");
|
||||
initMenu.setMenuUrl("/route/department/list-tree");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-bank");
|
||||
subMenus.add(initMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package ink.wgink.service.group.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildGroupMenu
|
||||
* @Description: 构建用户组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:24
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Order
|
||||
@Component
|
||||
public class BuildGroupMenu implements IBuildServiceMenu {
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取用户管理
|
||||
InitMenuBO parentMenu = initMenus.get(1);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("用户组管理");
|
||||
initMenu.setMenuSummary("用户组管理");
|
||||
initMenu.setMenuUrl("/route/group/list-tree");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-users");
|
||||
subMenus.add(initMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -1,28 +1,25 @@
|
||||
package ink.wgink.module.menu.init;
|
||||
|
||||
import ink.wgink.interfaces.app.IAppSignBaseService;
|
||||
import ink.wgink.interfaces.article.IArticleCheckService;
|
||||
import ink.wgink.interfaces.config.ISystemConfigCheckService;
|
||||
import ink.wgink.interfaces.department.IDepartmentCheckService;
|
||||
import ink.wgink.interfaces.dictionary.IDictionaryCheckService;
|
||||
import ink.wgink.interfaces.group.IGroupCheckService;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import ink.wgink.interfaces.init.IInitBaseMenu;
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||
import ink.wgink.interfaces.permission.IPermissionCheckService;
|
||||
import ink.wgink.interfaces.position.IPositionCheckService;
|
||||
import ink.wgink.interfaces.role.IRoleCheckService;
|
||||
import ink.wgink.interfaces.user.IUserCheckService;
|
||||
import ink.wgink.interfaces.user.IUserDetailCheckService;
|
||||
import ink.wgink.module.menu.dao.IMenuDao;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import ink.wgink.pojo.dtos.menu.MenuDTO;
|
||||
import ink.wgink.util.ResourceUtil;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -38,816 +35,111 @@ import java.util.Map;
|
||||
@Component
|
||||
public class InitMenu implements IInitBaseMenu {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(InitMenu.class);
|
||||
@Autowired
|
||||
private IMenuDao menuDao;
|
||||
@Autowired(required = false)
|
||||
private IDictionaryCheckService dictionaryCheckService;
|
||||
@Autowired(required = false)
|
||||
private ISystemConfigCheckService systemConfigCheckService;
|
||||
@Autowired(required = false)
|
||||
private IUserCheckService userCheckService;
|
||||
@Autowired(required = false)
|
||||
private IDepartmentCheckService departmentCheckService;
|
||||
@Autowired(required = false)
|
||||
private IGroupCheckService groupCheckService;
|
||||
@Autowired(required = false)
|
||||
private IPositionCheckService positionCheckService;
|
||||
@Autowired(required = false)
|
||||
private IPermissionCheckService permissionCheckService;
|
||||
@Autowired(required = false)
|
||||
private IRoleCheckService roleCheckService;
|
||||
@Autowired(required = false)
|
||||
private IUserDetailCheckService userDetailCheckService;
|
||||
@Autowired(required = false)
|
||||
private IAppSignBaseService appSignBaseService;
|
||||
@Autowired(required = false)
|
||||
private IArticleCheckService articleCheckService;
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Map<String, Object> params = new HashMap<>(20);
|
||||
try {
|
||||
InputStream initMenuJsonInputStream = ResourceUtil.getJarResourceInputStream("json/init-menu.json");
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(initMenuJsonInputStream));
|
||||
StringBuffer jsonSB = new StringBuffer();
|
||||
for (String line; (line = bufferedReader.readLine()) != null; ) {
|
||||
jsonSB.append(line);
|
||||
}
|
||||
List<InitMenuBO> initMenus = JSON.parseArray(jsonSB.toString(), InitMenuBO.class);
|
||||
// 构建业务菜单列表
|
||||
Map<String, IBuildServiceMenu> buildServiceMenuMap = applicationContext.getBeansOfType(IBuildServiceMenu.class);
|
||||
buildServiceMenuMap.forEach((k, v) -> {
|
||||
v.buildMenu(initMenus);
|
||||
});
|
||||
// 构建编码
|
||||
buildMenuCode("0001", initMenus);
|
||||
// 创建根节点
|
||||
Map<String, Object> params = new HashMap<>(20);
|
||||
String gmt = DateUtil.getTime();
|
||||
params.put("menuCode", "0001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = IMenuBaseService.MENU_UNIFIED_USER;
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", "0");
|
||||
params.put("menuName", "统一用户系统");
|
||||
params.put("menuSummary", "统一用户系统");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-cogs");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
params.put("gmtCreate", gmt);
|
||||
params.put("gmtModified", gmt);
|
||||
params.put("creator", "1");
|
||||
params.put("modifier", "1");
|
||||
params.put("isDelete", 0);
|
||||
menuDao.save(params);
|
||||
}
|
||||
// 创建菜单
|
||||
createMenu(menuId, initMenus);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildMenuCode(String parentMenuCode, List<InitMenuBO> initMenus) {
|
||||
for (int i = 0; i < initMenus.size(); i++) {
|
||||
String indexMenuCode = String.format("%04d", (i + 1));
|
||||
String menuCode = parentMenuCode + indexMenuCode;
|
||||
InitMenuBO initMenu = initMenus.get(i);
|
||||
initMenu.setMenuCode(menuCode);
|
||||
if (initMenu.getSubMenus().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
buildMenuCode(menuCode, initMenu.getSubMenus());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建菜单
|
||||
*
|
||||
* @param menuParentId
|
||||
* @param initMenus
|
||||
*/
|
||||
private void createMenu(String menuParentId, List<InitMenuBO> initMenus) {
|
||||
String gmt = DateUtil.getTime();
|
||||
params.put("gmtCreate", gmt);
|
||||
params.put("gmtModified", gmt);
|
||||
params.put("creator", "1");
|
||||
params.put("modifier", "1");
|
||||
params.put("isDelete", 0);
|
||||
|
||||
params.put("menuCode", "0001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = IMenuBaseService.MENU_UNIFIED_USER;
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", "0");
|
||||
params.put("menuName", "统一用户系统");
|
||||
params.put("menuSummary", "统一用户系统");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-cogs");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
initSystemManage(params, menuId);
|
||||
initUserPermissionManage(params, menuId);
|
||||
initPermissionManage(params, menuId);
|
||||
initLogManage(params, menuId);
|
||||
initArticleManage(params, menuId);
|
||||
}
|
||||
|
||||
private void initSystemManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:系统管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "00010001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "系统管理");
|
||||
params.put("menuSummary", "系统管理");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-cogs");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
initMenuManage(params, menuId);
|
||||
initDataManager(params, menuId);
|
||||
initAreaManager(params, menuId);
|
||||
initConfigManager(params, menuId);
|
||||
initAppVersionMenu(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initMenuManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:系统菜单");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100010001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", UUIDUtil.getUUID());
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "系统菜单");
|
||||
params.put("menuSummary", "系统菜单");
|
||||
params.put("menuUrl", "/route/menu/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-list");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据字典
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
public void initDataManager(Map<String, Object> params, String menuParentId) {
|
||||
if (dictionaryCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:数据字典");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100010002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", UUIDUtil.getUUID());
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "数据字典");
|
||||
params.put("menuSummary", "数据字典");
|
||||
params.put("menuUrl", "/route/data/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-address-book");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化地区字典
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
public void initAreaManager(Map<String, Object> params, String menuParentId) {
|
||||
if (dictionaryCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:地区字典");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100010003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", UUIDUtil.getUUID());
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "区域字典");
|
||||
params.put("menuSummary", "区域字典");
|
||||
params.put("menuUrl", "/route/area/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-map-o");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化配置
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
public void initConfigManager(Map<String, Object> params, String menuParentId) {
|
||||
if (systemConfigCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:系统配置");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100010004");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", UUIDUtil.getUUID());
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "系统配置");
|
||||
params.put("menuSummary", "系统配置");
|
||||
params.put("menuUrl", "/route/config/update");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-dashboard");
|
||||
params.put("menuOrder", "4");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化APP版本管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
public void initAppVersionMenu(Map<String, Object> params, String menuParentId) {
|
||||
if (appSignBaseService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:APP版本管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100010005");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", UUIDUtil.getUUID());
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "APP版本管理");
|
||||
params.put("menuSummary", "APP版本管理");
|
||||
params.put("menuUrl", "/route/appversion/list");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-tv");
|
||||
params.put("menuOrder", "5");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户权限管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initUserPermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:用户管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "00010002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "用户管理");
|
||||
params.put("menuSummary", "用户管理");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
initUserManage(params, menuId);
|
||||
initDepartmentManage(params, menuId);
|
||||
initGroupManage(params, menuId);
|
||||
initPositionManage(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initUserManage(Map<String, Object> params, String menuParentId) {
|
||||
if (userCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:用户管理");
|
||||
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "用户账号");
|
||||
params.put("menuSummary", "用户账号管理");
|
||||
params.put("menuUrl", "/route/user/list");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-address-book");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织机构管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initDepartmentManage(Map<String, Object> params, String menuParentId) {
|
||||
if (departmentCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:组织机构管理");
|
||||
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "组织机构");
|
||||
params.put("menuSummary", "组织机构管理");
|
||||
params.put("menuUrl", "/route/department/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-bank");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户组管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initGroupManage(Map<String, Object> params, String menuParentId) {
|
||||
if (groupCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:用户组管理");
|
||||
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "用户组管理");
|
||||
params.put("menuSummary", "用户组管理");
|
||||
params.put("menuUrl", "/route/group/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 职位管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initPositionManage(Map<String, Object> params, String menuParentId) {
|
||||
if (positionCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:职位管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020004");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "职位管理");
|
||||
params.put("menuSummary", "职位管理");
|
||||
params.put("menuUrl", "/route/position/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "4");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化权限管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initPermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
if (permissionCheckService == null && roleCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:权限与角色");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "00010003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "权限与角色");
|
||||
params.put("menuSummary", "权限与角色管理");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
|
||||
if (permissionCheckService != null) {
|
||||
initSavePermissionManage(params, menuId);
|
||||
initDeletePermissionManage(params, menuId);
|
||||
initUpdatePermissionManage(params, menuId);
|
||||
initQueryPermissionManage(params, menuId);
|
||||
}
|
||||
|
||||
if (roleCheckService != null) {
|
||||
initRoleManage(params, menuId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增权限
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initSavePermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:新增权限");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100030001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "新增权限");
|
||||
params.put("menuSummary", "新增权限");
|
||||
params.put("menuUrl", "/route/permission/list?permissionType=permissionInsert");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改权限
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initDeletePermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:删除权限");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100030002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "删除权限");
|
||||
params.put("menuSummary", "删除权限");
|
||||
params.put("menuUrl", "/route/permission/list?permissionType=permissionDelete");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改权限
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initUpdatePermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:修改权限");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100030003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "修改权限");
|
||||
params.put("menuSummary", "修改权限");
|
||||
params.put("menuUrl", "/route/permission/list?permissionType=permissionUpdate");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initQueryPermissionManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:查询权限");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100030004");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "查询权限");
|
||||
params.put("menuSummary", "查询权限");
|
||||
params.put("menuUrl", "/route/permission/list?permissionType=permissionQuery");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "4");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initRoleManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:角色管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100030005");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "角色管理");
|
||||
params.put("menuSummary", "角色管理");
|
||||
params.put("menuUrl", "/route/role/list-tree?permissionType=permissionQuery");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "5");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initLogManage(Map<String, Object> params, String menuParentId) {
|
||||
if (userDetailCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:日志管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "00010004");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "日志管理");
|
||||
params.put("menuSummary", "日志管理");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-history");
|
||||
params.put("menuOrder", "4");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
|
||||
initLoginLogManage(params, menuId);
|
||||
initUserAdjustmentManage(params, menuId);
|
||||
initDepartmentAdjustmentManage(params, menuId);
|
||||
initDepartmentUserAdjustmentManage(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initLoginLogManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:登录日志");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100040001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "登录日志");
|
||||
params.put("menuSummary", "登录日志");
|
||||
params.put("menuUrl", "/route/log/list-login-log");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-history");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户调整
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initUserAdjustmentManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:用户调整");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100040002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "用户调整");
|
||||
params.put("menuSummary", "用户调整");
|
||||
params.put("menuUrl", "/route/log/list-user-adjustment");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-history");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门调整
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initDepartmentAdjustmentManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:部门调整");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100040003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "部门调整");
|
||||
params.put("menuSummary", "部门调整");
|
||||
params.put("menuUrl", "/route/log/list-department-adjustment");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-history");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门用户调整
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initDepartmentUserAdjustmentManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:部门用户调整");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100040004");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "部门用户调整");
|
||||
params.put("menuSummary", "部门用户调整");
|
||||
params.put("menuUrl", "/route/log/list-department-user-adjustment");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-history");
|
||||
params.put("menuOrder", "4");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initArticleManage(Map<String, Object> params, String menuParentId) {
|
||||
if (articleCheckService == null) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("初始化菜单:文章管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "00010100");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "文章管理");
|
||||
params.put("menuSummary", "文章管理");
|
||||
params.put("menuUrl", "javascript:void(0);");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-newspaper-o");
|
||||
params.put("menuOrder", "100");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
|
||||
initCategoryManage(params, menuId);
|
||||
initContentManage(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门用户调整
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initCategoryManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:目录管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000101000001");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "目录管理");
|
||||
params.put("menuSummary", "目录管理");
|
||||
params.put("menuUrl", "/route/category/list");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-newspaper-o");
|
||||
params.put("menuOrder", "1");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门用户调整
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initContentManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:内容管理");
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000101000002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "内容管理");
|
||||
params.put("menuSummary", "内容管理");
|
||||
params.put("menuUrl", "/route/content/list");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-newspaper-o");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
for (int i = 0; i < initMenus.size(); i++) {
|
||||
InitMenuBO initMenu = initMenus.get(i);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("menuCode", initMenu.getMenuCode());
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId;
|
||||
if (menuDTO == null) {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", initMenu.getMenuName());
|
||||
params.put("menuSummary", initMenu.getMenuSummary());
|
||||
params.put("menuUrl", initMenu.getMenuUrl());
|
||||
params.put("menuType", initMenu.getMenuType());
|
||||
params.put("menuIcon", initMenu.getMenuIcon());
|
||||
params.put("openType", 1);
|
||||
params.put("menuStatus", 0);
|
||||
params.put("menuOrder", i);
|
||||
params.put("gmtCreate", gmt);
|
||||
params.put("gmtModified", gmt);
|
||||
params.put("creator", "1");
|
||||
params.put("modifier", "1");
|
||||
params.put("isDelete", 0);
|
||||
menuDao.save(params);
|
||||
} else {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
if (initMenu.getSubMenus().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
createMenu(menuId, initMenu.getSubMenus());
|
||||
}
|
||||
}
|
||||
|
||||
|
99
service-menu/src/main/resources/json/init-menu.json
Normal file
99
service-menu/src/main/resources/json/init-menu.json
Normal file
@ -0,0 +1,99 @@
|
||||
[
|
||||
{
|
||||
"menuName": "系统管理",
|
||||
"menuSummary": "系统管理",
|
||||
"menuUrl": "javascript:void(0);",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-cogs",
|
||||
"subMenus": [
|
||||
{
|
||||
"menuName": "系统菜单",
|
||||
"menuSummary": "系统菜单",
|
||||
"menuUrl": "/route/menu/list-tree",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-list"
|
||||
},
|
||||
{
|
||||
"menuName": "系统配置",
|
||||
"menuSummary": "系统配置",
|
||||
"menuUrl": "/route/config/update",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-dashboard"
|
||||
},
|
||||
{
|
||||
"menuName": "环境变量",
|
||||
"menuSummary": "环境变量",
|
||||
"menuUrl": "/route/env/update",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-dashboard"
|
||||
},
|
||||
{
|
||||
"menuName": "访问白名单",
|
||||
"menuSummary": "访问白名单",
|
||||
"menuUrl": "/route/access/white-list/update",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-dashboard"
|
||||
},
|
||||
{
|
||||
"menuName": "登录form",
|
||||
"menuSummary": "登录form",
|
||||
"menuUrl": "/route/login-form/list",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-list"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"menuName": "用户与组织",
|
||||
"menuSummary": "用户与组织",
|
||||
"menuUrl": "javascript:void(0);",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-list",
|
||||
"subMenus": []
|
||||
},
|
||||
{
|
||||
"menuName": "权限与角色",
|
||||
"menuSummary": "权限与角色",
|
||||
"menuUrl": "javascript:void(0);",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-list",
|
||||
"subMenus": []
|
||||
},
|
||||
{
|
||||
"menuName": "日志管理",
|
||||
"menuSummary": "日志管理",
|
||||
"menuUrl": "javascript:void(0);",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-list",
|
||||
"subMenus": [
|
||||
{
|
||||
"menuName": "登录日志",
|
||||
"menuSummary": "登录日志",
|
||||
"menuUrl": "/route/log/list-login-log",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-history"
|
||||
},
|
||||
{
|
||||
"menuName": "用户调整",
|
||||
"menuSummary": "用户调整",
|
||||
"menuUrl": "/route/log/list-user-adjustment",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-history"
|
||||
},
|
||||
{
|
||||
"menuName": "部门调整",
|
||||
"menuSummary": "部门调整",
|
||||
"menuUrl": "/route/log/list-department-adjustment",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-history"
|
||||
},
|
||||
{
|
||||
"menuName": "部门用户调整",
|
||||
"menuSummary": "部门用户调整",
|
||||
"menuUrl": "/route/log/list-department-user-adjustment",
|
||||
"menuType": "1",
|
||||
"menuIcon": "fa-icon-color-white fa fa-history"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -188,6 +188,10 @@
|
||||
#{menuIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="menuUrl != null and menuUrl != ''">
|
||||
AND
|
||||
menu_url = #{menuUrl}
|
||||
</if>
|
||||
<if test="menuStatus != null">
|
||||
AND
|
||||
menu_status = #{menuStatus}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package ink.wgink.service.permission.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildPermissionMenu
|
||||
* @Description: 构建权限菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:34
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildPermissionMenu implements IBuildServiceMenu {
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取角色权限管理
|
||||
InitMenuBO parentMenu = initMenus.get(2);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO insertInitMenu = new InitMenuBO();
|
||||
insertInitMenu.setMenuName("新增权限");
|
||||
insertInitMenu.setMenuSummary("新增权限");
|
||||
insertInitMenu.setMenuUrl("/route/permission/list?permissionType=permissionInsert");
|
||||
subMenus.add(insertInitMenu);
|
||||
|
||||
InitMenuBO deleteInitMenu = new InitMenuBO();
|
||||
deleteInitMenu.setMenuName("删除权限");
|
||||
deleteInitMenu.setMenuSummary("删除权限");
|
||||
deleteInitMenu.setMenuUrl("/route/permission/list?permissionType=permissionDelete");
|
||||
subMenus.add(deleteInitMenu);
|
||||
|
||||
InitMenuBO updateInitMenu = new InitMenuBO();
|
||||
updateInitMenu.setMenuName("修改权限");
|
||||
updateInitMenu.setMenuSummary("修改权限");
|
||||
updateInitMenu.setMenuUrl("/route/permission/list?permissionType=permissionUpdate");
|
||||
subMenus.add(updateInitMenu);
|
||||
|
||||
InitMenuBO queryInitMenu = new InitMenuBO();
|
||||
queryInitMenu.setMenuName("查询权限");
|
||||
queryInitMenu.setMenuSummary("查询权限");
|
||||
queryInitMenu.setMenuUrl("/route/permission/list?permissionType=permissionQuery");
|
||||
subMenus.add(queryInitMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ink.wgink.service.position.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildPositionMenu
|
||||
* @Description: 构建职位菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:29
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildPositionMenu implements IBuildServiceMenu {
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取用户管理
|
||||
InitMenuBO parentMenu = initMenus.get(1);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("职位管理");
|
||||
initMenu.setMenuSummary("职位管理");
|
||||
initMenu.setMenuUrl("/route/position/list-tree");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-users");
|
||||
subMenus.add(initMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ink.wgink.service.role.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildRoleMenu
|
||||
* @Description: 构建角色菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:30
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildRoleMenu implements IBuildServiceMenu {
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取角色权限管理
|
||||
InitMenuBO parentMenu = initMenus.get(2);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("角色管理");
|
||||
initMenu.setMenuSummary("角色管理");
|
||||
initMenu.setMenuUrl("/route/role/list-tree?permissionType=permissionQuery");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-users");
|
||||
subMenus.add(initMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package ink.wgink.service.user.init.build;
|
||||
|
||||
import ink.wgink.interfaces.init.build.IBuildServiceMenu;
|
||||
import ink.wgink.pojo.bos.menu.InitMenuBO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: BuildUserMenu
|
||||
* @Description: 构建用户菜单
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/7/28 23:13
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class BuildUserMenu implements IBuildServiceMenu {
|
||||
|
||||
@Override
|
||||
public void buildMenu(List<InitMenuBO> initMenus) {
|
||||
// 获取用户管理
|
||||
InitMenuBO parentMenu = initMenus.get(1);
|
||||
// 获取子菜单
|
||||
List<InitMenuBO> subMenus = parentMenu.getSubMenus();
|
||||
InitMenuBO initMenu = new InitMenuBO();
|
||||
initMenu.setMenuName("用户账号");
|
||||
initMenu.setMenuSummary("用户账号");
|
||||
initMenu.setMenuUrl("/route/user/list");
|
||||
initMenu.setMenuIcon("fa-icon-color-white fa fa-address-book");
|
||||
subMenus.add(initMenu);
|
||||
// 更新子菜单
|
||||
parentMenu.setSubMenus(subMenus);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user