| | |
| | | @DeleteMapping("/{configIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] configIds)
|
| | | {
|
| | | return toAjax(configService.deleteConfigByIds(configIds));
|
| | | configService.deleteConfigByIds(configIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存
|
| | | * 刷新参数缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clearCache")
|
| | | public AjaxResult clearCache()
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | configService.clearCache();
|
| | | configService.resetConfigCache();
|
| | | return AjaxResult.success();
|
| | | }
|
| | | }
|
| | |
| | | @DeleteMapping("/{dictCodes}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictCodes)
|
| | | {
|
| | | return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
| | | dictDataService.deleteDictDataByIds(dictCodes);
|
| | | return success();
|
| | | }
|
| | | }
|
| | |
| | | @DeleteMapping("/{dictIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictIds)
|
| | | {
|
| | | return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
| | | dictTypeService.deleteDictTypeByIds(dictIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存
|
| | | * 刷新字典缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clearCache")
|
| | | public AjaxResult clearCache()
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | dictTypeService.clearCache();
|
| | | dictTypeService.resetDictCache();
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 删除指定字典缓存
|
| | | * |
| | | * @param key 字典键
|
| | | */
|
| | | public static void removeDictCache(String key)
|
| | | {
|
| | | SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空字典缓存
|
| | | */
|
| | | public static void clearDictCache()
|
| | |
| | | * @param configIds 需要删除的参数ID
|
| | | * @return 结果
|
| | | */
|
| | | public int deleteConfigByIds(Long[] configIds);
|
| | | public void deleteConfigByIds(Long[] configIds);
|
| | |
|
| | | /**
|
| | | * 清空缓存数据
|
| | | * 加载参数缓存数据
|
| | | */
|
| | | public void clearCache();
|
| | | public void loadingConfigCache();
|
| | |
|
| | | /**
|
| | | * 清空参数缓存数据
|
| | | */
|
| | | public void clearConfigCache();
|
| | |
|
| | | /**
|
| | | * 重置参数缓存数据
|
| | | */
|
| | | public void resetConfigCache();
|
| | |
|
| | | /**
|
| | | * 校验参数键名是否唯一
|
| | |
| | | * @param dictCodes 需要删除的字典数据ID
|
| | | * @return 结果
|
| | | */
|
| | | public int deleteDictDataByIds(Long[] dictCodes);
|
| | | public void deleteDictDataByIds(Long[] dictCodes);
|
| | |
|
| | | /**
|
| | | * 新增保存字典数据信息
|
| | |
| | | * @param dictIds 需要删除的字典ID
|
| | | * @return 结果
|
| | | */
|
| | | public int deleteDictTypeByIds(Long[] dictIds);
|
| | | public void deleteDictTypeByIds(Long[] dictIds);
|
| | |
|
| | | /**
|
| | | * 清空缓存数据
|
| | | * 加载字典缓存数据
|
| | | */
|
| | | public void clearCache();
|
| | | public void loadingDictCache();
|
| | |
|
| | | /**
|
| | | * 清空字典缓存数据
|
| | | */
|
| | | public void clearDictCache();
|
| | |
|
| | | /**
|
| | | * 重置字典缓存数据
|
| | | */
|
| | | public void resetDictCache();
|
| | |
|
| | | /**
|
| | | * 新增保存字典类型信息
|
| | |
| | | @PostConstruct
|
| | | public void init()
|
| | | {
|
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
|
| | | for (SysConfig config : configsList)
|
| | | {
|
| | | redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
| | | }
|
| | | loadingConfigCache();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int deleteConfigByIds(Long[] configIds)
|
| | | public void deleteConfigByIds(Long[] configIds)
|
| | | {
|
| | | for (Long configId : configIds)
|
| | | {
|
| | |
| | | {
|
| | | throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
| | | }
|
| | | configMapper.deleteConfigById(configId);
|
| | | redisCache.deleteObject(getCacheKey(config.getConfigKey()));
|
| | | }
|
| | | int count = configMapper.deleteConfigByIds(configIds);
|
| | | if (count > 0)
|
| | | {
|
| | | Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
|
| | | redisCache.deleteObject(keys);
|
| | | }
|
| | | return count;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存数据
|
| | | * 加载参数缓存数据
|
| | | */
|
| | | @Override
|
| | | public void clearCache()
|
| | | public void loadingConfigCache()
|
| | | {
|
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
|
| | | for (SysConfig config : configsList)
|
| | | {
|
| | | redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空参数缓存数据
|
| | | */
|
| | | @Override
|
| | | public void clearConfigCache()
|
| | | {
|
| | | Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
|
| | | redisCache.deleteObject(keys);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 重置参数缓存数据
|
| | | */
|
| | | @Override
|
| | | public void resetConfigCache()
|
| | | {
|
| | | clearConfigCache();
|
| | | loadingConfigCache();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 校验参数键名是否唯一
|
| | | *
|
| | | * @param config 参数配置信息
|
| | |
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int deleteDictDataByIds(Long[] dictCodes)
|
| | | public void deleteDictDataByIds(Long[] dictCodes)
|
| | | {
|
| | | int row = dictDataMapper.deleteDictDataByIds(dictCodes);
|
| | | if (row > 0)
|
| | | for (Long dictCode : dictCodes)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | SysDictData data = selectDictDataById(dictCode);
|
| | | dictDataMapper.deleteDictDataById(dictCode);
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
| | | DictUtils.setDictCache(data.getDictType(), dictDatas);
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增保存字典数据信息
|
| | | *
|
| | | * @param dictData 字典数据信息
|
| | | * @param data 字典数据信息
|
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int insertDictData(SysDictData dictData)
|
| | | public int insertDictData(SysDictData data)
|
| | | {
|
| | | int row = dictDataMapper.insertDictData(dictData);
|
| | | int row = dictDataMapper.insertDictData(data);
|
| | | if (row > 0)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
| | | DictUtils.setDictCache(data.getDictType(), dictDatas);
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
| | | /**
|
| | | * 修改保存字典数据信息
|
| | | *
|
| | | * @param dictData 字典数据信息
|
| | | * @param data 字典数据信息
|
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int updateDictData(SysDictData dictData)
|
| | | public int updateDictData(SysDictData data)
|
| | | {
|
| | | int row = dictDataMapper.updateDictData(dictData);
|
| | | int row = dictDataMapper.updateDictData(data);
|
| | | if (row > 0)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
| | | DictUtils.setDictCache(data.getDictType(), dictDatas);
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
| | | @PostConstruct
|
| | | public void init()
|
| | | {
|
| | | List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
|
| | | for (SysDictType dictType : dictTypeList)
|
| | | {
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
|
| | | DictUtils.setDictCache(dictType.getDictType(), dictDatas);
|
| | | }
|
| | | loadingDictCache();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int deleteDictTypeByIds(Long[] dictIds)
|
| | | public void deleteDictTypeByIds(Long[] dictIds)
|
| | | {
|
| | | for (Long dictId : dictIds)
|
| | | {
|
| | |
| | | {
|
| | | throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
| | | }
|
| | | dictTypeMapper.deleteDictTypeById(dictId);
|
| | | DictUtils.removeDictCache(dictType.getDictType());
|
| | | }
|
| | | int count = dictTypeMapper.deleteDictTypeByIds(dictIds);
|
| | | if (count > 0)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | }
|
| | | return count;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存数据
|
| | | * 加载字典缓存数据
|
| | | */
|
| | | @Override
|
| | | public void clearCache()
|
| | | public void loadingDictCache()
|
| | | {
|
| | | List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
|
| | | for (SysDictType dictType : dictTypeList)
|
| | | {
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
|
| | | DictUtils.setDictCache(dictType.getDictType(), dictDatas);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空字典缓存数据
|
| | | */
|
| | | public void clearDictCache()
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 重置字典缓存数据
|
| | | */
|
| | | public void resetDictCache()
|
| | | {
|
| | | clearDictCache();
|
| | | loadingDictCache();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增保存字典类型信息
|
| | | *
|
| | | * @param dictType 字典类型信息
|
| | | * @param dict 字典类型信息
|
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public int insertDictType(SysDictType dictType)
|
| | | public int insertDictType(SysDictType dict)
|
| | | {
|
| | | int row = dictTypeMapper.insertDictType(dictType);
|
| | | int row = dictTypeMapper.insertDictType(dict);
|
| | | if (row > 0)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | DictUtils.setDictCache(dict.getDictType(), null);
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
| | | /**
|
| | | * 修改保存字典类型信息
|
| | | *
|
| | | * @param dictType 字典类型信息
|
| | | * @param dict 字典类型信息
|
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | @Transactional
|
| | | public int updateDictType(SysDictType dictType)
|
| | | public int updateDictType(SysDictType dict)
|
| | | {
|
| | | SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
|
| | | dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
|
| | | int row = dictTypeMapper.updateDictType(dictType);
|
| | | SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
|
| | | dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
|
| | | int row = dictTypeMapper.updateDictType(dict);
|
| | | if (row > 0)
|
| | | {
|
| | | DictUtils.clearDictCache();
|
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
|
| | | DictUtils.setDictCache(dict.getDictType(), dictDatas);
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
| | | })
|
| | | }
|
| | |
|
| | | // 清理参数缓存
|
| | | export function clearCache() {
|
| | | // 刷新参数缓存
|
| | | export function refreshCache() {
|
| | | return request({
|
| | | url: '/system/config/clearCache',
|
| | | url: '/system/config/refreshCache',
|
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
| | | })
|
| | | }
|
| | |
|
| | | // 清理参数缓存
|
| | | export function clearCache() {
|
| | | // 刷新字典缓存
|
| | | export function refreshCache() {
|
| | | return request({
|
| | | url: '/system/dict/type/clearCache',
|
| | | url: '/system/dict/type/refreshCache',
|
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
| | | plain
|
| | | icon="el-icon-refresh"
|
| | | size="mini"
|
| | | @click="handleClearCache"
|
| | | @click="handleRefreshCache"
|
| | | v-hasPermi="['system:config:remove']"
|
| | | >清理缓存</el-button>
|
| | | >刷新缓存</el-button>
|
| | | </el-col>
|
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
| | | </el-row>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, clearCache } from "@/api/system/config";
|
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config";
|
| | |
|
| | | export default {
|
| | | name: "Config",
|
| | |
| | | this.exportLoading = false;
|
| | | })
|
| | | },
|
| | | /** 清理缓存按钮操作 */
|
| | | handleClearCache() {
|
| | | clearCache().then(response => {
|
| | | this.msgSuccess("清理成功");
|
| | | /** 刷新缓存按钮操作 */
|
| | | handleRefreshCache() {
|
| | | refreshCache().then(() => {
|
| | | this.msgSuccess("刷新成功");
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | plain
|
| | | icon="el-icon-refresh"
|
| | | size="mini"
|
| | | @click="handleClearCache"
|
| | | @click="handleRefreshCache"
|
| | | v-hasPermi="['system:dict:remove']"
|
| | | >清理缓存</el-button>
|
| | | >刷新缓存</el-button>
|
| | | </el-col>
|
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
| | | </el-row>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listType, getType, delType, addType, updateType, exportType, clearCache } from "@/api/system/dict/type";
|
| | | import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type";
|
| | |
|
| | | export default {
|
| | | name: "Dict",
|
| | |
| | | this.exportLoading = false;
|
| | | })
|
| | | },
|
| | | /** 清理缓存按钮操作 */
|
| | | handleClearCache() {
|
| | | clearCache().then(response => {
|
| | | this.msgSuccess("清理成功");
|
| | | /** 刷新缓存按钮操作 */
|
| | | handleRefreshCache() {
|
| | | refreshCache().then(() => {
|
| | | this.msgSuccess("刷新成功");
|
| | | });
|
| | | }
|
| | | }
|