mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-09 20:57:21 +08:00
refactor: 重构查询角色字典接口
This commit is contained in:
@@ -19,6 +19,7 @@ package top.continew.admin.system.model.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.DataScopeEnum;
|
||||
import top.continew.starter.extension.crud.annotation.DictField;
|
||||
import top.continew.starter.extension.crud.model.entity.BaseDO;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -30,6 +31,7 @@ import java.io.Serial;
|
||||
* @since 2023/2/8 22:54
|
||||
*/
|
||||
@Data
|
||||
@DictField
|
||||
@TableName("sys_role")
|
||||
public class RoleDO extends BaseDO {
|
||||
|
||||
|
@@ -17,14 +17,13 @@
|
||||
package top.continew.admin.system.service;
|
||||
|
||||
import top.continew.admin.common.model.dto.RoleDTO;
|
||||
import top.continew.admin.common.model.resp.LabelValueResp;
|
||||
import top.continew.admin.system.model.entity.RoleDO;
|
||||
import top.continew.admin.system.model.query.RoleQuery;
|
||||
import top.continew.admin.system.model.req.RoleReq;
|
||||
import top.continew.admin.system.model.resp.RoleDetailResp;
|
||||
import top.continew.admin.system.model.resp.RoleResp;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
import top.continew.starter.data.mybatis.plus.service.IService;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -37,14 +36,6 @@ import java.util.Set;
|
||||
*/
|
||||
public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQuery, RoleReq>, IService<RoleDO> {
|
||||
|
||||
/**
|
||||
* 构建字典
|
||||
*
|
||||
* @param list 原始列表数据
|
||||
* @return 字典列表
|
||||
*/
|
||||
List<LabelValueResp<Long>> buildDict(List<RoleResp> list);
|
||||
|
||||
/**
|
||||
* 根据 ID 列表查询
|
||||
*
|
||||
|
@@ -31,7 +31,6 @@ 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;
|
||||
import top.continew.admin.common.model.resp.LabelValueResp;
|
||||
import top.continew.admin.system.mapper.RoleMapper;
|
||||
import top.continew.admin.system.model.entity.RoleDO;
|
||||
import top.continew.admin.system.model.query.RoleQuery;
|
||||
@@ -136,14 +135,6 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LabelValueResp<Long>> buildDict(List<RoleResp> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ContainerMethod(namespace = ContainerConstants.USER_ROLE_NAME_LIST, type = MappingType.ORDER_OF_KEYS)
|
||||
public List<String> listNameByIds(List<Long> ids) {
|
||||
|
Reference in New Issue
Block a user