From 3579af2945dd38d841a23cd340acd474bb63773a Mon Sep 17 00:00:00 2001 From: lihang <lihang@vci-tech.com> Date: 星期四, 04 五月 2023 18:02:01 +0800 Subject: [PATCH] 业务类型与DDL服务相关的添加 --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java index c61c7f3..a2deddc 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.ubcs.omd.service.impl; +import com.alibaba.cloud.commons.lang.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -12,6 +13,8 @@ import com.vci.ubcs.omd.vo.AttributeVO; import com.vci.ubcs.omd.wrapper.AttributeWrapper; import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; +import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.log.exception.ServiceException; @@ -180,6 +183,30 @@ */ @Override public boolean checkAttributePass(String id, String attrDataType, Integer attributeLength, String defaultValue) throws VciBaseException { + String attributeDataTypeText = VciFieldTypeEnum.getTextByValue(attrDataType); + if(StringUtils.isBlank(attributeDataTypeText)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑绫诲瀷涓嶇鍚堣姹�",new Object[]{id}); + } + //蹇呴』瑕佽緭鍏ラ暱搴� + if( VciBaseUtil.inArray(new String[] {VciFieldTypeEnum.VTString.name()},attrDataType) + && (attributeLength == null ||attributeLength < 1)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑涓簕1}绫诲瀷鏃讹紝蹇呴』瑕佽緭鍏ラ暱搴︾殑鍊�",new Object[]{id,attributeDataTypeText}); + } + //鍒ゆ柇榛樿鍊� + if(StringUtils.isNotBlank(defaultValue)){ + if(VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrDataType) + && !defaultValue.matches(OmdRegExpConstant.DOUBLE)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄弻绮惧害绫诲瀷",new Object[]{id}); + } + if(VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(defaultValue) + && !defaultValue.matches(OmdRegExpConstant.INT)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄暣鏁板瀷",new Object[]{id}); + } + if(VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(defaultValue) + && !defaultValue.matches(OmdRegExpConstant.LONG)){ + throw new VciBaseException("鑻辨枃鍚嶇О涓簕0}鐨勫睘鎬х殑榛樿鍊间笉鏄暱鏁村舰",new Object[]{id}); + } + } return true; } -- Gitblit v1.9.3