|
@@ -25,6 +25,8 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
|
|
import com.pig4cloud.pigx.admin.mapper.SysRoleMenuMapper;
|
|
|
import com.pig4cloud.pigx.admin.service.SysRoleMenuService;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.cache.CacheManager;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -41,9 +43,11 @@ import java.util.List;
|
|
|
* @since 2017-10-29
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService {
|
|
|
+ private CacheManager cacheManager;
|
|
|
+
|
|
|
/**
|
|
|
- *
|
|
|
* @param role
|
|
|
* @param roleId 角色
|
|
|
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
|
|
@@ -57,7 +61,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|
|
this.delete(new EntityWrapper<>(condition));
|
|
|
List<SysRoleMenu> roleMenuList = new ArrayList<>();
|
|
|
List<String> menuIdList = Arrays.asList(menuIds.split(","));
|
|
|
- if(CollUtil.isEmpty(menuIdList)){
|
|
|
+ if (CollUtil.isEmpty(menuIdList)) {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
for (String menuId : menuIdList) {
|
|
@@ -66,6 +70,9 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|
|
roleMenu.setMenuId(Integer.valueOf(menuId));
|
|
|
roleMenuList.add(roleMenu);
|
|
|
}
|
|
|
+
|
|
|
+ //清空userinfo
|
|
|
+ cacheManager.getCache("user_details").clear();
|
|
|
return this.insertBatch(roleMenuList);
|
|
|
}
|
|
|
}
|