Browse Source

【3.6.3版本发布】首页支持自定义

pull/5955/head^2
zhangdaiscott 9 months ago
parent
commit
f7538c1ed8
  1. 2
      jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
  2. 8
      jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/RoleIndexConfigEnum.java
  3. 25
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/constant/DefIndexConst.java
  4. 55
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleIndexController.java
  5. 33
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysRoleIndexService.java

2
jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java

@ -377,6 +377,8 @@ public interface CommonConstant {
/**前端vue3版本Header参数名*/
String VERSION="X-Version";
String VERSION_V3 = "v3";
/**存储在线程变量里的动态表名*/
String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME";
/**

8
jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/RoleIndexConfigEnum.java

@ -13,12 +13,16 @@ import java.util.List;
public enum RoleIndexConfigEnum {
/**首页自定义 admin*/
ADMIN("admin", "dashboard/Analysis"),
// ADMIN("admin", "dashboard/Analysis"),
//TEST("test", "dashboard/IndexChart"),
/**首页自定义 hr*/
HR("hr", "dashboard/IndexBdc");
// HR("hr", "dashboard/IndexBdc");
//DM("dm", "dashboard/IndexTask"),
// 注:此值仅为防止报错,无任何实际意义
ROLE_INDEX_CONFIG_ENUM("RoleIndexConfigEnumDefault", "dashboard/Analysis");
/**
* 角色编码
*/

25
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/constant/DefIndexConst.java

@ -0,0 +1,25 @@
package org.jeecg.modules.system.constant;
/**
* 默认首页常量
*/
public interface DefIndexConst {
/**
* 默认首页的roleCode
*/
String DEF_INDEX_ALL = "DEF_INDEX_ALL";
/**
* 默认首页的缓存key
*/
String CACHE_KEY = "sys:cache:def_index";
/**
* 默认首页的初始值
*/
String DEF_INDEX_NAME = "首页";
String DEF_INDEX_URL = "/dashboard/analysis";
String DEF_INDEX_COMPONENT = "dashboard/Analysis";
}

55
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleIndexController.java

@ -1,29 +1,26 @@
package org.jeecg.modules.system.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.system.entity.SysRoleIndex;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.SysRoleIndex;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
* @Description: 角色首页配置
@ -172,4 +169,32 @@ public class SysRoleIndexController extends JeecgController<SysRoleIndex, ISysRo
SysRoleIndex sysRoleIndex = sysRoleIndexService.getOne(new LambdaQueryWrapper<SysRoleIndex>().eq(SysRoleIndex::getRoleCode, roleCode));
return Result.OK(sysRoleIndex);
}
/**
* 查询默认首页配置
*/
@GetMapping("/queryDefIndex")
public Result<SysRoleIndex> queryDefIndex() {
SysRoleIndex defIndexCfg = sysRoleIndexService.queryDefaultIndex();
return Result.OK(defIndexCfg);
}
/**
* 更新默认首页配置
*/
@RequiresPermissions("system:permission:setDefIndex")
@PutMapping("/updateDefIndex")
public Result<?> updateDefIndex(
@RequestParam("url") String url,
@RequestParam("component") String component,
@RequestParam("isRoute") Boolean isRoute
) {
boolean success = sysRoleIndexService.updateDefaultIndex(url, component, isRoute);
if (success) {
return Result.OK("设置成功");
} else {
return Result.error("设置失败");
}
}
}

33
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysRoleIndexService.java

@ -1,14 +1,43 @@
package org.jeecg.modules.system.service;
import org.jeecg.modules.system.entity.SysRoleIndex;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.system.entity.SysRoleIndex;
/**
* @Description: 角色首页配置
* @Author: jeecg-boot
* @Date: 2022-03-25
* @Date: 2022-03-25
* @Version: V1.0
*/
public interface ISysRoleIndexService extends IService<SysRoleIndex> {
/**
* 查询默认首页
*
* @return
*/
SysRoleIndex queryDefaultIndex();
/**
* 更新默认首页
*
* @param url
* @param component
* @param isRoute 是否是路由页面
* @return
*/
boolean updateDefaultIndex(String url, String component, boolean isRoute);
/**
* 创建最原始的默认首页配置
*
* @return
*/
SysRoleIndex initDefaultIndex();
/**
* 清理默认首页的redis缓存
*/
void cleanDefaultIndexCache();
}

Loading…
Cancel
Save