yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
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
package com.qianwen.smartman.modules.system.wrapper;
 
import java.util.List;
import java.util.Objects;
import com.qianwen.smartman.common.cache.DictCache;
import com.qianwen.smartman.common.cache.SysCache;
import com.qianwen.smartman.common.enums.DictEnum;
import com.qianwen.core.mp.support.BaseEntityWrapper;
import com.qianwen.core.tool.utils.BeanUtil;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.system.entity.Tenant;
import com.qianwen.smartman.modules.system.entity.User;
import com.qianwen.smartman.modules.system.vo.UserVO;
 
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/wrapper/UserWrapper.class */
public class UserWrapper extends BaseEntityWrapper<User, UserVO> {
    public static UserWrapper build() {
        return new UserWrapper();
    }
 
    public UserVO entityVO(User user) {
        UserVO userVO = (UserVO) Objects.requireNonNull(BeanUtil.copy(user, UserVO.class));
        Tenant tenant = SysCache.getTenant(user.getTenantId());
        List<String> roleName = SysCache.getRoleNames(user.getRoleId());
        List<String> deptName = SysCache.getDeptNames(user.getDeptId());
        List<String> postName = SysCache.getPostNames(user.getPostId());
        userVO.setTenantName(tenant.getTenantName());
        userVO.setRoleName(Func.join(roleName));
        userVO.setDeptName(Func.join(deptName));
        userVO.setPostName(Func.join(postName));
        userVO.setSexName(DictCache.getValue(DictEnum.SEX, user.getSex()));
        userVO.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE, user.getUserType()));
        return userVO;
    }
}