yangys
2024-03-31 53c8d3e3bd3596132b362f20e52aef380d493a84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.qianwen.smartman.modules.system.wrapper;
 
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.qianwen.smartman.common.cache.SysCache;
import com.qianwen.core.mp.support.BaseEntityWrapper;
import com.qianwen.core.tool.constant.BladeConstant;
import com.qianwen.core.tool.node.ForestNodeMerger;
import com.qianwen.core.tool.utils.BeanUtil;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.system.entity.Role;
import com.qianwen.smartman.modules.system.vo.RoleVO;
 
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/wrapper/RoleWrapper.class */
public class RoleWrapper extends BaseEntityWrapper<Role, RoleVO> {
    public static RoleWrapper build() {
        return new RoleWrapper();
    }
 
    public RoleVO entityVO(Role role) {
        RoleVO roleVO = (RoleVO) Objects.requireNonNull(BeanUtil.copy(role, RoleVO.class));
        if (Func.equals(role.getParentId(), BladeConstant.TOP_PARENT_ID)) {
            roleVO.setParentName("顶级");
        } else {
            Role parent = SysCache.getRole(role.getParentId());
            roleVO.setParentName(parent.getRoleName());
        }
        return roleVO;
    }
 
    public List<RoleVO> listNodeVO(List<Role> list) {
        List<RoleVO> collect = (List) list.stream().map(this::entityVO).collect(Collectors.toList());
        return ForestNodeMerger.merge(collect);
    }
}