Commit 1779533d authored by fangxinjiang's avatar fangxinjiang

字典项缓存调整

parent fa7e232a
......@@ -54,6 +54,11 @@ public interface CacheConstants {
*/
String DICT_DETAILS = "dict_details";
/**
* 字典项信息缓存
*/
String DICT_ITEM_DETAILS = "dict_item_details";
/**
* oauth 客户端信息
*/
......
......@@ -178,8 +178,8 @@ public class DictController {
* @return
*/
@GetMapping("/item/getAllDictItem")
public R<Map<String, Object>> getSysDictItemPage() {
return sysDictItemService.getSysDictItemPage();
public R<Map<String, Object>> getAllDictItem() {
return sysDictItemService.getAllDictItem();
}
/**
......@@ -286,6 +286,8 @@ public class DictController {
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
public R clearDictCache() {
sysDictService.clearDictCache();
// 同步清理字典项缓存
sysDictItemService.clearDictItemCache();
return R.ok();
}
......
......@@ -61,6 +61,7 @@ public interface SysDictItemService extends IService<SysDictItem> {
R<Map<String, Object>> getParentDictItemByTypes(String itemTypes);
R<Map<String, Object>> getSysDictItemPage();
R<Map<String, Object>> getAllDictItem();
void clearDictItemCache();
}
......@@ -158,15 +158,32 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
extracted(allList, resultMap);
return R.ok(resultMap);
}
/**
* @Author fxj
* @Description 获取所有字典项数据
* @Date 17:31 2022/6/22
* @Param
* @return
**/
@CacheEvict(value = CacheConstants.DICT_ITEM_DETAILS, key = CacheConstants.DICT_ITEM_DETAILS)
@Override
public R<Map<String, Object>> getSysDictItemPage() {
public R<Map<String, Object>> getAllDictItem() {
List<SysDictItem> allList = baseMapper.selectList(Wrappers.<SysDictItem>query().lambda()
.eq(SysDictItem::getDelFlag,CommonConstants.ZERO_STRING));
Map<String, Object> resultMap = new HashMap<>();
extracted(allList, resultMap);
return R.ok(resultMap);
}
/**
* @Author fxj
* @Description 清理字典项数据
* @Date 17:39 2022/6/22
**/
@CacheEvict(value = CacheConstants.DICT_ITEM_DETAILS, allEntries = true)
@Override
public void clearDictItemCache() {
}
private void extracted(List<SysDictItem> allList, Map<String, Object> resultMap) {
if (Common.isNotNull(allList)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment