mybatis返回类型map时key大写转为小写方法

亲测:
SELECT DEPTNO as "deptno",DEPTNAME,DEPTGRADE,PARENTDEPT 
      FROM VMGR_DEPT
      ORDER BY DEPTGRADE,DEPTNO

别人案例:

   

纯java实现方法(推荐):

public class Snippet {
	public static Map transformUpperCase(Map orgMap) {
		Map resultMap = new HashMap<>();

		if (orgMap == null || orgMap.isEmpty()) {
			return resultMap;
		}

		Set keySet = orgMap.keySet();
		for (String key : keySet) {
			String newKey = key.toLowerCase();
			newKey = newKey.replace("_", "");

			resultMap.put(newKey, orgMap.get(key));
		}

		return resultMap;
	}
}

你可能感兴趣的:(JAVA知识)