From 42c17fe468ceea7e5eed7fec520b9858bed02e85 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 04 八月 2023 17:52:30 +0800 Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs --- Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java index 72c68e0..07a0549 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java +++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java @@ -869,7 +869,7 @@ } public static String getTableName(String btmname) { - return (VciQueryWrapperForDO.USER_TABLE_COMPATIBILITY ? "pl_code_" : "vcibt_") + btmname.trim().toLowerCase(); + return (VciQueryWrapperForDO.USER_TABLE_COMPATIBILITY ? "vcibt_" : "pl_code_") + btmname.trim().toLowerCase(); } public static Field getTsField(Class c) { @@ -1294,13 +1294,14 @@ * @return Map瀵硅薄 * @version 2016骞�3鏈�20鏃� 11:03:01 */ - public static Map convertBean2Map(Object bean) throws Exception { + public static Map convertBean2Map(Object bean,Set<String> existFild) throws Exception { Class type = bean.getClass(); Map returnMap = new HashMap(); BeanInfo beanInfo = Introspector.getBeanInfo(type); PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); Field[] declaredFields = type.getDeclaredFields(); + Map<String, String> fieldMap = new HashMap(); String existField = ""; for (Field declaredField : declaredFields) { declaredField.setAccessible(true); @@ -1312,6 +1313,10 @@ Boolean fieldValue = tableField.exist(); if(fieldValue == false){ existField += declaredField.getName().toLowerCase()+","; + } + String value = tableField.value(); + if(net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils.isNotBlank(value)){ + fieldMap.put(declaredField.getName(), value); } } } @@ -1327,12 +1332,21 @@ if (result != null) { if ("data".equals(propertyName)){ - returnMap.putAll((Map) result); - }else { - returnMap.put(propertyName, result); + if(existFild == null){ + returnMap.putAll((Map) result); + }else{ + Map resulMapChild = (Map) result; + for (Object o : resulMapChild.keySet()) { + if(existFild.contains(String.valueOf(o).toLowerCase())){ + returnMap.put(String.valueOf(o).toLowerCase(),resulMapChild.get(o)); + } + } + } + }else if(existFild.contains((fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName).toLowerCase())){ + returnMap.put(fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName, result); } - } else { - returnMap.put(propertyName, ""); + } else if(existFild.contains((fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName).toLowerCase())){ + returnMap.put(fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName, ""); } } } -- Gitblit v1.9.3