参数管理支持缓存操作

This commit is contained in:
RuoYi
2020-03-18 12:28:36 +08:00
parent 567ab47ae9
commit 06751acbf9
11 changed files with 318 additions and 11 deletions

View File

@ -132,6 +132,19 @@ public class SysConfigController extends BaseController
return toAjax(configService.deleteConfigByIds(ids));
}
/**
* 清空缓存
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@GetMapping("/clearCache")
@ResponseBody
public AjaxResult clearCache()
{
configService.clearCache();
return success();
}
/**
* 校验参数键名
*/

View File

@ -10,6 +10,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysMenuService;
/**
@ -23,6 +24,9 @@ public class SysIndexController extends BaseController
@Autowired
private ISysMenuService menuService;
@Autowired
private ISysConfigService configService;
// 系统首页
@GetMapping("/index")
public String index(ModelMap mmap)
@ -33,6 +37,8 @@ public class SysIndexController extends BaseController
List<SysMenu> menus = menuService.selectMenusByUser(user);
mmap.put("menus", menus);
mmap.put("user", user);
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
mmap.put("copyrightYear", Global.getCopyrightYear());
mmap.put("demoEnabled", Global.isDemoEnabled());
return "index";

View File

@ -42,6 +42,14 @@
statistics="true">
</cache>
<!-- 系统参数缓存 -->
<cache name="sys-config"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="true">
</cache>
<!-- 系统会话缓存 -->
<cache name="shiro-activeSessionCache"
maxElementsInMemory="10000"
@ -52,6 +60,6 @@
diskPersistent="true"
diskExpiryThreadIntervalSeconds="600">
</cache>
</ehcache>

View File

@ -1105,7 +1105,9 @@ var table = {
} else if (result.code == web_status.SUCCESS && table.options.type == table_type.bootstrapTreeTable) {
$.modal.msgSuccess(result.msg);
$.treeTable.refresh();
} else if (result.code == web_status.WARNING) {
} else if (result.code == web_status.SUCCESS && table.option.type == undefined) {
$.modal.msgSuccess(result.msg)
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);

View File

@ -74,7 +74,7 @@
<link th:href="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.css}" rel="stylesheet"/>
</div>
<div th:fragment="datetimepicker-js">
<script th:src="@{/ajax/libs//datapicker/bootstrap-datetimepicker.min.js}"></script>
<script th:src="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.js}"></script>
</div>
<!-- ui布局插件 -->

View File

@ -267,10 +267,8 @@ if($.common.isNotEmpty(skin)){
$("body").addClass(skin.split('|')[0]);
$("body").addClass(skin.split('|')[1]);
} else {
var sideTheme = [[${@config.getKey('sys.index.sideTheme')}]];
var skinName = [[${@config.getKey('sys.index.skinName')}]];
$("body").addClass(sideTheme);
$("body").addClass(skinName);
$("body").addClass([[${sideTheme}]]);
$("body").addClass([[${skinName}]]);
}
/* 用户管理-重置密码 */

View File

@ -50,6 +50,9 @@
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:config:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-danger" onclick="clearCache()" shiro:hasPermission="system:config:remove">
<i class="fa fa-refresh"></i> 清理缓存
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -131,6 +134,10 @@
};
$.table.init(options);
});
function clearCache() {
$.operate.get(prefix + "/clearCache");
}
</script>
</body>
</html>