From 0178d9e48a87629f8b5f5f5075409d9ab6d29d87 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 30 八月 2023 17:24:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index 534b064..19fb609 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -36,6 +36,7 @@
 import com.vci.ubcs.starter.revision.model.TreeQueryObject;
 import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
 import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.starter.util.MdmBtmTypeConstant;
 import com.vci.ubcs.starter.util.UBCSSqlKeyword;
 import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
 import com.vci.ubcs.starter.web.constant.RegExpConstant;
@@ -665,7 +666,11 @@
             }
             final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
             conditionMap.forEach((key, value) -> {
-                sql[0] += " and " + key + " = " + value;
+				if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) {
+					sql[0] += " and " + key + " is null";
+				}else{
+					sql[0] += " and " + key + " = " + value;
+				}
             });
             if (StringUtils.isNotBlank(orderDTO.getOid())) {
                 //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
@@ -686,10 +691,9 @@
 	/**
 	 * 鏍¢獙鍏抽敭灞炴��
 	 *
-	 * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
-	 * @param templateVO       妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴��
 	 * @param orderDTO         缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
 	 */
+	@Override
 	public List<Map> checkKeyAttrOnOrderFordatas(CodeOrderDTO orderDTO) {
 		List<Map>dataList=new ArrayList<>();
 		CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
@@ -764,7 +768,7 @@
         boolean ignoreSpace = trim || trimAll;
         if (StringUtils.isBlank(value)) {
             //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
-            conditionMap.put("t." + attrId, "null");
+			conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL);
         } else {
             if (keyRuleVO != null) {
                 String queryKey = "";
@@ -800,8 +804,12 @@
                 queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
                 conditionMap.put(queryKey, queryValue);
             } else {
-                //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
-                conditionMap.put("t." + attrId, "'" +value+ "'");
+				if(StringUtils.isNotBlank(value)) {
+					//涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
+					conditionMap.put("t." + attrId, "'" + value + "'");
+				}else{
+					conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL);
+				}
             }
         }
     }
@@ -2460,10 +2468,12 @@
             conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, codeClassifyOid);
         } else {
 //			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
-
+			List<BtmTypeVO> classifyData = btmTypeClient.selectByIdCollection(Collections.singletonList(MdmBtmTypeConstant.CODE_CLASSIFY)).getData();
+			if(Func.isEmpty(classifyData)){
+				throw new ServiceException("涓氬姟绫诲瀷涓嫳鏂囧悕绉板拰鏌ヨ鏉′欢閰嶇疆涓嶄竴鑷达紝璇蜂慨鏀逛笟鍔$被鍨嬩腑鍒嗙被琛ㄨ嫳鏂囧悕绉颁负"+MdmBtmTypeConstant.CODE_CLASSIFY);
+			}
             conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " +
-                    btmTypeClient.selectByIdCollection(Collections.singletonList("classify"))
-                            .getData().get(0).getTableName() + " where lcstatus='" + FrameWorkDefaultValueConstant
+				classifyData.get(0).getTableName() + " where lcstatus='" + FrameWorkDefaultValueConstant
                     .FRAMEWORK_DATA_ENABLED + "' start with parentCodeClassifyOid = '" + codeClassifyOid +
                     "' CONNECT BY PRIOR OID = parentCodeClassifyOid )");
         }
@@ -2729,7 +2739,7 @@
             CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
             return getCodeRuleByClassifyFullInfo(fullInfo);
         }
-        //鎴戜滑鏌ヨ缂栫爜瑙勫垯
+        //鏌ヨ缂栫爜瑙勫垯
         return ruleService.getObjectHasSecByOid(codeRuleOid);
     }
 

--
Gitblit v1.9.3