优化代码
This commit is contained in:
parent
85d66191a5
commit
a473a7702f
File diff suppressed because it is too large
Load Diff
@ -119,7 +119,7 @@ public class DataScopeAspect
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||||
sqlString.append(" OR 1=0 ");
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
public boolean hasChildByDeptId(Long deptId)
|
public boolean hasChildByDeptId(Long deptId)
|
||||||
{
|
{
|
||||||
int result = deptMapper.hasChildByDeptId(deptId);
|
int result = deptMapper.hasChildByDeptId(deptId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -259,7 +259,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
public boolean hasChildByMenuId(Long menuId)
|
public boolean hasChildByMenuId(Long menuId)
|
||||||
{
|
{
|
||||||
int result = menuMapper.hasChildByMenuId(menuId);
|
int result = menuMapper.hasChildByMenuId(menuId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,7 +272,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
public boolean checkMenuExistRole(Long menuId)
|
public boolean checkMenuExistRole(Long menuId)
|
||||||
{
|
{
|
||||||
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,23 +381,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
*/
|
*/
|
||||||
public void insertUserRole(SysUser user)
|
public void insertUserRole(SysUser user)
|
||||||
{
|
{
|
||||||
Long[] roles = user.getRoleIds();
|
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
||||||
if (StringUtils.isNotNull(roles))
|
|
||||||
{
|
|
||||||
// 新增用户与角色管理
|
|
||||||
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
|
||||||
for (Long roleId : roles)
|
|
||||||
{
|
|
||||||
SysUserRole ur = new SysUserRole();
|
|
||||||
ur.setUserId(user.getUserId());
|
|
||||||
ur.setRoleId(roleId);
|
|
||||||
list.add(ur);
|
|
||||||
}
|
|
||||||
if (list.size() > 0)
|
|
||||||
{
|
|
||||||
userRoleMapper.batchUserRole(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,10 +392,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
public void insertUserPost(SysUser user)
|
public void insertUserPost(SysUser user)
|
||||||
{
|
{
|
||||||
Long[] posts = user.getPostIds();
|
Long[] posts = user.getPostIds();
|
||||||
if (StringUtils.isNotNull(posts))
|
if (StringUtils.isNotEmpty(posts))
|
||||||
{
|
{
|
||||||
// 新增用户与岗位管理
|
// 新增用户与岗位管理
|
||||||
List<SysUserPost> list = new ArrayList<SysUserPost>();
|
List<SysUserPost> list = new ArrayList<SysUserPost>(posts.length);
|
||||||
for (Long postId : posts)
|
for (Long postId : posts)
|
||||||
{
|
{
|
||||||
SysUserPost up = new SysUserPost();
|
SysUserPost up = new SysUserPost();
|
||||||
@ -419,10 +403,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
up.setPostId(postId);
|
up.setPostId(postId);
|
||||||
list.add(up);
|
list.add(up);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
userPostMapper.batchUserPost(list);
|
||||||
{
|
|
||||||
userPostMapper.batchUserPost(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,10 +415,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
*/
|
*/
|
||||||
public void insertUserRole(Long userId, Long[] roleIds)
|
public void insertUserRole(Long userId, Long[] roleIds)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(roleIds))
|
if (StringUtils.isNotEmpty(roleIds))
|
||||||
{
|
{
|
||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
List<SysUserRole> list = new ArrayList<SysUserRole>(roleIds.length);
|
||||||
for (Long roleId : roleIds)
|
for (Long roleId : roleIds)
|
||||||
{
|
{
|
||||||
SysUserRole ur = new SysUserRole();
|
SysUserRole ur = new SysUserRole();
|
||||||
@ -445,10 +426,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
ur.setRoleId(roleId);
|
ur.setRoleId(roleId);
|
||||||
list.add(ur);
|
list.add(ur);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
userRoleMapper.batchUserRole(list);
|
||||||
{
|
|
||||||
userRoleMapper.batchUserRole(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user