commit | author | age
|
9bcb19
|
1 |
package vip.xiaonuo.sys.modular.user.wrapper; |
I |
2 |
|
|
3 |
import cn.hutool.core.util.ObjectUtil; |
|
4 |
import vip.xiaonuo.core.context.constant.ConstantContextHolder; |
|
5 |
import vip.xiaonuo.core.pojo.base.wrapper.BaseWrapper; |
|
6 |
import vip.xiaonuo.core.util.CryptogramUtil; |
|
7 |
import vip.xiaonuo.sys.modular.user.result.SysUserResult; |
|
8 |
|
|
9 |
import java.util.HashMap; |
|
10 |
import java.util.Map; |
|
11 |
|
|
12 |
|
|
13 |
/** |
|
14 |
* 用户管理的包装类 |
|
15 |
* |
|
16 |
* @author yubaoshan |
|
17 |
*/ |
|
18 |
public class SysUserWrapper implements BaseWrapper<SysUserResult> { |
|
19 |
|
|
20 |
@Override |
|
21 |
public Map<String, Object> doWrap(SysUserResult sysUserResult) { |
|
22 |
Map<String, Object> map = new HashMap<>(); |
|
23 |
|
|
24 |
// 是否开启用户表字段加解密,如果是被加密的,返回列表时需要脱敏 |
|
25 |
if (ConstantContextHolder.getCryptogramConfigs().getFieldEncDec()) { |
|
26 |
if (ObjectUtil.isNotEmpty(sysUserResult.getPhone())) { |
|
27 |
map.put("phone", CryptogramUtil.doDecrypt(sysUserResult.getPhone())); |
|
28 |
} |
|
29 |
} |
|
30 |
|
|
31 |
// 下面这里其他的字段,需要做翻译脱敏的,下面处理即可 |
|
32 |
|
|
33 |
return map; |
|
34 |
} |
|
35 |
|
|
36 |
} |