xiejun
2023-07-19 76d804e37ed8d966387c2fa065015bdc12460c7c
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())//部门树