feat:修改icommon
parent
fa5e281317
commit
4c78784e9d
|
@ -57,15 +57,13 @@ public interface ICommonData<T extends Id<ID>, ID> {
|
||||||
/**
|
/**
|
||||||
* 按id删除
|
* 按id删除
|
||||||
*/
|
*/
|
||||||
default long deleteById(ID id) {
|
default void deleteById(ID id) {
|
||||||
return 0L;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按id批量删除
|
* 按id批量删除
|
||||||
*/
|
*/
|
||||||
default int deleteByIds(Collection<ID> ids) {
|
default void deleteByIds(Collection<ID> ids) {
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -143,7 +143,7 @@ public interface ISysRoleService {
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteRoleById(Long roleId);
|
void deleteRoleById(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除角色信息
|
* 批量删除角色信息
|
||||||
|
@ -151,7 +151,7 @@ public interface ISysRoleService {
|
||||||
* @param roleIds 需要删除的角色ID
|
* @param roleIds 需要删除的角色ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteRoleByIds(Long[] roleIds);
|
void deleteRoleByIds(Long[] roleIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权用户角色
|
* 取消授权用户角色
|
||||||
|
@ -159,7 +159,7 @@ public interface ISysRoleService {
|
||||||
* @param userRole 用户和角色关联信息
|
* @param userRole 用户和角色关联信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteAuthUser(SysUserRole userRole);
|
void deleteAuthUser(SysUserRole userRole);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量取消授权用户角色
|
* 批量取消授权用户角色
|
||||||
|
@ -168,7 +168,7 @@ public interface ISysRoleService {
|
||||||
* @param userIds 需要取消授权的用户数据ID
|
* @param userIds 需要取消授权的用户数据ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteAuthUsers(Long roleId, Long[] userIds);
|
void deleteAuthUsers(Long roleId, Long[] userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择授权用户角色
|
* 批量选择授权用户角色
|
||||||
|
@ -177,7 +177,7 @@ public interface ISysRoleService {
|
||||||
* @param userIds 需要删除的用户数据ID
|
* @param userIds 需要删除的用户数据ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insertAuthUsers(Long roleId, Long[] userIds);
|
void insertAuthUsers(Long roleId, Long[] userIds);
|
||||||
|
|
||||||
void cleanOnlineUserByRole(Long roleId);
|
void cleanOnlineUserByRole(Long roleId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
* 新增保存菜单信息
|
* 新增保存菜单信息
|
||||||
*
|
*
|
||||||
* @param bo 菜单信息
|
* @param bo 菜单信息
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insertMenu(SysMenuBo bo) {
|
public void insertMenu(SysMenuBo bo) {
|
||||||
|
@ -333,7 +332,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
* 修改保存菜单信息
|
* 修改保存菜单信息
|
||||||
*
|
*
|
||||||
* @param bo 菜单信息
|
* @param bo 菜单信息
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateMenu(SysMenuBo bo) {
|
public void updateMenu(SysMenuBo bo) {
|
||||||
|
@ -344,7 +342,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
* 删除菜单管理信息
|
* 删除菜单管理信息
|
||||||
*
|
*
|
||||||
* @param menuId 菜单ID
|
* @param menuId 菜单ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteMenuById(Long menuId) {
|
public void deleteMenuById(Long menuId) {
|
||||||
|
@ -354,7 +351,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
/**
|
/**
|
||||||
* 校验菜单名称是否唯一
|
* 校验菜单名称是否唯一
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param bo 菜单信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,12 +35,11 @@ import java.util.*;
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class SysRoleServiceImpl implements ISysRoleService {
|
public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
|
|
||||||
private final ISysRoleData iSysRoleData;
|
private final ISysRoleData iSysRoleData;
|
||||||
|
|
||||||
private final ISysRoleMenuData iSysRoleMenuData;
|
private final ISysRoleMenuData iSysRoleMenuData;
|
||||||
private final ISysUserRoleData iSysUserRoleData;
|
private final ISysUserRoleData iSysUserRoleData;
|
||||||
private final ISysRoleDeptData iSysRoleDeptData;
|
private final ISysRoleDeptData iSysRoleDeptData;
|
||||||
|
@ -238,7 +237,6 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @param status 角色状态
|
* @param status 角色状态
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateRoleStatus(Long roleId, String status) {
|
public void updateRoleStatus(Long roleId, String status) {
|
||||||
|
@ -296,7 +294,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
private int insertRoleDept(SysRoleBo role) {
|
private int insertRoleDept(SysRoleBo role) {
|
||||||
long rows = 1;
|
long rows = 1;
|
||||||
// 新增角色与部门(数据权限)管理
|
// 新增角色与部门(数据权限)管理
|
||||||
List<SysRoleDept> list = new ArrayList<SysRoleDept>();
|
List<SysRoleDept> list = new ArrayList<>();
|
||||||
for (Long deptId : role.getDeptIds()) {
|
for (Long deptId : role.getDeptIds()) {
|
||||||
SysRoleDept rd = new SysRoleDept();
|
SysRoleDept rd = new SysRoleDept();
|
||||||
rd.setRoleId(role.getRoleId());
|
rd.setRoleId(role.getRoleId());
|
||||||
|
@ -313,17 +311,15 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
* 通过角色ID删除角色
|
* 通过角色ID删除角色
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRoleById(Long roleId) {
|
public void deleteRoleById(Long roleId) {
|
||||||
// 删除角色与菜单关联
|
// 删除角色与菜单关联
|
||||||
iSysRoleMenuData.deleteByRoleId(List.of(roleId));
|
iSysRoleMenuData.deleteByRoleId(List.of(roleId));
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
iSysRoleDeptData.deleteByRoleId(List.of(roleId));
|
iSysRoleDeptData.deleteByRoleId(List.of(roleId));
|
||||||
long num = iSysRoleData.deleteById(roleId);
|
iSysRoleData.deleteById(roleId);
|
||||||
return Integer.parseInt(num + "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,7 +330,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRoleByIds(Long[] roleIds) {
|
public void deleteRoleByIds(Long[] roleIds) {
|
||||||
for (Long roleId : roleIds) {
|
for (Long roleId : roleIds) {
|
||||||
checkRoleAllowed(roleId);
|
checkRoleAllowed(roleId);
|
||||||
checkRoleDataScope(roleId);
|
checkRoleDataScope(roleId);
|
||||||
|
@ -348,7 +344,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
iSysRoleMenuData.deleteByRoleId(ids);
|
iSysRoleMenuData.deleteByRoleId(ids);
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
iSysRoleDeptData.deleteByRoleId(ids);
|
iSysRoleDeptData.deleteByRoleId(ids);
|
||||||
return iSysRoleData.deleteByIds(ids);
|
iSysRoleData.deleteByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -358,12 +354,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAuthUser(SysUserRole userRole) {
|
public void deleteAuthUser(SysUserRole userRole) {
|
||||||
long rows = iSysUserRoleData.delete(userRole.getRoleId(), List.of(userRole.getUserId()));
|
long rows = iSysUserRoleData.delete(userRole.getRoleId(), List.of(userRole.getUserId()));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
cleanOnlineUserByRole(userRole.getRoleId());
|
cleanOnlineUserByRole(userRole.getRoleId());
|
||||||
}
|
}
|
||||||
return Integer.parseInt(rows + "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -374,12 +369,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAuthUsers(Long roleId, Long[] userIds) {
|
public void deleteAuthUsers(Long roleId, Long[] userIds) {
|
||||||
long rows = iSysUserRoleData.delete(roleId, Arrays.asList(userIds));
|
long rows = iSysUserRoleData.delete(roleId, Arrays.asList(userIds));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
cleanOnlineUserByRole(roleId);
|
cleanOnlineUserByRole(roleId);
|
||||||
}
|
}
|
||||||
return Integer.parseInt(rows + "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,7 +384,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertAuthUsers(Long roleId, Long[] userIds) {
|
public void insertAuthUsers(Long roleId, Long[] userIds) {
|
||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
long rows = 1;
|
long rows = 1;
|
||||||
List<SysUserRole> list = StreamUtils.toList(List.of(userIds), userId -> {
|
List<SysUserRole> list = StreamUtils.toList(List.of(userIds), userId -> {
|
||||||
|
@ -405,7 +399,6 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
cleanOnlineUserByRole(roleId);
|
cleanOnlineUserByRole(roleId);
|
||||||
}
|
}
|
||||||
return Integer.parseInt(rows + "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue