!361 优化字典项排序,修复修改字典项未清除缓存

Merge pull request !361 from 贾同学/dev
This commit is contained in:
lbw 2023-04-27 06:49:25 +00:00 committed by Gitee
commit 0454a69e49
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 3 deletions

View File

@ -76,7 +76,8 @@ public class SysDictController {
@GetMapping("/page")
public R<IPage<SysDict>> getDictPage(Page page, SysDict sysDict) {
return R.ok(sysDictService.page(page, Wrappers.<SysDict>lambdaQuery()
.like(StrUtil.isNotBlank(sysDict.getDictKey()), SysDict::getDictKey, sysDict.getDictKey())));
.like(StrUtil.isNotBlank(sysDict.getDictKey()), SysDict::getDictKey, sysDict.getDictKey())
.orderByDesc(SysDict::getUpdateTime)));
}
/**
@ -87,7 +88,7 @@ public class SysDictController {
@GetMapping("/key/{key}")
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#key")
public R<List<SysDictItem>> getDictByKey(@PathVariable String key) {
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictKey, key)));
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictKey, key).orderByAsc(SysDictItem::getSortOrder)));
}
/**

View File

@ -65,7 +65,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
* @return
*/
@Override
@CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#item.type")
@CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#item.dictKey")
public void updateDictItem(SysDictItem item) {
// 查询字典
SysDict dict = dictService.getById(item.getDictId());