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

pull/5955/head^2
zhangdaiscott 2024-03-06 16:20:49 +08:00
parent a9dba08a8d
commit f7538c1ed8
5 changed files with 104 additions and 19 deletions

View File

@ -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";
/** /**

View File

@ -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");
/** /**
* *
*/ */

View File

@ -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";
}

View File

@ -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("设置失败");
}
}
} }

View File

@ -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();
} }