package com.vci.ubcs.code.wrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.vci.ubcs.code.entity.DockingLog; import com.vci.ubcs.code.enumpack.SysIntegrationLogTypeEnum; import com.vci.ubcs.code.vo.pagemodel.DockingLogeVO; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; public class DockingLogeWrapper extends BaseEntityWrapper { public static DockingLogeWrapper build() { return new DockingLogeWrapper(); } @Override public DockingLogeVO entityVO(DockingLog entity) { entity.setTypeText(SysIntegrationLogTypeEnum.getTextByValue(entity.getType())); DockingLogeVO dockingLogeVO = Objects.requireNonNull(BeanUtil.copy(entity, DockingLogeVO.class)); return dockingLogeVO; } /*** * 数组对象转换 * @param entitys * @return */ public List entityVOs(Collection entitys) { if(CollectionUtils.isEmpty(entitys)) {return new ArrayList<>();} List vos=new ArrayList<>(); if(!CollectionUtils.isEmpty(entitys)) { entitys.stream().forEach(vo -> { vo.setTypeText(SysIntegrationLogTypeEnum.getTextByValue(vo.getType())); vos.add(entityVO(vo)); }); } return vos; } /*** * 数组对象转换 * @param vos * @return */ public List voentitys(Collection vos) { if(CollectionUtils.isEmpty(vos)) {return new ArrayList<>();} Listentitys =new ArrayList<>(); if(!CollectionUtils.isEmpty(vos)) { vos.stream().forEach(entity -> { entity.setTypeText(SysIntegrationLogTypeEnum.getTextByValue(entity.getType())); entitys.add(voentity(entity)); }); } return entitys; } /*** * 数组对象转换 * @param vo * @return */ public DockingLog voentity( DockingLogeVO vo) { vo.setTypeText(SysIntegrationLogTypeEnum.getTextByValue(vo.getType())); DockingLog entity = Objects.requireNonNull(BeanUtil.copy(vo, DockingLog.class)); return entity; } }