mirror of https://gitee.com/maxjhandsome/pig
fixed: @CacheEvict(value = "menu_details",allEntries = true)
This commit is contained in:
parent
fb5489d617
commit
8c0b835bb2
|
@ -9,6 +9,7 @@ import com.github.pig.common.constant.CommonConstant;
|
||||||
import com.github.pig.common.vo.MenuVo;
|
import com.github.pig.common.vo.MenuVo;
|
||||||
import com.github.pig.common.web.BaseController;
|
import com.github.pig.common.web.BaseController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -93,6 +94,7 @@ public class MenuController extends BaseController {
|
||||||
* TODO 级联删除下级节点
|
* TODO 级联删除下级节点
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
|
@CacheEvict(value = "menu_details",allEntries = true)
|
||||||
public Boolean menuDel(@PathVariable Integer id) {
|
public Boolean menuDel(@PathVariable Integer id) {
|
||||||
// 删除当前节点
|
// 删除当前节点
|
||||||
SysMenu condition1 = new SysMenu();
|
SysMenu condition1 = new SysMenu();
|
||||||
|
@ -110,6 +112,7 @@ public class MenuController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@CacheEvict(value = "menu_details",allEntries = true)
|
||||||
public Boolean menuUpdate(@RequestBody SysMenu sysMenu) {
|
public Boolean menuUpdate(@RequestBody SysMenu sysMenu) {
|
||||||
return menuService.updateById(sysMenu);
|
return menuService.updateById(sysMenu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class RoleController extends BaseController {
|
||||||
* @return success、false
|
* @return success、false
|
||||||
*/
|
*/
|
||||||
@PutMapping("/roleMenuUpd")
|
@PutMapping("/roleMenuUpd")
|
||||||
@CacheEvict(value = "menu_details", key = "#role +'_menu'")
|
@CacheEvict(value = "menu_details",allEntries = true)
|
||||||
public Boolean roleMenuUpd(Integer roleId, @RequestParam("menuIds[]") Integer[] menuIds) {
|
public Boolean roleMenuUpd(Integer roleId, @RequestParam("menuIds[]") Integer[] menuIds) {
|
||||||
SysRoleMenu condition = new SysRoleMenu();
|
SysRoleMenu condition = new SysRoleMenu();
|
||||||
condition.setRoleId(roleId);
|
condition.setRoleId(roleId);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.github.pig.admin.service.SysMenuService;
|
||||||
import com.github.pig.common.vo.MenuVo;
|
import com.github.pig.common.vo.MenuVo;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -26,7 +27,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
private SysMenuMapper sysMenuMapper;
|
private SysMenuMapper sysMenuMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//@Cacheable(value = "menu_details", key = "#role +'_menu'")
|
@Cacheable(value = "menu_details", key = "#role + #type + '_menu'")
|
||||||
public Set<MenuVo> findMenuByRole(String role, Integer type) {
|
public Set<MenuVo> findMenuByRole(String role, Integer type) {
|
||||||
return sysMenuMapper.findMenuByRoleName(role, type);
|
return sysMenuMapper.findMenuByRoleName(role, type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue