mirror of https://gitee.com/y_project/RuoYi.git
修复角色权限注解失效问题
parent
efa3dbbd43
commit
1818af2a08
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
@ -11,7 +10,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@MapperScan("com.ruoyi.*.mapper")
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.common.utils.spring;
|
||||
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
|
@ -98,4 +99,16 @@ public final class SpringUtils implements BeanFactoryPostProcessor
|
|||
{
|
||||
return beanFactory.getAliases(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取aop代理对象
|
||||
*
|
||||
* @param invoker
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getAopProxy(T invoker)
|
||||
{
|
||||
return (T) AopContext.currentProxy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.ruoyi.framework.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
* 程序注解配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
// 表示通过aop框架暴露该代理对象,AopContext能够访问
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
// 指定要扫描的Mapper类的包的路径
|
||||
@MapperScan("com.ruoyi.*.mapper")
|
||||
public class ApplicationConfig
|
||||
{
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ import com.ruoyi.common.constant.UserConstants;
|
|||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.exception.BusinessException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
|
@ -110,7 +111,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
@Override
|
||||
public List<SysRole> selectRoleAll()
|
||||
{
|
||||
return selectRoleList(new SysRole());
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,6 +316,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
{
|
||||
return roleMapper.updateRole(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue