mirror of https://github.com/jeecgboot/jeecg-boot
【3.6.3版本发布】首页支持自定义
parent
a9dba08a8d
commit
f7538c1ed8
|
@ -377,6 +377,8 @@ public interface CommonConstant {
|
||||||
/**前端vue3版本Header参数名*/
|
/**前端vue3版本Header参数名*/
|
||||||
String VERSION="X-Version";
|
String VERSION="X-Version";
|
||||||
|
|
||||||
|
String VERSION_V3 = "v3";
|
||||||
|
|
||||||
/**存储在线程变量里的动态表名*/
|
/**存储在线程变量里的动态表名*/
|
||||||
String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME";
|
String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME";
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,12 +13,16 @@ import java.util.List;
|
||||||
public enum RoleIndexConfigEnum {
|
public enum RoleIndexConfigEnum {
|
||||||
|
|
||||||
/**首页自定义 admin*/
|
/**首页自定义 admin*/
|
||||||
ADMIN("admin", "dashboard/Analysis"),
|
// ADMIN("admin", "dashboard/Analysis"),
|
||||||
//TEST("test", "dashboard/IndexChart"),
|
//TEST("test", "dashboard/IndexChart"),
|
||||||
/**首页自定义 hr*/
|
/**首页自定义 hr*/
|
||||||
HR("hr", "dashboard/IndexBdc");
|
// HR("hr", "dashboard/IndexBdc");
|
||||||
|
|
||||||
//DM("dm", "dashboard/IndexTask"),
|
//DM("dm", "dashboard/IndexTask"),
|
||||||
|
|
||||||
|
// 注:此值仅为防止报错,无任何实际意义
|
||||||
|
ROLE_INDEX_CONFIG_ENUM("RoleIndexConfigEnumDefault", "dashboard/Analysis");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色编码
|
* 角色编码
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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";
|
||||||
|
|
||||||
|
}
|
|
@ -1,29 +1,26 @@
|
||||||
package org.jeecg.modules.system.controller;
|
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 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.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
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: 角色首页配置
|
* @Description: 角色首页配置
|
||||||
|
@ -172,4 +169,32 @@ public class SysRoleIndexController extends JeecgController<SysRoleIndex, ISysRo
|
||||||
SysRoleIndex sysRoleIndex = sysRoleIndexService.getOne(new LambdaQueryWrapper<SysRoleIndex>().eq(SysRoleIndex::getRoleCode, roleCode));
|
SysRoleIndex sysRoleIndex = sysRoleIndexService.getOne(new LambdaQueryWrapper<SysRoleIndex>().eq(SysRoleIndex::getRoleCode, roleCode));
|
||||||
return Result.OK(sysRoleIndex);
|
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("设置失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,43 @@
|
||||||
package org.jeecg.modules.system.service;
|
package org.jeecg.modules.system.service;
|
||||||
|
|
||||||
import org.jeecg.modules.system.entity.SysRoleIndex;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.system.entity.SysRoleIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 角色首页配置
|
* @Description: 角色首页配置
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2022-03-25
|
* @Date: 2022-03-25
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleIndexService extends IService<SysRoleIndex> {
|
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…
Reference in New Issue