feat: REQ-1650
This commit is contained in:
parent
29c75710ca
commit
d252f9f230
@ -46,6 +46,7 @@ public interface TyrSaasRoleApi {
|
||||
|
||||
/**
|
||||
* 获取角色列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/saasRole/query")
|
||||
@ -55,18 +56,33 @@ public interface TyrSaasRoleApi {
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/api/saasRole/delete")
|
||||
ApiResult delete(@RequestBody List<Long> id);
|
||||
@Deprecated
|
||||
ApiResult<Void> delete(@RequestBody List<Long> id);
|
||||
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param roleIds 待删除角色集合
|
||||
* @param workSpaceId 待删除角色所属workSpaceId
|
||||
* @param outId 待删除角色所属单位ID
|
||||
*/
|
||||
@PostMapping("/api/saasRole/strict/delete")
|
||||
ApiResult<Void> deleteRole(@RequestParam(required = true) List<Long> roleIds,
|
||||
@RequestParam(required = true) Long workSpaceId, @RequestParam(required = true) Long outId);
|
||||
|
||||
/**
|
||||
* 根据身份id身份类型查询权限列表(只返回角色信息)
|
||||
*
|
||||
* @param identityType 身份类型 1:工人 2:班组长 3:从业人员 4:监管人员 5:运营人员
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/api/saasRole/queryByIdentityIdType")
|
||||
ApiResult<List<SaasRoleVO>> queryByIdentityIdType(@RequestParam(required = true) Long identityId,@RequestParam(required = true) Integer identityType,@RequestParam(required = true) Long workspaceId,@RequestParam(required = true) Long ouId,@RequestParam(required = true) Boolean includePermissionGroup);
|
||||
ApiResult<List<SaasRoleVO>> queryByIdentityIdType(@RequestParam(required = true) Long identityId, @RequestParam(required = true) Integer identityType, @RequestParam(required = true) Long workspaceId, @RequestParam(required = true) Long ouId, @RequestParam(required = true) Boolean includePermissionGroup);
|
||||
|
||||
/**
|
||||
* 根据身份id身份类型查询权限列表(批量,只返回角色信息)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/saasRole/queryBatchByIdentityIdType")
|
||||
@ -74,6 +90,7 @@ public interface TyrSaasRoleApi {
|
||||
|
||||
/**
|
||||
* 根据身份id身份类型查询是否为超管
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/saasRole/isSuperAdmin")
|
||||
@ -81,24 +98,24 @@ public interface TyrSaasRoleApi {
|
||||
|
||||
/**
|
||||
* 通过角色名字获取角色信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/saasRole/findRoleByName")
|
||||
ApiResult<List<QueryRoleByNameResp>> findRoleByName(@RequestBody @Valid QueryRoleByNameReq req);
|
||||
|
||||
|
||||
/** 分页查询角色含用户 **/
|
||||
/**
|
||||
* 分页查询角色含用户
|
||||
**/
|
||||
@PostMapping("/api/saasRole/queryWithUser")
|
||||
ApiPageResult<RoleWithUserRes> queryRoleWithUser(@RequestBody RoleWithUserQueryReq req);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 通过工作台类型获取对应的标准角
|
||||
*
|
||||
* */
|
||||
*/
|
||||
@GetMapping("/api/saasRole/queryByWorkspaceType")
|
||||
ApiResult<List<SaasRoleAndGroupVO>> queryInitRoleByWorkspaceId(@RequestParam ("workspaceType")String workspaceType);
|
||||
ApiResult<List<SaasRoleAndGroupVO>> queryInitRoleByWorkspaceId(@RequestParam("workspaceType") String workspaceType);
|
||||
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ public class PlatAccountChangeLogResp {
|
||||
|
||||
/**
|
||||
* 变更类型
|
||||
* @see cn.axzo.tyr.client.model.enums.ChangeType
|
||||
*/
|
||||
private String changeType;
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ import java.util.List;
|
||||
* 权限
|
||||
*
|
||||
* @version V1.0
|
||||
* @author: ZhanSiHu
|
||||
* @date: 2023/9/6 14:55
|
||||
* @author ZhanSiHu
|
||||
* @date 2023/9/6 14:55
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -64,8 +64,14 @@ public class SaasRoleController implements TyrSaasRoleApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult delete(List<Long> id) {
|
||||
return null;
|
||||
public ApiResult<Void> deleteRole(List<Long> roleIds,Long workSpaceId,Long outId) {
|
||||
roleService.deleteRole(roleIds,workSpaceId,outId);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<Void> delete(List<Long> roleIds) {
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -78,4 +78,12 @@ public interface RoleService {
|
||||
|
||||
|
||||
List<SaasRoleAndGroupVO> queryInitRoleByWorkspaceId(String workspaceType);
|
||||
|
||||
/**
|
||||
* 删除角色列表
|
||||
* @param roleIds 待删除角色集合
|
||||
* @param workSpaceId 待删除角色所属workSpaceId
|
||||
* @param outId 待删除角色所属单位ID
|
||||
*/
|
||||
void deleteRole(List<Long> roleIds,Long workSpaceId,Long outId);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||
import cn.axzo.tyr.client.common.enums.RoleTypeEnum;
|
||||
import cn.axzo.tyr.client.model.BaseWorkspaceModel;
|
||||
import cn.axzo.tyr.client.model.enums.IdentityType;
|
||||
import cn.axzo.tyr.client.model.enums.PermissionGroupType;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
@ -589,4 +590,19 @@ public class RoleServiceImpl implements RoleService {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRole(List<Long> roleIds,Long workSpaceId,Long ouId) {
|
||||
List<SaasRoleUserRelation> saasRoleUserRelations = roleUserRelationDao.lambdaQuery()
|
||||
.in(CollectionUtil.isNotEmpty(roleIds),SaasRoleUserRelation::getRoleId,roleIds)
|
||||
.eq(workSpaceId !=null, SaasRoleUserRelation::getWorkspaceId, workSpaceId)
|
||||
.eq(ouId!=null, SaasRoleUserRelation::getOuId, ouId)
|
||||
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value)
|
||||
.list();
|
||||
|
||||
if(CollectionUtil.isNotEmpty(saasRoleUserRelations)){
|
||||
throw new cn.axzo.framework.domain.ServiceException("该角色下存在关联成员,无法进行删除!");
|
||||
}
|
||||
roleUserRelationDao.deleteByRoldId(roleIds);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user