提交 6f1ab99c 编写于 作者: sq3536's avatar sq3536

基础功能角色

上级 345aaf95
...@@ -7,6 +7,8 @@ import liquibase.util.StringUtils; ...@@ -7,6 +7,8 @@ import liquibase.util.StringUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.core.uaa.domain.SysRole; import cn.ibizlab.core.uaa.domain.SysRole;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -30,11 +32,10 @@ public class SysRoleExService extends SysRoleServiceImpl { ...@@ -30,11 +32,10 @@ public class SysRoleExService extends SysRoleServiceImpl {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1); return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
} }
private List<SysRole> allSysRoles;
@Cacheable(value ="sysrole", key = "'alls'")
public synchronized List<SysRole> getAllSysRoles() public synchronized List<SysRole> getAllSysRoles()
{ {
if(allSysRoles==null) {
List<SysRole> sysRoles = this.list(); List<SysRole> sysRoles = this.list();
Boolean bBaseUsers=false; Boolean bBaseUsers=false;
for (SysRole role:sysRoles) for (SysRole role:sysRoles)
...@@ -51,32 +52,30 @@ public class SysRoleExService extends SysRoleServiceImpl { ...@@ -51,32 +52,30 @@ public class SysRoleExService extends SysRoleServiceImpl {
this.create(role); this.create(role);
sysRoles.add(role); sysRoles.add(role);
} }
allSysRoles=sysRoles; return sysRoles;
}
return allSysRoles;
} }
@Override @Override
@CacheEvict(value ="sysrole", key = "'alls'")
public boolean create(SysRole et) { public boolean create(SysRole et) {
allSysRoles=null;
return super.create(et); return super.create(et);
} }
@Override @Override
@CacheEvict(value ="sysrole", key = "'alls'")
public void createBatch(List<SysRole> list) { public void createBatch(List<SysRole> list) {
allSysRoles=null;
super.createBatch(list); super.createBatch(list);
} }
@Override @Override
@CacheEvict(value ="sysrole", key = "'alls'")
public boolean update(SysRole et) { public boolean update(SysRole et) {
allSysRoles=null;
return super.update(et); return super.update(et);
} }
@Override @Override
@CacheEvict(value ="sysrole", key = "'alls'")
public void updateBatch(List<SysRole> list) { public void updateBatch(List<SysRole> list) {
allSysRoles=null;
super.updateBatch(list); super.updateBatch(list);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册