From 5845950aa395da1a1f56a5fff4c80358cf4b5f7f Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 16 五月 2023 21:03:56 +0800
Subject: [PATCH] 新增引用码段下的参照配置界面,代码整合
---
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 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..6e02f0d 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;
@@ -57,7 +60,7 @@
@Override
public AttributeVO getAttributeDetail(Long id) {
Func.requireNotNull(id,"涓婚敭涓嶈兘涓虹┖");
- return AttributeWrapper.build().entityVO(baseMapper.selectByPrimaryKey(id));
+ return AttributeWrapper.build().entityVO(baseMapper.selectById(id));
}
/**
@@ -125,7 +128,6 @@
return true;
}
-
/**
* 鏍规嵁鑻辨枃鍚嶇О闆嗗悎鎵归噺鑾峰彇灞炴�у璞�
*
@@ -180,6 +182,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