Skip to content

Commit

Permalink
fix: 还原被自动清理的crane4j所需方法
Browse files Browse the repository at this point in the history
  • Loading branch information
jskils committed Jun 19, 2024
1 parent 45d969a commit 6d39df4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
*/
public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQuery, RoleReq>, IService<RoleDO> {

/**
* 根据 ID 列表查询
*
* @param ids ID 列表
* @return 名称列表
*/
List<String> listNameByIds(List<Long> ids);

/**
* 根据用户 ID 查询角色编码
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package top.continew.admin.system.service.impl;

import cn.crane4j.annotation.ContainerMethod;
import cn.crane4j.annotation.MappingType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
Expand All @@ -26,6 +28,7 @@
import org.springframework.transaction.annotation.Transactional;
import top.continew.admin.auth.service.OnlineUserService;
import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.common.constant.ContainerConstants;
import top.continew.admin.common.constant.SysConstants;
import top.continew.admin.common.enums.DataScopeEnum;
import top.continew.admin.common.model.dto.RoleDTO;
Expand Down Expand Up @@ -133,6 +136,13 @@ protected void fill(Object obj) {
}
}

@Override
@ContainerMethod(namespace = ContainerConstants.USER_ROLE_NAME_LIST, type = MappingType.ORDER_OF_KEYS)
public List<String> listNameByIds(List<Long> ids) {
List<RoleDO> roleList = baseMapper.lambdaQuery().select(RoleDO::getName).in(RoleDO::getId, ids).list();
return roleList.stream().map(RoleDO::getName).toList();
}

@Override
public Set<String> listCodeByUserId(Long userId) {
List<Long> roleIdList = userRoleService.listRoleIdByUserId(userId);
Expand Down

0 comments on commit 6d39df4

Please sign in to comment.