From cb4e11b19446843188cf628ac8f6be5fe1fa68c7 Mon Sep 17 00:00:00 2001 From: fujunling <2984387807@qq.com> Date: 星期二, 06 六月 2023 18:01:52 +0800 Subject: [PATCH] 配置 --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java | 110 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 99 insertions(+), 11 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java index 880efbc..af80c13 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java @@ -1,15 +1,20 @@ package com.vci.ubcs.omd.service.impl; +import com.alibaba.cloud.commons.lang.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.omd.constant.BtmTypeConstant; +import com.vci.ubcs.omd.constant.BtmTypeFieldConstant; import com.vci.ubcs.omd.dto.BtmTypeLinkAttributesDTO; import com.vci.ubcs.omd.entity.BtmTypeAttribute; import com.vci.ubcs.omd.mapper.BtmTypeAttributeMapper; import com.vci.ubcs.omd.service.IAttributeService; import com.vci.ubcs.omd.service.IBtmTypeAttributeService; import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; +import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.wrapper.BtmTypeAttributeWrapper; import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; @@ -62,7 +67,7 @@ if (!exists){ return null; } - batchInsert(btmTypeAttributeDOList); + saveBatch(btmTypeAttributeDOList); return BtmTypeAttributeWrapper.build().listEntityVO(btmTypeAttributeDOList); // btmTypeAttributeDOList.stream().forEachOrdered(s -> { // btmTypeAttributeDOMapper.insert(s); @@ -119,16 +124,6 @@ } /** - * 鎵归噺鎻掑叆 - * - * @param records 鏁版嵁瀵硅薄闆嗗悎 - */ - @Override - public int batchInsert(List<BtmTypeAttribute> records) { - return baseMapper.insertBatchSomeColumn(records); - } - - /** * 涓氬姟绫诲瀷涓婚敭鏌ュ睘鎬� * @param btmTypeOid 涓氬姟绫诲瀷涓婚敭 * @return 鏌ヨ缁撴灉 @@ -179,4 +174,97 @@ public List<BtmTypeAttribute> selectByBtmTypeIds(List<String> idList) { return baseMapper.selectByBtmTypeIds(idList); } + + /** + * 鑾峰彇榛樿瀛楁 + * + * @param btmType 涓氬姟绫诲瀷 + * @return 鎵ц缁撴灉 + */ + @Override + public List<BtmTypeAttributeVO> getDefaultAttribute(BtmTypeVO btmType) { + List<BtmTypeAttributeVO> list = new ArrayList<>(); + // 涓氬姟绫诲瀷鐨勫熀鏈瓧娈� + BtmTypeFieldConstant.BASIC_FIELD_MAP.forEach((id,name) -> { + BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); + vo.setId(id); + vo.setName(name); + vo.setPkBtmType(btmType.getOid()); + if (StringUtils.equals(id,"oid")){ + vo.setNullableFlag(false); + }else { + vo.setNullableFlag(true); + } + if (Arrays.asList("createtime","lastmodifytime","owner").contains(id)){ + vo.setAttrDataType(VciFieldTypeEnum.VTDateTime.name()); + vo.setAttributeLength(6); + }else { + vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); + vo.setAttributeLength(150); + } + list.add(vo); + }); + + // 鐗堟湰瑙勫垯瀛楁 + if (StringUtils.isNotBlank(btmType.getRevisionRuleId())){ + BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP.forEach((id,name) -> { + BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); + vo.setId(id); + vo.setName(name); + vo.setPkBtmType(btmType.getOid()); + vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); + vo.setAttributeLength(150); + if (Arrays.asList("lastr","firstr","lastv","firstv","revisionseq","versionseq","revisionvalue","versionvalue").contains(id)){ + vo.setAttributeLength(5); + vo.setAttrDataType(VciFieldTypeEnum.VTInteger.name()); + } + if (Arrays.asList("checkintime","checkouttime").contains(id)){ + vo.setAttrDataType(VciFieldTypeEnum.VTDateTime.name()); + vo.setAttributeLength(6); + } + list.add(vo); + }); + } + + // 鐢熷懡鍛ㄦ湡瀛楁 + if (StringUtils.isNotBlank(btmType.getLifeCycleId())){ + BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP.forEach((id,name) -> { + BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); + vo.setId(id); + vo.setName(name); + vo.setPkBtmType(btmType.getOid()); + vo.setAttributeLength(50); + vo.setAttrDataType(VciFieldTypeEnum.VTString.name()); + list.add(vo); + }); + } + + // 瀵嗙骇瀛楁 + if (btmType.isSecretFlag()){ + BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP.forEach((id,name) -> { + BtmTypeAttributeVO vo = new BtmTypeAttributeVO(); + vo.setId(id); + vo.setName(name); + vo.setPkBtmType(btmType.getOid()); + vo.setAttributeLength(5); + vo.setAttrDataType(VciFieldTypeEnum.VTInteger.name()); + list.add(vo); + }); + } + + return list; + } + + /** + * 鑾峰彇鎵�鏈夊瓧娈� + * + * @param btmType 涓氬姟绫诲瀷 + * @return 鎵ц缁撴灉 + */ + @Override + public List<BtmTypeAttributeVO> getAllAttribute(BtmTypeVO btmType) { + List<BtmTypeAttributeVO> list = getAttributeByBtmTypeOid(btmType.getOid()); + list.addAll(getDefaultAttribute(btmType)); + return list; + } } -- Gitblit v1.9.3