From d2570148ec3884de3af721bd99c4b7acbbdee075 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 09 五月 2023 17:07:26 +0800 Subject: [PATCH] 前端代码提交 --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java new file mode 100644 index 0000000..744366a --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java @@ -0,0 +1,95 @@ +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; + } + + /** + * 鎵归噺杞瑅o + * @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; + } +} -- Gitblit v1.9.3