mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-12 21:49:01 +08:00
🐛 Fixing a bug. 遗漏修改 导致编辑角色菜单不修改
This commit is contained in:
1 parent
a21a5c9ac7
commit
7c4c0f9dd7
5 files changed
+14
-7
No files matched your search
+5
@@ -34,4 +34,9 @@ public interface CacheConstants {
|
||||
*/
|
||||
String ROUTE_KEY = "gateway_route_key";
|
||||
|
||||
/**
|
||||
* 字典缓存
|
||||
*/
|
||||
String DICT_DETAILS = "dict_details";
|
||||
|
||||
}
|
||||
+5
-4
@@ -27,6 +27,7 @@ import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDictItem;
|
||||
import com.pig4cloud.pigx.admin.service.SysDictItemService;
|
||||
import com.pig4cloud.pigx.admin.service.SysDictService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -83,7 +84,7 @@ public class DictController {
|
||||
* @return 同类型字典
|
||||
*/
|
||||
@GetMapping("/type/{type}")
|
||||
@Cacheable(value = "dict_details", key = "#type")
|
||||
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result == null")
|
||||
public R getDictByType(@PathVariable String type) {
|
||||
return new R<>(sysDictItemService.list(Wrappers
|
||||
.<SysDictItem>query().lambda()
|
||||
@@ -161,7 +162,7 @@ public class DictController {
|
||||
*/
|
||||
@SysLog("新增字典项")
|
||||
@PostMapping("/item")
|
||||
@CacheEvict(value = "dict_details", allEntries = true)
|
||||
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
||||
public R save(@RequestBody SysDictItem sysDictItem) {
|
||||
return new R<>(sysDictItemService.save(sysDictItem));
|
||||
}
|
||||
@@ -174,7 +175,7 @@ public class DictController {
|
||||
*/
|
||||
@SysLog("修改字典项")
|
||||
@PutMapping("/item")
|
||||
@CacheEvict(value = "dict_details", allEntries = true)
|
||||
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
||||
public R updateById(@RequestBody SysDictItem sysDictItem) {
|
||||
return new R<>(sysDictItemService.updateById(sysDictItem));
|
||||
}
|
||||
@@ -187,7 +188,7 @@ public class DictController {
|
||||
*/
|
||||
@SysLog("删除字典项")
|
||||
@DeleteMapping("/item/{id}")
|
||||
@CacheEvict(value = "dict_details", allEntries = true)
|
||||
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
||||
public R removeDictItemById(@PathVariable Integer id) {
|
||||
return new R<>(sysDictItemService.removeById(id));
|
||||
}
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import com.pig4cloud.pigx.admin.api.entity.SysDictItem;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysDictItemMapper;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysDictMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysDictService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,7 +47,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "dict_details", allEntries = true)
|
||||
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean removeDict(Integer id) {
|
||||
baseMapper.deleteById(id);
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'")
|
||||
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")
|
||||
public List<MenuVO> findMenuByRoleId(Integer roleId) {
|
||||
return baseMapper.listMenusByRoleId(roleId);
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#roleId + '_menu'")
|
||||
@CacheEvict(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'")
|
||||
public Boolean saveRoleMenus(String role, Integer roleId, String menuIds) {
|
||||
this.remove(Wrappers.<SysRoleMenu>query().lambda()
|
||||
.eq(SysRoleMenu::getRoleId, roleId));
|
||||
|
||||
Reference in new issue
Block a user