¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.omd.wrapper; |
| | | |
| | | import com.vci.ubcs.omd.dto.BtmTypeDTO; |
| | | import com.vci.ubcs.omd.entity.BtmType; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | 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 BtmTypeWrapper extends BaseEntityWrapper<BtmType, BtmTypeVO> { |
| | | public static BtmTypeWrapper build() { |
| | | return new BtmTypeWrapper(); |
| | | } |
| | | |
| | | /** |
| | | * do2vo |
| | | * @param entity pojo |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public BtmTypeVO entityVO(BtmType entity) { |
| | | BtmTypeVO vo = Objects.requireNonNull(BeanUtil.copy(entity, BtmTypeVO.class)); |
| | | // å¨è¿é设置æä¸¾æ¾ç¤ºå¼ |
| | | vo.setRevisionFlag(BooleanEnum.TRUE.getValue().equals(entity.getRevisionFlag())); |
| | | vo.setSecretFlag(BooleanEnum.TRUE.getValue().equals(entity.getSecretFlag())); |
| | | vo.setLifeCycleFlag(BooleanEnum.TRUE.getValue().equals(entity.getLifeCycleFlag())); |
| | | vo.setInputRevisionFlag(BooleanEnum.TRUE.getValue().equals(entity.getInputRevisionFlag())); |
| | | vo.setViewFlag(BooleanEnum.TRUE.getValue().equalsIgnoreCase(entity.getViewFlag())); |
| | | vo.setAbstractFlag(BooleanEnum.TRUE.getValue().equals(entity.getAbstractFlag())); |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * æ¹é转vo |
| | | * @param list pojoéå |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | public List<BtmTypeVO> listEntityVO(List<BtmType> list) { |
| | | return list.stream().map(this::entityVO).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * æ·è´ä¸å¡ç±»å æ°æ®ä¼ è¾å¯¹è±¡å° æ°æ®å¯¹è±¡ |
| | | * |
| | | * @param dto ä¸å¡ç±»åæ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @param creator å建人 |
| | | * @param now 彿¶æ¶é´ |
| | | */ |
| | | public BtmType copyBtmTypeDTO2Entity(BtmTypeDTO dto, String creator, Date now){ |
| | | BtmType entity = Objects.requireNonNull(BeanUtil.copy(dto, BtmType.class)); |
| | | entity.setLastModifier(creator); |
| | | entity.setTs(now); |
| | | // å¨è¿è¿è¡éç¨å段å¤ç |
| | | return entity; |
| | | } |
| | | |
| | | public BtmType entityBeforeInsert(BtmType btmType) { |
| | | btmType = entityBeforeSave(btmType); |
| | | String userAccount = AuthUtil.getUserAccount(); |
| | | btmType.setOwner(userAccount); |
| | | btmType.setCreator(userAccount); |
| | | Date now = new Date(); |
| | | btmType.setCreateTime(now); |
| | | return btmType; |
| | | } |
| | | |
| | | /** |
| | | * æå
¥åå
è£
é»è®¤å段 |
| | | * @param btmTypeDO doæ°æ® |
| | | * @return å
è£
å |
| | | */ |
| | | public BtmType entityBeforeSave(BtmType btmTypeDO) { |
| | | btmTypeDO.setOid(VciBaseUtil.getPk()); |
| | | btmTypeDO.setBtmname("btmType"); |
| | | Date now = new Date(); |
| | | String userAccount = AuthUtil.getUserAccount(); |
| | | btmTypeDO.setLastModifier(userAccount); |
| | | btmTypeDO.setLastModifyTime(now); |
| | | btmTypeDO.setTs(now); |
| | | return btmTypeDO; |
| | | } |
| | | } |