package com.vci.ubcs.omd.wrapper;
|
|
import com.vci.ubcs.omd.dto.OmdBtmTypeDTO;
|
import com.vci.ubcs.omd.entity.OmdBtmType;
|
import com.vci.ubcs.omd.vo.OmdBtmTypeVO;
|
import org.springblade.core.mp.support.BaseEntityWrapper;
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Objects;
|
import java.util.stream.Collectors;
|
|
/**
|
* Description:
|
*
|
* @author LiHang
|
* @date 2023/4/23
|
*/
|
public class OmdBtmTypeWrapper extends BaseEntityWrapper<OmdBtmType, OmdBtmTypeVO> {
|
public static OmdBtmTypeWrapper build() {
|
return new OmdBtmTypeWrapper();
|
}
|
|
/**
|
* do2vo
|
* @param entity pojo
|
* @return 显示对象
|
*/
|
@Override
|
public OmdBtmTypeVO entityVO(OmdBtmType entity) {
|
OmdBtmTypeVO vo = Objects.requireNonNull(BeanUtil.copy(entity, OmdBtmTypeVO.class));
|
// 在这里设置枚举显示值
|
return vo;
|
}
|
|
/**
|
* 批量转vo
|
* @param list pojo集合
|
* @return 显示对象
|
*/
|
public List<OmdBtmTypeVO> listEntityVO(List<OmdBtmType> list) {
|
return list.stream().map(this::entityVO).collect(Collectors.toList());
|
}
|
|
/**
|
* 拷贝业务类型 数据传输对象到 数据对象
|
*
|
* @param dto 业务类型数据传输对象
|
* @param creator 创建人
|
* @param now 当时时间
|
*/
|
public OmdBtmType copyBtmTypeDTO2Entity(OmdBtmTypeDTO dto, String creator, Date now){
|
OmdBtmType entity = Objects.requireNonNull(BeanUtil.copy(dto, OmdBtmType.class));
|
entity.setLastModifier(creator);
|
entity.setTs(now);
|
// 在这进行通用字段处理
|
return entity;
|
}
|
|
}
|