Browse Source

add setCaseInsensitive

Looly 6 years ago
parent
commit
87167a07d0
27 changed files with 294 additions and 215 deletions
  1. 1 0
      CHANGELOG.md
  2. 4 5
      hutool-core/src/main/java/cn/hutool/core/convert/impl/CollectionConverter.java
  3. 7 7
      hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java
  4. 10 10
      hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java
  5. 6 5
      hutool-core/src/main/java/cn/hutool/core/io/watch/watchers/WatcherChain.java
  6. 3 3
      hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
  7. 6 6
      hutool-core/src/main/java/cn/hutool/core/lang/Dict.java
  8. 20 8
      hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
  9. 1 2
      hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java
  10. 11 3
      hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
  11. 4 4
      hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
  12. 33 33
      hutool-core/src/test/java/cn/hutool/core/collection/CollUtilTest.java
  13. 6 3
      hutool-core/src/test/java/cn/hutool/core/lang/TreeTest.java
  14. 7 8
      hutool-core/src/test/java/cn/hutool/core/util/RandomUtilTest.java
  15. 10 10
      hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java
  16. 6 10
      hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java
  17. 38 24
      hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
  18. 9 12
      hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java
  19. 40 24
      hutool-db/src/main/java/cn/hutool/db/DbUtil.java
  20. 32 14
      hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
  21. 10 10
      hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java
  22. 24 6
      hutool-db/src/main/java/cn/hutool/db/handler/PageResultHandler.java
  23. 0 3
      hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java
  24. 1 1
      hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
  25. 2 2
      hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
  26. 2 1
      hutool-json/src/test/java/cn/hutool/json/JSONObjectTest.java
  27. 1 1
      hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@
 * 【core   】     添加获取class当前文件夹名称方法(pr#106@Gitee)
 * 【core   】     BooleanUtil中重载歧义修正,修改了包装参数的方法名(issue#I1BSK8@Gitee)
 * 【core   】     XmlUtil增加xmlToBean和beanToXml方法
+* 【db     】     设置全局忽略大小写DbUtil.setCaseInsensitiveGlobal(true)(issue#784@Github)
 
 ### Bug修复
 * 【core   】     修复TypeUtil无法获取泛型接口的泛型参数问题(issue#I1BRFI@Gitee)

+ 4 - 5
hutool-core/src/main/java/cn/hutool/core/convert/impl/CollectionConverter.java

@@ -1,13 +1,12 @@
 package cn.hutool.core.convert.impl;
 
-import java.lang.reflect.Type;
-import java.util.Collection;
-
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.convert.Converter;
 import cn.hutool.core.util.TypeUtil;
 
+import java.lang.reflect.Type;
+import java.util.Collection;
+
 /**
  * 各种集合类转换器
  * 
@@ -77,7 +76,7 @@ public class CollectionConverter implements Converter<Collection<?>> {
 	 * @return 转换后的集合对象
 	 */
 	protected Collection<?> convertInternal(Object value) {
-		final Collection<Object> collection = CollectionUtil.create(TypeUtil.getClass(this.collectionType));
+		final Collection<Object> collection = CollUtil.create(TypeUtil.getClass(this.collectionType));
 		return CollUtil.addAll(collection, value, this.elementType);
 	}
 }

+ 7 - 7
hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java

@@ -1,5 +1,11 @@
 package cn.hutool.core.exceptions;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FastByteArrayOutputStream;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+
 import java.io.PrintStream;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.UndeclaredThrowableException;
@@ -8,12 +14,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.io.FastByteArrayOutputStream;
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.hutool.core.util.StrUtil;
-
 /**
  * 异常工具类
  * 
@@ -208,7 +208,7 @@ public class ExceptionUtil {
 			length = limit;
 		}
 
-		if (CollectionUtil.isNotEmpty(replaceCharToStrMap)) {
+		if (CollUtil.isNotEmpty(replaceCharToStrMap)) {
 			final StringBuilder sb = StrUtil.builder();
 			char c;
 			String value;

+ 10 - 10
hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java

@@ -1,14 +1,6 @@
 package cn.hutool.core.io.resource;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.Enumeration;
-import java.util.List;
-
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.EnumerationIter;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.IORuntimeException;
@@ -17,6 +9,14 @@ import cn.hutool.core.util.ClassLoaderUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.URLUtil;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Enumeration;
+import java.util.List;
+
 /**
  * ClassPath资源工具类
  * 
@@ -134,7 +134,7 @@ public class ResourceUtil {
 		} catch (IOException e) {
 			throw new IORuntimeException(e);
 		}
-		return CollectionUtil.newArrayList(resources);
+		return CollUtil.newArrayList(resources);
 	}
 
 	/**

+ 6 - 5
hutool-core/src/main/java/cn/hutool/core/io/watch/watchers/WatcherChain.java

@@ -1,14 +1,14 @@
 package cn.hutool.core.io.watch.watchers;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.watch.Watcher;
+import cn.hutool.core.lang.Chain;
+
 import java.nio.file.Path;
 import java.nio.file.WatchEvent;
 import java.util.Iterator;
 import java.util.List;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.io.watch.Watcher;
-import cn.hutool.core.lang.Chain;
-
 /**
  * 观察者链<br>
  * 用于加入多个观察者
@@ -35,7 +35,7 @@ public class WatcherChain implements Watcher, Chain<Watcher, WatcherChain>{
 	 * @param watchers 观察者列表
 	 */
 	public WatcherChain(Watcher... watchers) {
-		chain = CollectionUtil.newArrayList(watchers);
+		chain = CollUtil.newArrayList(watchers);
 	}
 	
 	@Override
@@ -66,6 +66,7 @@ public class WatcherChain implements Watcher, Chain<Watcher, WatcherChain>{
 		}
 	}
 
+	@SuppressWarnings("NullableProblems")
 	@Override
 	public Iterator<Watcher> iterator() {
 		return this.chain.iterator();

+ 3 - 3
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java

@@ -3,7 +3,7 @@ package cn.hutool.core.lang;
 import java.util.Collection;
 import java.util.Map;
 
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.StrUtil;
 
@@ -353,7 +353,7 @@ public class Assert {
 	 * @throws IllegalArgumentException if the collection is {@code null} or has no elements
 	 */
 	public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
-		if (CollectionUtil.isEmpty(collection)) {
+		if (CollUtil.isEmpty(collection)) {
 			throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
 		}
 		return collection;
@@ -392,7 +392,7 @@ public class Assert {
 	 * @throws IllegalArgumentException if the map is {@code null} or has no entries
 	 */
 	public static <K, V> Map<K, V> notEmpty(Map<K, V> map, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
-		if (CollectionUtil.isEmpty(map)) {
+		if (CollUtil.isEmpty(map)) {
 			throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
 		}
 		return map;

+ 6 - 6
hutool-core/src/main/java/cn/hutool/core/lang/Dict.java

@@ -1,5 +1,10 @@
 package cn.hutool.core.lang;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.getter.BasicTypeGetter;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Time;
@@ -10,11 +15,6 @@ import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.getter.BasicTypeGetter;
-
 /**
  * 字典对象,扩充了HashMap中的方法
  * 
@@ -231,7 +231,7 @@ public class Dict extends LinkedHashMap<String, Object> implements BasicTypeGett
 	 * @param withoutNames 不需要去除的字段名
 	 */
 	public <T extends Dict> void removeEqual(T dict, String... withoutNames) {
-		HashSet<String> withoutSet = CollectionUtil.newHashSet(withoutNames);
+		HashSet<String> withoutSet = CollUtil.newHashSet(withoutNames);
 		for (Map.Entry<String, Object> entry : dict.entrySet()) {
 			if (withoutSet.contains(entry.getKey())) {
 				continue;

+ 20 - 8
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java

@@ -1,10 +1,6 @@
 package cn.hutool.core.map;
 
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Editor;
 import cn.hutool.core.lang.Filter;
@@ -14,6 +10,22 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * Map相关工具类
  *
@@ -357,7 +369,7 @@ public class MapUtil {
 	 */
 	public static <K, V> Map<K, List<V>> toListMap(Iterable<? extends Map<K, V>> mapList) {
 		final HashMap<K, List<V>> resultMap = new HashMap<>();
-		if (CollectionUtil.isEmpty(mapList)) {
+		if (CollUtil.isEmpty(mapList)) {
 			return resultMap;
 		}
 
@@ -370,7 +382,7 @@ public class MapUtil {
 				key = entry.getKey();
 				valueList = resultMap.get(key);
 				if (null == valueList) {
-					valueList = CollectionUtil.newArrayList(entry.getValue());
+					valueList = CollUtil.newArrayList(entry.getValue());
 					resultMap.put(key, valueList);
 				} else {
 					valueList.add(entry.getValue());
@@ -425,7 +437,7 @@ public class MapUtil {
 			List<V> vList;
 			int vListSize;
 			for (Entry<K, ? extends Iterable<V>> entry : listMap.entrySet()) {
-				vList = CollectionUtil.newArrayList(entry.getValue());
+				vList = CollUtil.newArrayList(entry.getValue());
 				vListSize = vList.size();
 				if (index < vListSize) {
 					map.put(entry.getKey(), vList.get(index));

+ 1 - 2
hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java

@@ -1,7 +1,6 @@
 package cn.hutool.core.net;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.exceptions.UtilException;
 import cn.hutool.core.io.IORuntimeException;
 import cn.hutool.core.io.IoUtil;
@@ -350,7 +349,7 @@ public class NetUtil {
 			return null;
 		}
 
-		return CollectionUtil.addAll(new ArrayList<>(), networkInterfaces);
+		return CollUtil.addAll(new ArrayList<>(), networkInterfaces);
 	}
 
 	/**

+ 11 - 3
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java

@@ -1,5 +1,6 @@
 package cn.hutool.core.util;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.IterUtil;
 import cn.hutool.core.exceptions.UtilException;
@@ -8,7 +9,14 @@ import cn.hutool.core.lang.Filter;
 
 import java.lang.reflect.Array;
 import java.nio.ByteBuffer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * 数组工具类
@@ -931,7 +939,7 @@ public class ArrayUtil {
 		}
 
 		final int size = Math.min(keys.length, values.length);
-		final Map<K, V> map = CollectionUtil.newHashMap(size, isOrder);
+		final Map<K, V> map = CollUtil.newHashMap(size, isOrder);
 		for (int i = 0; i < size; i++) {
 			map.put(keys[i], values[i]);
 		}
@@ -2674,7 +2682,7 @@ public class ArrayUtil {
 	 * @since 3.0.9
 	 */
 	public static <T> T[] toArray(Iterator<T> iterator, Class<T> componentType) {
-		return toArray(CollectionUtil.newArrayList(iterator), componentType);
+		return toArray(CollUtil.newArrayList(iterator), componentType);
 	}
 
 	/**

+ 4 - 4
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java

@@ -1,7 +1,7 @@
 package cn.hutool.core.util;
 
 import cn.hutool.core.annotation.Alias;
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.exceptions.UtilException;
 import cn.hutool.core.lang.Assert;
@@ -391,7 +391,7 @@ public class ReflectUtil {
 				}
 			}
 		} else {
-			methodList = CollectionUtil.newArrayList(methods);
+			methodList = CollUtil.newArrayList(methods);
 		}
 		return methodList;
 	}
@@ -404,7 +404,7 @@ public class ReflectUtil {
 	 * @return 过滤后的方法列表
 	 */
 	public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods) {
-		final HashSet<Method> excludeMethodSet = CollectionUtil.newHashSet(excludeMethods);
+		final HashSet<Method> excludeMethodSet = CollUtil.newHashSet(excludeMethods);
 		return getPublicMethods(clazz, method -> false == excludeMethodSet.contains(method));
 	}
 
@@ -416,7 +416,7 @@ public class ReflectUtil {
 	 * @return 过滤后的方法列表
 	 */
 	public static List<Method> getPublicMethods(Class<?> clazz, String... excludeMethodNames) {
-		final HashSet<String> excludeMethodNameSet = CollectionUtil.newHashSet(excludeMethodNames);
+		final HashSet<String> excludeMethodNameSet = CollUtil.newHashSet(excludeMethodNames);
 		return getPublicMethods(clazz, method -> false == excludeMethodNameSet.contains(method.getName()));
 	}
 

+ 33 - 33
hutool-core/src/test/java/cn/hutool/core/collection/CollUtilTest.java

@@ -31,7 +31,7 @@ public class CollUtilTest {
 
 	@Test
 	public void newHashSetTest() {
-		Set<String> set = CollectionUtil.newHashSet((String[]) null);
+		Set<String> set = CollUtil.newHashSet((String[]) null);
 		Assert.assertNotNull(set);
 	}
 
@@ -41,12 +41,12 @@ public class CollUtilTest {
 		Dict v2 = Dict.create().set("age", 13).set("id", 15).set("name", "李四");
 
 		final String[] keys = v1.keySet().toArray(new String[0]);
-		ArrayList<Object> v1s = CollectionUtil.valuesOfKeys(v1, keys);
+		ArrayList<Object> v1s = CollUtil.valuesOfKeys(v1, keys);
 		Assert.assertTrue(v1s.contains(12));
 		Assert.assertTrue(v1s.contains(23));
 		Assert.assertTrue(v1s.contains("张三"));
 
-		ArrayList<Object> v2s = CollectionUtil.valuesOfKeys(v2, keys);
+		ArrayList<Object> v2s = CollUtil.valuesOfKeys(v2, keys);
 		Assert.assertTrue(v2s.contains(15));
 		Assert.assertTrue(v2s.contains(13));
 		Assert.assertTrue(v2s.contains("李四"));
@@ -54,34 +54,34 @@ public class CollUtilTest {
 
 	@Test
 	public void unionTest() {
-		ArrayList<String> list1 = CollectionUtil.newArrayList("a", "b", "b", "c", "d", "x");
-		ArrayList<String> list2 = CollectionUtil.newArrayList("a", "b", "b", "b", "c", "d");
+		ArrayList<String> list1 = CollUtil.newArrayList("a", "b", "b", "c", "d", "x");
+		ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d");
 
-		Collection<String> union = CollectionUtil.union(list1, list2);
+		Collection<String> union = CollUtil.union(list1, list2);
 
-		Assert.assertEquals(3, CollectionUtil.count(union, t -> t.equals("b")));
+		Assert.assertEquals(3, CollUtil.count(union, t -> t.equals("b")));
 	}
 
 	@Test
 	public void intersectionTest() {
-		ArrayList<String> list1 = CollectionUtil.newArrayList("a", "b", "b", "c", "d", "x");
-		ArrayList<String> list2 = CollectionUtil.newArrayList("a", "b", "b", "b", "c", "d");
+		ArrayList<String> list1 = CollUtil.newArrayList("a", "b", "b", "c", "d", "x");
+		ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d");
 
-		Collection<String> union = CollectionUtil.intersection(list1, list2);
-		Assert.assertEquals(2, CollectionUtil.count(union, t -> t.equals("b")));
+		Collection<String> union = CollUtil.intersection(list1, list2);
+		Assert.assertEquals(2, CollUtil.count(union, t -> t.equals("b")));
 	}
 
 	@Test
 	public void disjunctionTest() {
-		ArrayList<String> list1 = CollectionUtil.newArrayList("a", "b", "b", "c", "d", "x");
-		ArrayList<String> list2 = CollectionUtil.newArrayList("a", "b", "b", "b", "c", "d", "x2");
+		ArrayList<String> list1 = CollUtil.newArrayList("a", "b", "b", "c", "d", "x");
+		ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d", "x2");
 
-		Collection<String> disjunction = CollectionUtil.disjunction(list1, list2);
+		Collection<String> disjunction = CollUtil.disjunction(list1, list2);
 		Assert.assertTrue(disjunction.contains("b"));
 		Assert.assertTrue(disjunction.contains("x2"));
 		Assert.assertTrue(disjunction.contains("x"));
 
-		Collection<String> disjunction2 = CollectionUtil.disjunction(list2, list1);
+		Collection<String> disjunction2 = CollUtil.disjunction(list2, list1);
 		Assert.assertTrue(disjunction2.contains("b"));
 		Assert.assertTrue(disjunction2.contains("x2"));
 		Assert.assertTrue(disjunction2.contains("x"));
@@ -90,29 +90,29 @@ public class CollUtilTest {
 	@Test
 	public void disjunctionTest2() {
 		// 任意一个集合为空,差集为另一个集合
-		ArrayList<String> list1 = CollectionUtil.newArrayList();
-		ArrayList<String> list2 = CollectionUtil.newArrayList("a", "b", "b", "b", "c", "d", "x2");
+		ArrayList<String> list1 = CollUtil.newArrayList();
+		ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d", "x2");
 
-		Collection<String> disjunction = CollectionUtil.disjunction(list1, list2);
+		Collection<String> disjunction = CollUtil.disjunction(list1, list2);
 		Assert.assertEquals(list2, disjunction);
-		Collection<String> disjunction2 = CollectionUtil.disjunction(list2, list1);
+		Collection<String> disjunction2 = CollUtil.disjunction(list2, list1);
 		Assert.assertEquals(list2, disjunction2);
 	}
 
 	@Test
 	public void disjunctionTest3() {
 		// 无交集下返回共同的元素
-		ArrayList<String> list1 = CollectionUtil.newArrayList("1", "2", "3");
-		ArrayList<String> list2 = CollectionUtil.newArrayList("a", "b", "c");
+		ArrayList<String> list1 = CollUtil.newArrayList("1", "2", "3");
+		ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "c");
 
-		Collection<String> disjunction = CollectionUtil.disjunction(list1, list2);
+		Collection<String> disjunction = CollUtil.disjunction(list1, list2);
 		Assert.assertTrue(disjunction.contains("1"));
 		Assert.assertTrue(disjunction.contains("2"));
 		Assert.assertTrue(disjunction.contains("3"));
 		Assert.assertTrue(disjunction.contains("a"));
 		Assert.assertTrue(disjunction.contains("b"));
 		Assert.assertTrue(disjunction.contains("c"));
-		Collection<String> disjunction2 = CollectionUtil.disjunction(list2, list1);
+		Collection<String> disjunction2 = CollUtil.disjunction(list2, list1);
 		Assert.assertTrue(disjunction2.contains("1"));
 		Assert.assertTrue(disjunction2.contains("2"));
 		Assert.assertTrue(disjunction2.contains("3"));
@@ -132,13 +132,13 @@ public class CollUtilTest {
 		map2.put("c", "值3");
 
 		// ----------------------------------------------------------------------------------------
-		ArrayList<HashMap<String, String>> list = CollectionUtil.newArrayList(map1, map2);
-		Map<String, List<String>> map = CollectionUtil.toListMap(list);
+		ArrayList<HashMap<String, String>> list = CollUtil.newArrayList(map1, map2);
+		Map<String, List<String>> map = CollUtil.toListMap(list);
 		Assert.assertEquals("值1", map.get("a").get(0));
 		Assert.assertEquals("值2", map.get("a").get(1));
 
 		// ----------------------------------------------------------------------------------------
-		List<Map<String, String>> listMap = CollectionUtil.toMapList(map);
+		List<Map<String, String>> listMap = CollUtil.toMapList(map);
 		Assert.assertEquals("值1", listMap.get(0).get("a"));
 		Assert.assertEquals("值2", listMap.get(1).get("a"));
 	}
@@ -147,17 +147,17 @@ public class CollUtilTest {
 	public void getFieldValuesTest() {
 		Dict v1 = Dict.create().set("id", 12).set("name", "张三").set("age", 23);
 		Dict v2 = Dict.create().set("age", 13).set("id", 15).set("name", "李四");
-		ArrayList<Dict> list = CollectionUtil.newArrayList(v1, v2);
+		ArrayList<Dict> list = CollUtil.newArrayList(v1, v2);
 
-		List<Object> fieldValues = CollectionUtil.getFieldValues(list, "name");
+		List<Object> fieldValues = CollUtil.getFieldValues(list, "name");
 		Assert.assertEquals("张三", fieldValues.get(0));
 		Assert.assertEquals("李四", fieldValues.get(1));
 	}
 
 	@Test
 	public void splitTest() {
-		final ArrayList<Integer> list = CollectionUtil.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9);
-		List<List<Integer>> split = CollectionUtil.split(list, 3);
+		final ArrayList<Integer> list = CollUtil.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9);
+		List<List<Integer>> split = CollUtil.split(list, 3);
 		Assert.assertEquals(3, split.size());
 		Assert.assertEquals(3, split.get(0).size());
 	}
@@ -170,7 +170,7 @@ public class CollUtilTest {
 		map.put("c", "3");
 
 		final String[] result = new String[1];
-		CollectionUtil.forEach(map, (key, value, index) -> {
+		CollUtil.forEach(map, (key, value, index) -> {
 			if (key.equals("a")) {
 				result[0] = value;
 			}
@@ -234,10 +234,10 @@ public class CollUtilTest {
 	@Test
 	public void groupTest() {
 		List<String> list = CollUtil.newArrayList("1", "2", "3", "4", "5", "6");
-		List<List<String>> group = CollectionUtil.group(list, null);
+		List<List<String>> group = CollUtil.group(list, null);
 		Assert.assertTrue(group.size() > 0);
 
-		List<List<String>> group2 = CollectionUtil.group(list, t -> {
+		List<List<String>> group2 = CollUtil.group(list, t -> {
 			// 按照奇数偶数分类
 			return Integer.parseInt(t) % 2;
 		});

+ 6 - 3
hutool-core/src/test/java/cn/hutool/core/lang/TreeTest.java

@@ -1,7 +1,10 @@
 package cn.hutool.core.lang;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.lang.tree.*;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.tree.Tree;
+import cn.hutool.core.lang.tree.TreeNode;
+import cn.hutool.core.lang.tree.TreeNodeConfig;
+import cn.hutool.core.lang.tree.TreeUtil;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -14,7 +17,7 @@ import java.util.List;
  */
 public class TreeTest {
 	// 模拟数据
-	static List<TreeNode<String>> nodeList = CollectionUtil.newArrayList();
+	static List<TreeNode<String>> nodeList = CollUtil.newArrayList();
 
 	static {
 		// 模拟数据

+ 7 - 8
hutool-core/src/test/java/cn/hutool/core/util/RandomUtilTest.java

@@ -1,27 +1,26 @@
 package cn.hutool.core.util;
 
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Set;
-
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Console;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.lang.Console;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.Set;
 
 public class RandomUtilTest {
 	
 	@Test
 	public void randomEleSetTest(){
-		Set<Integer> set = RandomUtil.randomEleSet(CollectionUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
+		Set<Integer> set = RandomUtil.randomEleSet(CollUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
 		Assert.assertEquals(set.size(), 2);
 	}
 	
 	@Test
 	public void randomElesTest(){
-		List<Integer> result = RandomUtil.randomEles(CollectionUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
+		List<Integer> result = RandomUtil.randomEles(CollUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
 		Assert.assertEquals(result.size(), 2);
 	}
 	

+ 10 - 10
hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java

@@ -1,14 +1,6 @@
 package cn.hutool.cron;
 
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.thread.ExecutorBuilder;
 import cn.hutool.core.thread.ThreadFactoryBuilder;
 import cn.hutool.core.util.CharUtil;
@@ -23,6 +15,14 @@ import cn.hutool.cron.task.Task;
 import cn.hutool.log.StaticLog;
 import cn.hutool.setting.Setting;
 
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map.Entry;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
 /**
  * 任务调度器<br>
  * 
@@ -182,7 +182,7 @@ public class Scheduler implements Serializable {
 	 * @return this
 	 */
 	public Scheduler schedule(Setting cronSetting) {
-		if (CollectionUtil.isNotEmpty(cronSetting)) {
+		if (CollUtil.isNotEmpty(cronSetting)) {
 			String group;
 			for (Entry<String, LinkedHashMap<String, String>> groupedEntry : cronSetting.getGroupedMap().entrySet()) {
 				group = groupedEntry.getKey();

+ 6 - 10
hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java

@@ -1,9 +1,6 @@
 package cn.hutool.cron.pattern.matcher;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.cron.CronException;
@@ -11,6 +8,9 @@ import cn.hutool.cron.pattern.parser.DayOfMonthValueParser;
 import cn.hutool.cron.pattern.parser.ValueParser;
 import cn.hutool.cron.pattern.parser.YearValueParser;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * {@link ValueMatcher} 构建器,用于构建表达式中每一项的匹配器
  * @author Looly
@@ -64,7 +64,7 @@ public class ValueMatcherBuilder {
 	
 		final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
 		for (String part : parts) {
-			CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
+			CollUtil.addAllIfNotContains(values, parseStep(part, parser));
 		}
 		return values;
 	}
@@ -170,11 +170,7 @@ public class ValueMatcherBuilder {
 				NumberUtil.appendRange(v1, parser.getMax(), step, results);
 				NumberUtil.appendRange(parser.getMin(), v2, step, results);
 			} else {// v1 == v2,此时与单值模式一致
-				if(step > 0) {//类似 20/2的形式
-					NumberUtil.appendRange(v1, parser.getMax(), step, results);
-				}else {
-					results.add(v1);
-				}
+				NumberUtil.appendRange(v1, parser.getMax(), step, results);
 			}
 		} else {
 			throw new CronException("Invalid syntax of field: [{}]", value);

+ 38 - 24
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java

@@ -1,15 +1,6 @@
 package cn.hutool.db;
 
-import java.io.Serializable;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.sql.DataSource;
-
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.db.dialect.Dialect;
 import cn.hutool.db.handler.BeanListHandler;
 import cn.hutool.db.handler.EntityHandler;
@@ -24,6 +15,14 @@ import cn.hutool.db.sql.SqlExecutor;
 import cn.hutool.db.sql.SqlUtil;
 import cn.hutool.db.sql.Wrapper;
 
+import javax.sql.DataSource;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
 /**
  * 抽象数据库操作类<br>
  * 通过给定的数据源执行给定SQL或者给定数据源和方言,执行相应的CRUD操作<br>
@@ -39,6 +38,10 @@ public abstract class AbstractDb implements Serializable {
 	 * 是否支持事务
 	 */
 	protected Boolean isSupportTransaction = null;
+	/**
+	 * 是否大小写不敏感(默认大小写不敏感)
+	 */
+	protected boolean caseInsensitive = DbUtil.caseInsensitiveGlobal;
 	protected SqlConnRunner runner;
 
 	// ------------------------------------------------------- Constructor start
@@ -81,7 +84,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @since 3.1.1
 	 */
 	public List<Entity> query(String sql, Map<String, Object> params) throws SQLException {
-		return query(sql, new EntityListHandler(), params);
+		return query(sql, new EntityListHandler(this.caseInsensitive), params);
 	}
 
 	/**
@@ -94,7 +97,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @since 3.1.1
 	 */
 	public List<Entity> query(String sql, Object... params) throws SQLException {
-		return query(sql, new EntityListHandler(), params);
+		return query(sql, new EntityListHandler(this.caseInsensitive), params);
 	}
 
 	/**
@@ -121,7 +124,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @throws SQLException SQL执行异常
 	 */
 	public Entity queryOne(String sql, Object... params) throws SQLException {
-		return query(sql, new EntityHandler(), params);
+		return query(sql, new EntityHandler(this.caseInsensitive), params);
 	}
 
 	/**
@@ -171,9 +174,9 @@ public abstract class AbstractDb implements Serializable {
 	/**
 	 * 支持占位符的查询,例如:select * from table where field1=:name1
 	 *
-	 * @param <T>    结果集需要处理的对象类型
-	 * @param sql    查询语句,使用参数名占位符,例如:name
-	 * @param rsh    结果集处理对象
+	 * @param <T>      结果集需要处理的对象类型
+	 * @param sql      查询语句,使用参数名占位符,例如:name
+	 * @param rsh      结果集处理对象
 	 * @param paramMap 参数
 	 * @return 结果对象
 	 * @throws SQLException SQL执行异常
@@ -429,7 +432,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @throws SQLException SQL执行异常
 	 */
 	public Entity get(Entity where) throws SQLException {
-		return find(where.getFieldNames(), where, new EntityHandler());
+		return find(where.getFieldNames(), where, new EntityHandler(this.caseInsensitive));
 
 	}
 	// ------------------------------------------------------------- Get end
@@ -466,7 +469,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @since 4.5.16
 	 */
 	public List<Entity> find(Collection<String> fields, Entity where) throws SQLException {
-		return find(fields, where, EntityListHandler.create());
+		return find(fields, where, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -502,7 +505,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @throws SQLException SQL执行异常
 	 */
 	public <T> T find(Entity where, RsHandler<T> rsh, String... fields) throws SQLException {
-		return find(CollectionUtil.newArrayList(fields), where, rsh);
+		return find(CollUtil.newArrayList(fields), where, rsh);
 	}
 
 	/**
@@ -515,7 +518,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @since 3.2.1
 	 */
 	public List<Entity> find(Entity where) throws SQLException {
-		return find(where.getFieldNames(), where, EntityListHandler.create());
+		return find(where.getFieldNames(), where, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -549,8 +552,8 @@ public abstract class AbstractDb implements Serializable {
 	 * 查询数据列表,返回所有字段<br>
 	 * 查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " &gt; 1"),value也可以传Condition对象,key被忽略
 	 *
-	 * @param <T>   Bean类型
-	 * @param where 条件实体类(包含表名)
+	 * @param <T>       Bean类型
+	 * @param where     条件实体类(包含表名)
 	 * @param beanClass 返回的对象类型
 	 * @return 数据对象列表
 	 * @throws SQLException SQL执行异常
@@ -595,7 +598,7 @@ public abstract class AbstractDb implements Serializable {
 	 */
 	public List<Entity> findBy(String tableName, Condition... wheres) throws SQLException {
 		final Query query = new Query(wheres, tableName);
-		return find(query, EntityListHandler.create());
+		return find(query, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -695,7 +698,7 @@ public abstract class AbstractDb implements Serializable {
 	 * @since 3.2.2
 	 */
 	public List<Entity> pageForEntityList(Entity where, Page page) throws SQLException {
-		return page(where, page, EntityListHandler.create());
+		return page(where, page, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -809,6 +812,17 @@ public abstract class AbstractDb implements Serializable {
 	// ---------------------------------------------------------------------------- Getters and Setters start
 
 	/**
+	 * 设置是否在结果中忽略大小写<br>
+	 * 如果忽略,则在Entity中调用getXXX时,字段值忽略大小写,默认忽略
+	 *
+	 * @param caseInsensitive 否在结果中忽略大小写
+	 * @since 5.2.4
+	 */
+	public void setCaseInsensitive(boolean caseInsensitive) {
+		this.caseInsensitive = caseInsensitive;
+	}
+
+	/**
 	 * 获取{@link SqlConnRunner}
 	 *
 	 * @return {@link SqlConnRunner}

+ 9 - 12
hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java

@@ -1,16 +1,13 @@
 package cn.hutool.db;
 
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.sql.DataSource;
-
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.db.ds.DSFactory;
-import cn.hutool.db.handler.EntityHandler;
-import cn.hutool.db.handler.EntityListHandler;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * 数据访问层模板<br>
@@ -189,7 +186,7 @@ public class DaoTemplate {
 		}
 
 		final Entity where = Entity.create(tableName).set(primaryKeyField, pk);
-		final Entity record = (Entity) entity.clone();
+		final Entity record = entity.clone();
 		record.remove(primaryKeyField);
 
 		return db.update(record, where);
@@ -241,7 +238,7 @@ public class DaoTemplate {
 	 * @throws SQLException SQL执行异常
 	 */
 	public Entity get(Entity where) throws SQLException {
-		return db.find(null, fixEntity(where), new EntityHandler());
+		return db.get(fixEntity(where));
 	}
 	//------------------------------------------------------------- Get end
 	
@@ -276,7 +273,7 @@ public class DaoTemplate {
 	 * @throws SQLException SQL执行异常
 	 */
 	public List<Entity> find(Entity where) throws SQLException {
-		return db.find(null, fixEntity(where), new EntityListHandler());
+		return db.find(null, fixEntity(where));
 	}
 	
 	/**
@@ -294,7 +291,7 @@ public class DaoTemplate {
 		if(false == "select".equals(selectKeyword)){
 			sql = "SELECT * FROM " + this.tableName + " " + sql;
 		}
-		return db.query(sql, new EntityListHandler(), params);
+		return db.query(sql, params);
 	}
 	
 	/**

+ 40 - 24
hutool-db/src/main/java/cn/hutool/db/DbUtil.java

@@ -24,16 +24,20 @@ import cn.hutool.setting.Setting;
 
 /**
  * 数据库操作工具类
- * 
+ *
  * @author Luxiaolei
- * 
  */
 public final class DbUtil {
 	private final static Log log = LogFactory.get();
 
 	/**
+	 * 是否大小写不敏感(默认大小写不敏感)
+	 */
+	protected static boolean caseInsensitiveGlobal = true;
+
+	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
+	 *
 	 * @param dialect 数据源
 	 * @return SQL执行类
 	 */
@@ -43,7 +47,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
+	 *
 	 * @param ds 数据源
 	 * @return SQL执行类
 	 */
@@ -53,7 +57,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
+	 *
 	 * @param conn 数据库连接对象
 	 * @return SQL执行类
 	 */
@@ -63,7 +67,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象,使用默认数据源
-	 * 
+	 *
 	 * @return SQL执行类
 	 * @deprecated 请使用 {@link #use()}
 	 */
@@ -74,7 +78,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
+	 *
 	 * @param ds 数据源
 	 * @return SQL执行类
 	 * @deprecated 请使用 {@link #use(DataSource)}
@@ -86,8 +90,8 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
-	 * @param ds 数据源
+	 *
+	 * @param ds      数据源
 	 * @param dialect SQL方言
 	 * @return SQL执行类
 	 * @deprecated 请使用 {@link #use(DataSource, Dialect)}
@@ -99,7 +103,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的Db,使用默认数据源
-	 * 
+	 *
 	 * @return SQL执行类
 	 */
 	public static Db use() {
@@ -108,7 +112,7 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的Db对象
-	 * 
+	 *
 	 * @param ds 数据源
 	 * @return SQL执行类
 	 */
@@ -118,8 +122,8 @@ public final class DbUtil {
 
 	/**
 	 * 实例化一个新的SQL运行对象
-	 * 
-	 * @param ds 数据源
+	 *
+	 * @param ds      数据源
 	 * @param dialect SQL方言
 	 * @return SQL执行类
 	 */
@@ -129,7 +133,7 @@ public final class DbUtil {
 
 	/**
 	 * 新建数据库会话,使用默认数据源
-	 * 
+	 *
 	 * @return 数据库会话
 	 */
 	public static Session newSession() {
@@ -138,7 +142,7 @@ public final class DbUtil {
 
 	/**
 	 * 新建数据库会话
-	 * 
+	 *
 	 * @param ds 数据源
 	 * @return 数据库会话
 	 */
@@ -149,7 +153,7 @@ public final class DbUtil {
 	/**
 	 * 连续关闭一系列的SQL相关对象<br>
 	 * 这些对象必须按照顺序关闭,否则会出错。
-	 * 
+	 *
 	 * @param objsToClose 需要关闭的对象
 	 */
 	@SuppressWarnings("ConstantConditions")
@@ -183,7 +187,7 @@ public final class DbUtil {
 
 	/**
 	 * 获得默认数据源
-	 * 
+	 *
 	 * @return 默认数据源
 	 */
 	public static DataSource getDs() {
@@ -192,7 +196,7 @@ public final class DbUtil {
 
 	/**
 	 * 获取指定分组的数据源
-	 * 
+	 *
 	 * @param group 分组
 	 * @return 数据源
 	 */
@@ -202,7 +206,7 @@ public final class DbUtil {
 
 	/**
 	 * 获得JNDI数据源
-	 * 
+	 *
 	 * @param jndiName JNDI名称
 	 * @return 数据源
 	 */
@@ -217,7 +221,7 @@ public final class DbUtil {
 
 	/**
 	 * 获得JNDI数据源
-	 * 
+	 *
 	 * @param jndiName JNDI名称
 	 * @return 数据源
 	 */
@@ -231,6 +235,7 @@ public final class DbUtil {
 
 	/**
 	 * 从配置文件中读取SQL打印选项
+	 *
 	 * @param setting 配置文件
 	 * @since 4.1.7
 	 */
@@ -250,14 +255,25 @@ public final class DbUtil {
 
 	/**
 	 * 设置全局配置:是否通过debug日志显示SQL
-	 * 
-	 * @param isShowSql 是否显示SQL
-	 * @param isFormatSql 是否格式化显示的SQL
+	 *
+	 * @param isShowSql    是否显示SQL
+	 * @param isFormatSql  是否格式化显示的SQL
 	 * @param isShowParams 是否打印参数
-	 * @param level SQL打印到的日志等级
+	 * @param level        SQL打印到的日志等级
 	 * @since 4.1.7
 	 */
 	public static void setShowSqlGlobal(boolean isShowSql, boolean isFormatSql, boolean isShowParams, Level level) {
 		SqlLog.INSTANCE.init(isShowSql, isFormatSql, isShowParams, level);
 	}
+
+	/**
+	 * 设置全局是否在结果中忽略大小写<br>
+	 * 如果忽略,则在Entity中调用getXXX时,字段值忽略大小写,默认忽略
+	 *
+	 * @param caseInsensitive 否在结果中忽略大小写
+	 * @since 5.2.4
+	 */
+	public static void setCaseInsensitiveGlobal(boolean caseInsensitive) {
+		caseInsensitiveGlobal = caseInsensitive;
+	}
 }

+ 32 - 14
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java

@@ -1,6 +1,6 @@
 package cn.hutool.db;
 
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ArrayUtil;
@@ -18,6 +18,7 @@ import cn.hutool.db.sql.SqlUtil;
 import cn.hutool.db.sql.Wrapper;
 
 import javax.sql.DataSource;
+import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -31,8 +32,14 @@ import java.util.List;
  *
  * @author Luxiaolei
  */
-public class SqlConnRunner {
+public class SqlConnRunner implements Serializable {
+	private static final long serialVersionUID = 1L;
+
 	private Dialect dialect;
+	/**
+	 * 是否大小写不敏感(默认大小写不敏感)
+	 */
+	protected boolean caseInsensitive = DbUtil.caseInsensitiveGlobal;
 
 	/**
 	 * 实例化一个新的SQL运行对象
@@ -98,7 +105,7 @@ public class SqlConnRunner {
 	 */
 	public int insert(Connection conn, Entity record) throws SQLException {
 		checkConn(conn);
-		if (CollectionUtil.isEmpty(record)) {
+		if (CollUtil.isEmpty(record)) {
 			throw new SQLException("Empty entity provided!");
 		}
 		PreparedStatement ps = null;
@@ -185,7 +192,7 @@ public class SqlConnRunner {
 	 */
 	public List<Object> insertForGeneratedKeys(Connection conn, Entity record) throws SQLException {
 		checkConn(conn);
-		if (CollectionUtil.isEmpty(record)) {
+		if (CollUtil.isEmpty(record)) {
 			throw new SQLException("Empty entity provided!");
 		}
 
@@ -210,7 +217,7 @@ public class SqlConnRunner {
 	 */
 	public Long insertForGeneratedKey(Connection conn, Entity record) throws SQLException {
 		checkConn(conn);
-		if (CollectionUtil.isEmpty(record)) {
+		if (CollUtil.isEmpty(record)) {
 			throw new SQLException("Empty entity provided!");
 		}
 
@@ -235,7 +242,7 @@ public class SqlConnRunner {
 	 */
 	public int del(Connection conn, Entity where) throws SQLException {
 		checkConn(conn);
-		if (CollectionUtil.isEmpty(where)) {
+		if (CollUtil.isEmpty(where)) {
 			//不允许做全表删除
 			throw new SQLException("Empty entity provided!");
 		}
@@ -262,10 +269,10 @@ public class SqlConnRunner {
 	 */
 	public int update(Connection conn, Entity record, Entity where) throws SQLException {
 		checkConn(conn);
-		if (CollectionUtil.isEmpty(record)) {
+		if (CollUtil.isEmpty(record)) {
 			throw new SQLException("Empty entity provided!");
 		}
-		if (CollectionUtil.isEmpty(where)) {
+		if (CollUtil.isEmpty(where)) {
 			//不允许做全表更新
 			throw new SQLException("Empty where provided!");
 		}
@@ -342,7 +349,7 @@ public class SqlConnRunner {
 	 * @throws SQLException SQL执行异常
 	 */
 	public <T> T find(Connection conn, Entity where, RsHandler<T> rsh, String... fields) throws SQLException {
-		return find(conn, CollectionUtil.newArrayList(fields), where, rsh);
+		return find(conn, CollUtil.newArrayList(fields), where, rsh);
 	}
 
 	/**
@@ -355,7 +362,7 @@ public class SqlConnRunner {
 	 * @since 3.2.1
 	 */
 	public List<Entity> find(Connection conn, Entity where) throws SQLException {
-		return find(conn, where.getFieldNames(), where, EntityListHandler.create());
+		return find(conn, where.getFieldNames(), where, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -367,7 +374,7 @@ public class SqlConnRunner {
 	 * @throws SQLException SQL执行异常
 	 */
 	public List<Entity> findAll(Connection conn, Entity where) throws SQLException {
-		return find(conn, where, EntityListHandler.create());
+		return find(conn, where, new EntityListHandler(this.caseInsensitive));
 	}
 
 	/**
@@ -505,7 +512,7 @@ public class SqlConnRunner {
 		checkConn(conn);
 
 		final int count = count(conn, where);
-		PageResultHandler pageResultHandler = PageResultHandler.create(new PageResult<>(page, numPerPage, count));
+		final PageResultHandler pageResultHandler = new PageResultHandler(new PageResult<>(page, numPerPage, count), this.caseInsensitive);
 		return this.page(conn, fields, where, page, numPerPage, pageResultHandler);
 	}
 
@@ -525,14 +532,14 @@ public class SqlConnRunner {
 
 		//查询全部
 		if (null == page) {
-			List<Entity> entityList = this.find(conn, fields, where, new EntityListHandler());
+			List<Entity> entityList = this.find(conn, fields, where, new EntityListHandler(DbUtil.caseInsensitiveGlobal));
 			final PageResult<Entity> pageResult = new PageResult<>(0, entityList.size(), entityList.size());
 			pageResult.addAll(entityList);
 			return pageResult;
 		}
 
 		final int count = count(conn, where);
-		PageResultHandler pageResultHandler = PageResultHandler.create(new PageResult<>(page.getPageNumber(), page.getPageSize(), count));
+		PageResultHandler pageResultHandler = new PageResultHandler(new PageResult<>(page.getPageNumber(), page.getPageSize(), count), this.caseInsensitive);
 		return this.page(conn, fields, where, page, pageResultHandler);
 	}
 
@@ -554,6 +561,17 @@ public class SqlConnRunner {
 	//---------------------------------------------------------------------------- Getters and Setters end
 
 	/**
+	 * 设置是否在结果中忽略大小写<br>
+	 * 如果忽略,则在Entity中调用getXXX时,字段值忽略大小写,默认忽略
+	 *
+	 * @param caseInsensitive 否在结果中忽略大小写
+	 * @since 5.2.4
+	 */
+	public void setCaseInsensitive(boolean caseInsensitive) {
+		this.caseInsensitive = caseInsensitive;
+	}
+
+	/**
 	 * @return SQL方言
 	 */
 	public Dialect getDialect() {

+ 10 - 10
hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java

@@ -1,5 +1,15 @@
 package cn.hutool.db.handler;
 
+import cn.hutool.core.bean.BeanDesc.PropDesc;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.TypeUtil;
+import cn.hutool.db.Entity;
+
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.sql.ResultSet;
@@ -11,16 +21,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import cn.hutool.core.bean.BeanDesc.PropDesc;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.lang.Assert;
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.core.util.TypeUtil;
-import cn.hutool.db.Entity;
-
 /**
  * 数据结果集处理辅助类
  * 

+ 24 - 6
hutool-db/src/main/java/cn/hutool/db/handler/PageResultHandler.java

@@ -8,35 +8,53 @@ import cn.hutool.db.PageResult;
 
 /**
  * 分页结果集处理类 ,处理出的结果为PageResult
- * @author loolly
  *
+ * @author loolly
  */
-public class PageResultHandler implements RsHandler<PageResult<Entity>>{
+public class PageResultHandler implements RsHandler<PageResult<Entity>> {
 	private static final long serialVersionUID = -1474161855834070108L;
 
 	private PageResult<Entity> pageResult;
-	
+	/**
+	 * 是否大小写不敏感
+	 */
+	private boolean caseInsensitive;
+
 	/**
 	 * 创建一个 EntityHandler对象<br>
 	 * 结果集根据给定的分页对象查询数据库,填充结果
+	 *
 	 * @param pageResult 分页结果集空对象
 	 * @return EntityHandler对象
 	 */
 	public static PageResultHandler create(PageResult<Entity> pageResult) {
 		return new PageResultHandler(pageResult);
 	}
-	
+
 	/**
 	 * 构造<br>
-	 *  结果集根据给定的分页对象查询数据库,填充结果
+	 * 结果集根据给定的分页对象查询数据库,填充结果
+	 *
 	 * @param pageResult 分页结果集空对象
 	 */
 	public PageResultHandler(PageResult<Entity> pageResult) {
+		this(pageResult, false);
+	}
+
+	/**
+	 * 构造<br>
+	 * 结果集根据给定的分页对象查询数据库,填充结果
+	 *
+	 * @param pageResult      分页结果集空对象
+	 * @param caseInsensitive 是否大小写不敏感
+	 */
+	public PageResultHandler(PageResult<Entity> pageResult, boolean caseInsensitive) {
 		this.pageResult = pageResult;
+		this.caseInsensitive = caseInsensitive;
 	}
 
 	@Override
 	public PageResult<Entity> handle(ResultSet rs) throws SQLException {
-		return HandleHelper.handleRs(rs, pageResult);
+		return HandleHelper.handleRs(rs, pageResult, this.caseInsensitive);
 	}
 }

+ 0 - 3
hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java

@@ -10,9 +10,6 @@ import org.junit.Test;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.lang.Console;
 import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.db.Db;
-import cn.hutool.db.DbRuntimeException;
-import cn.hutool.db.Entity;
 import cn.hutool.db.handler.EntityListHandler;
 
 /**

+ 1 - 1
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java

@@ -175,7 +175,7 @@ public class ServletUtil {
 	 * @return Bean
 	 */
 	public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
-		return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
+		return fillBean(request, ReflectUtil.newInstanceIfPossible(beanClass), isIgnoreError);
 	}
 	// --------------------------------------------------------- fillBean end
 

+ 2 - 2
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java

@@ -413,9 +413,9 @@ public class HttpUtil {
 			key = item.getKey();
 			value = item.getValue();
 			if (value instanceof Iterable) {
-				value = CollectionUtil.join((Iterable<?>) value, ",");
+				value = CollUtil.join((Iterable<?>) value, ",");
 			} else if (value instanceof Iterator) {
-				value = CollectionUtil.join((Iterator<?>) value, ",");
+				value = CollUtil.join((Iterator<?>) value, ",");
 			}
 			valueStr = Convert.toStr(value);
 			if (StrUtil.isNotEmpty(key)) {

+ 2 - 1
hutool-json/src/test/java/cn/hutool/json/JSONObjectTest.java

@@ -6,12 +6,12 @@ import java.util.List;
 import java.util.Objects;
 
 import cn.hutool.core.annotation.Alias;
+import cn.hutool.core.collection.CollUtil;
 import lombok.Data;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
@@ -377,6 +377,7 @@ public class JSONObjectTest {
 		Assert.assertEquals("张三", jsonObject.getStr("name"));
 		Assert.assertEquals(new Integer(35), jsonObject.getInt("age"));
 
+		@SuppressWarnings("ConstantConditions")
 		JSONObject json = JSONUtil.createObj()
 				.put("name", "张三")
 				.put("age", 35);

+ 1 - 1
hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java

@@ -299,7 +299,7 @@ public abstract class AbsSetting implements OptNullBasicTypeFromStringGetter<Str
 	 * @since 5.0.6
 	 */
 	public <T> T toBean(String group, Class<T> beanClass) {
-		return toBean(group, ReflectUtil.newInstance(beanClass));
+		return toBean(group, ReflectUtil.newInstanceIfPossible(beanClass));
 	}
 
 	/**