mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-08 12:57:13 +08:00
@@ -17,6 +17,7 @@
|
||||
package top.continew.admin.system.model.resp.role;
|
||||
|
||||
import cn.crane4j.annotation.Assemble;
|
||||
import cn.crane4j.annotation.Mapping;
|
||||
import cn.crane4j.core.executor.handler.ManyToManyAssembleOperationHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -114,7 +115,7 @@ public class RoleUserResp implements Serializable {
|
||||
* 角色 ID 列表
|
||||
*/
|
||||
@Schema(description = "角色 ID 列表", example = "2")
|
||||
@Assemble(prop = ":roleNames", container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
@Assemble(props = @Mapping(src = "name", ref = "roleNames"), container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
private List<Long> roleIds;
|
||||
|
||||
/**
|
||||
|
@@ -105,7 +105,7 @@ public class UserDetailResp extends BaseDetailResp {
|
||||
* 角色 ID 列表
|
||||
*/
|
||||
@Schema(description = "角色 ID 列表", example = "2")
|
||||
@Assemble(prop = ":roleNames", container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
@Assemble(props = @Mapping(src = "name", ref = "roleNames"), container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
@ExcelProperty(value = "角色 ID 列表", converter = ExcelListConverter.class, order = 8)
|
||||
private List<Long> roleIds;
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package top.continew.admin.system.model.resp.user;
|
||||
|
||||
import cn.crane4j.annotation.Assemble;
|
||||
import cn.crane4j.annotation.Mapping;
|
||||
import cn.crane4j.core.executor.handler.ManyToManyAssembleOperationHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -118,7 +119,7 @@ public class UserResp extends BaseDetailResp {
|
||||
* 角色 ID 列表
|
||||
*/
|
||||
@Schema(description = "角色 ID 列表", example = "2")
|
||||
@Assemble(prop = ":roleNames", container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
@Assemble(props = @Mapping(src = "name", ref = "roleNames"), container = ContainerConstants.USER_ROLE_NAME_LIST, handlerType = ManyToManyAssembleOperationHandler.class)
|
||||
private List<Long> roleIds;
|
||||
|
||||
/**
|
||||
|
@@ -67,7 +67,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ
|
||||
* @param ids ID 列表
|
||||
* @return 名称列表
|
||||
*/
|
||||
List<String> listNameByIds(List<Long> ids);
|
||||
List<RoleDO> listNameByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据用户 ID 查询角色编码
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package top.continew.admin.system.service.impl;
|
||||
|
||||
import cn.crane4j.annotation.ContainerMethod;
|
||||
import cn.crane4j.annotation.MappingType;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alicp.jetcache.anno.CacheInvalidate;
|
||||
@@ -167,13 +166,12 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
}
|
||||
|
||||
@Override
|
||||
@ContainerMethod(namespace = ContainerConstants.USER_ROLE_NAME_LIST, type = MappingType.ORDER_OF_KEYS)
|
||||
public List<String> listNameByIds(List<Long> ids) {
|
||||
@ContainerMethod(namespace = ContainerConstants.USER_ROLE_NAME_LIST, resultType = RoleDO.class)
|
||||
public List<RoleDO> listNameByIds(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<RoleDO> roleList = baseMapper.lambdaQuery().select(RoleDO::getName).in(RoleDO::getId, ids).list();
|
||||
return roleList.stream().map(RoleDO::getName).toList();
|
||||
return baseMapper.lambdaQuery().select(RoleDO::getName, RoleDO::getId).in(RoleDO::getId, ids).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user