From 76d804e37ed8d966387c2fa065015bdc12460c7c Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期三, 19 七月 2023 12:02:28 +0800
Subject: [PATCH] 集成获取分类接口(包含编码规则码段码值信息)

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java |   75 ++++++++++++++++++++++++++++++-------
 1 files changed, 61 insertions(+), 14 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
index 0ec9aa8..943eeda 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
@@ -40,6 +40,7 @@
 import com.vci.ubcs.starter.revision.model.TreeQueryObject;
 import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
 import com.vci.ubcs.starter.util.UBCSSqlKeyword;
+import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
 import com.vci.ubcs.starter.web.pagemodel.SessionInfo;
 import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
 import com.vci.ubcs.starter.web.util.VciBaseUtil;
@@ -1013,29 +1014,75 @@
 												});
 											}
 										} else if (coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.TREE.getValue())) {//鏍戝舰
+											Map<String, Object> condtionMap = new HashMap<>();
+											String parentFieldName=coderefersecSearchVO.getParentFieldName();
 
-										/*	Map<String, Object> condtionMap = new HashMap<>();
-											List<CodeSrchCondConfigVO> codeSrchCondConfigVOList = coderefersecSearchVO.getCodeSrchCondConfigVOS();
-											List<CodeShowFieldConfigVO> codeShowFieldConfigVOS=coderefersecSearchVO.getCodeShowFieldConfigVOS();
-
-											if (!CollectionUtils.isEmpty(codeSrchCondConfigVOList)) {
-												codeSrchCondConfigVOList.stream().forEach(codeSrchCondConfigVO -> {
-													condtionMap.put(codeSrchCondConfigVO.getFilterField() + codeSrchCondConfigVO.getFilterType(), codeSrchCondConfigVO.getFilterValue());
-												});
-												buildSqlwhere = UBCSSqlKeyword.buildSqlwhere(condtionMap);
-											}
 											//浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
 											R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referBtmId));
 											if (!listR.isSuccess() || listR.getData().size() == 0) {
 												throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
 											}
 											String referTable = listR.getData().get(0).getTableName();
+
+											String oidFieldName = StringUtils.isNotBlank(coderefersecSearchVO.getParentUsedField())?coderefersecSearchVO.getParentUsedField():coderefersecSearchVO.getValueField();
+											String parentValue =coderefersecSearchVO.getParentValue();
+											List<CodeSrchCondConfigVO> codeSrchCondConfigVOList = coderefersecSearchVO.getCodeSrchCondConfigVOS();
+											List<CodeShowFieldConfigVO> codeShowFieldConfigVOS=coderefersecSearchVO.getCodeShowFieldConfigVOS();
+											if (!CollectionUtils.isEmpty(codeSrchCondConfigVOList)) {
+												codeSrchCondConfigVOList.stream().forEach(codeSrchCondConfigVO -> {
+													condtionMap.put(codeSrchCondConfigVO.getFilterField() + codeSrchCondConfigVO.getFilterType(), codeSrchCondConfigVO.getFilterValue());
+												});
+												buildSqlwhere = UBCSSqlKeyword.buildSqlwhere(condtionMap);
+											}
+
+											//if("all".equals(coderefersecSearchVO.getLoadType())) {
+											String parentOidSql = "";
+											if(StringUtils.isNotBlank(parentValue)){
+												String temp=parentValue;
+												if(temp.startsWith(QueryOptionConstant.IN)){
+													temp = temp.substring((QueryOptionConstant.IN).length()).trim();
+													parentOidSql = " in " + ((temp.startsWith("(")  && temp.endsWith(")"))?temp:"(" + temp + ")");
+												}else if(temp.startsWith(QueryOptionConstant.NOTIN)){
+													parentOidSql = " not in " + ((temp.startsWith("(")  && temp.endsWith(")"))?temp:"(" + temp + ")");
+												}else if(temp.startsWith(QueryOptionConstant.NOTEQUAL)){
+													temp = temp.substring((QueryOptionConstant.NOTEQUAL).length()).trim();
+													parentOidSql = QueryOptionConstant.NOTEQUAL +  " " + ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}else if(temp.startsWith(QueryOptionConstant.MORETHAN)){
+													temp = temp.substring((QueryOptionConstant.MORETHAN).length()).trim();
+													parentOidSql = QueryOptionConstant.MORETHAN + " " +  ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}else if(temp.startsWith(QueryOptionConstant.MORE)){
+													temp = temp.substring((QueryOptionConstant.MORE).length()).trim();
+													parentOidSql = QueryOptionConstant.MORE + " " +  ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}else if(temp.startsWith(QueryOptionConstant.LESSTHAN)){
+													temp = temp.substring((QueryOptionConstant.LESSTHAN).length()).trim();
+													parentOidSql = QueryOptionConstant.LESSTHAN + " " +  ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}else if(temp.startsWith(QueryOptionConstant.LESS)){
+													temp = temp.substring((QueryOptionConstant.LESS).length()).trim();
+													parentOidSql = QueryOptionConstant.LESS +  " " + ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}else if (temp.startsWith(QueryOptionConstant.ISNOTNULL)) {
+													parentOidSql = " is not null";
+												} else if (temp.startsWith(QueryOptionConstant.ISNULL)) {
+													parentOidSql = " is  null";
+												} else if(temp.contains("*")){
+													parentOidSql = " like " + ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'").replace("*","%");
+												}else {
+													parentOidSql = " = " + ((temp.startsWith("'")  && temp.endsWith("'"))?temp:"'" + temp + "'");
+												}
+											}
+											//鏌ヨ鍏ㄩ儴鐨勪俊鎭�
+											buildSqlwhere+= " and oid  in (select oid from " +referTable + " START WITH " + coderefersecSearchVO.getParentFieldName() + " "+
+											parentOidSql +
+											" CONNECT BY PRIOR " + oidFieldName + " = " + coderefersecSearchVO.getParentFieldName() + ")";
+
+											/*}else{
+												if(StringUtils.isNotBlank(coderefersecSearchVO.getParentFieldName()) && StringUtils.isNotBlank(parentValue)){
+													buildSqlwhere+=" and "+coderefersecSearchVO.getParentFieldName()+"= '"+parentValue+"'";
+												}
+											}*/
+
 											StringBuffer sb = new StringBuffer();
 											sb.append(" select * from  ");
 											sb.append(referTable);
-
-
-
 											sb.append(" where 1=1  ");
 											if (StringUtils.isNotBlank(buildSqlwhere)) {
 												sb.append(buildSqlwhere);
@@ -1055,7 +1102,7 @@
 													codeSectionValueVOList.add(sectionValueVO);
 												});
 											}
-*/
+
 
 										} else if (coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.ORGDEPARTMENTGRIDREFERS.getValue()) ||////閮ㄩ棬鍒楄〃
 											coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.ORGDEPARTMENTREFER.getValue())//閮ㄩ棬鏍�

--
Gitblit v1.9.3