yangys
2024-10-30 25db770e621f1259b8d5b7fd514207f7481c2d0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.qianwen.smartman.modules.system.wrapper;
 
import java.util.Objects;
import java.util.Optional;
import com.qianwen.smartman.common.cache.MetaRefObjectTypeCache;
import com.qianwen.core.mp.support.BaseEntityWrapper;
import com.qianwen.core.tool.utils.BeanUtil;
import com.qianwen.smartman.modules.system.entity.MetaObjectTypeField;
import com.qianwen.smartman.modules.system.vo.MetaObjectTypeFieldVO;
 
public class MetaObjectTypeFieldWrapper extends BaseEntityWrapper<MetaObjectTypeField, MetaObjectTypeFieldVO> {
    public static MetaObjectTypeFieldWrapper build() {
        return new MetaObjectTypeFieldWrapper();
    }
 
    public MetaObjectTypeFieldVO entityVO(MetaObjectTypeField entity) {
        MetaObjectTypeFieldVO typeVO = (MetaObjectTypeFieldVO) Objects.requireNonNull(BeanUtil.copy(entity, MetaObjectTypeFieldVO.class));
        String refTypeId = (String) Optional.ofNullable(MetaRefObjectTypeCache.getByTypeAndFCode(entity.getObjectId(), entity.getFCode())).map(item -> {
            return item.getRefObjectTypeId();
        }).orElse("");
        typeVO.setRefObjectTypeId(refTypeId);
        return typeVO;
    }
}