feat:修改icommon

V0.5.x
荭琪枫 2023-06-01 10:17:55 +08:00
parent fa5e281317
commit 4c78784e9d
4 changed files with 17 additions and 29 deletions

View File

@ -57,15 +57,13 @@ public interface ICommonData<T extends Id<ID>, ID> {
/**
* id
*/
default long deleteById(ID id) {
return 0L;
default void deleteById(ID id) {
}
/**
* id
*/
default int deleteByIds(Collection<ID> ids) {
return 0;
default void deleteByIds(Collection<ID> ids) {
}
/**

View File

@ -143,7 +143,7 @@ public interface ISysRoleService {
* @param roleId ID
* @return
*/
int deleteRoleById(Long roleId);
void deleteRoleById(Long roleId);
/**
*
@ -151,7 +151,7 @@ public interface ISysRoleService {
* @param roleIds ID
* @return
*/
int deleteRoleByIds(Long[] roleIds);
void deleteRoleByIds(Long[] roleIds);
/**
*
@ -159,7 +159,7 @@ public interface ISysRoleService {
* @param userRole
* @return
*/
int deleteAuthUser(SysUserRole userRole);
void deleteAuthUser(SysUserRole userRole);
/**
*
@ -168,7 +168,7 @@ public interface ISysRoleService {
* @param userIds ID
* @return
*/
int deleteAuthUsers(Long roleId, Long[] userIds);
void deleteAuthUsers(Long roleId, Long[] userIds);
/**
*
@ -177,7 +177,7 @@ public interface ISysRoleService {
* @param userIds ID
* @return
*/
int insertAuthUsers(Long roleId, Long[] userIds);
void insertAuthUsers(Long roleId, Long[] userIds);
void cleanOnlineUserByRole(Long roleId);
}

View File

@ -322,7 +322,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
*
*
* @param bo
* @return
*/
@Override
public void insertMenu(SysMenuBo bo) {
@ -333,7 +332,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
*
*
* @param bo
* @return
*/
@Override
public void updateMenu(SysMenuBo bo) {
@ -344,7 +342,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
*
*
* @param menuId ID
* @return
*/
@Override
public void deleteMenuById(Long menuId) {
@ -354,7 +351,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
/**
*
*
* @param menu
* @param bo
* @return
*/
@Override

View File

@ -35,12 +35,11 @@ import java.util.*;
*
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@RequiredArgsConstructor
public class SysRoleServiceImpl implements ISysRoleService {
private final ISysRoleData iSysRoleData;
private final ISysRoleMenuData iSysRoleMenuData;
private final ISysUserRoleData iSysUserRoleData;
private final ISysRoleDeptData iSysRoleDeptData;
@ -238,7 +237,6 @@ public class SysRoleServiceImpl implements ISysRoleService {
*
* @param roleId ID
* @param status
* @return
*/
@Override
public void updateRoleStatus(Long roleId, String status) {
@ -296,7 +294,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
private int insertRoleDept(SysRoleBo role) {
long rows = 1;
// 新增角色与部门(数据权限)管理
List<SysRoleDept> list = new ArrayList<SysRoleDept>();
List<SysRoleDept> list = new ArrayList<>();
for (Long deptId : role.getDeptIds()) {
SysRoleDept rd = new SysRoleDept();
rd.setRoleId(role.getRoleId());
@ -313,17 +311,15 @@ public class SysRoleServiceImpl implements ISysRoleService {
* ID
*
* @param roleId ID
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteRoleById(Long roleId) {
public void deleteRoleById(Long roleId) {
// 删除角色与菜单关联
iSysRoleMenuData.deleteByRoleId(List.of(roleId));
// 删除角色与部门关联
iSysRoleDeptData.deleteByRoleId(List.of(roleId));
long num = iSysRoleData.deleteById(roleId);
return Integer.parseInt(num + "");
iSysRoleData.deleteById(roleId);
}
/**
@ -334,7 +330,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteRoleByIds(Long[] roleIds) {
public void deleteRoleByIds(Long[] roleIds) {
for (Long roleId : roleIds) {
checkRoleAllowed(roleId);
checkRoleDataScope(roleId);
@ -348,7 +344,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
iSysRoleMenuData.deleteByRoleId(ids);
// 删除角色与部门关联
iSysRoleDeptData.deleteByRoleId(ids);
return iSysRoleData.deleteByIds(ids);
iSysRoleData.deleteByIds(ids);
}
/**
@ -358,12 +354,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
* @return
*/
@Override
public int deleteAuthUser(SysUserRole userRole) {
public void deleteAuthUser(SysUserRole userRole) {
long rows = iSysUserRoleData.delete(userRole.getRoleId(), List.of(userRole.getUserId()));
if (rows > 0) {
cleanOnlineUserByRole(userRole.getRoleId());
}
return Integer.parseInt(rows + "");
}
/**
@ -374,12 +369,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
* @return
*/
@Override
public int deleteAuthUsers(Long roleId, Long[] userIds) {
public void deleteAuthUsers(Long roleId, Long[] userIds) {
long rows = iSysUserRoleData.delete(roleId, Arrays.asList(userIds));
if (rows > 0) {
cleanOnlineUserByRole(roleId);
}
return Integer.parseInt(rows + "");
}
/**
@ -390,7 +384,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
* @return
*/
@Override
public int insertAuthUsers(Long roleId, Long[] userIds) {
public void insertAuthUsers(Long roleId, Long[] userIds) {
// 新增用户与角色管理
long rows = 1;
List<SysUserRole> list = StreamUtils.toList(List.of(userIds), userId -> {
@ -405,7 +399,6 @@ public class SysRoleServiceImpl implements ISysRoleService {
if (rows > 0) {
cleanOnlineUserByRole(roleId);
}
return Integer.parseInt(rows + "");
}
@Override