|
|
|
@ -15,6 +15,8 @@ import java.util.Map; |
|
|
|
|
*/ |
|
|
|
|
public class BeanSqlUtil { |
|
|
|
|
|
|
|
|
|
public static final String SQL_CHARACTER = "_"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 大小写转化驼峰 |
|
|
|
|
* @param str |
|
|
|
@ -23,13 +25,13 @@ public class BeanSqlUtil { |
|
|
|
|
public static String caseToHump(String str){ |
|
|
|
|
StringBuffer strBuffer=new StringBuffer(); |
|
|
|
|
char[] charArray=str.toCharArray(); |
|
|
|
|
for (int i=0;i<charArray.length;i++){ |
|
|
|
|
for (int i=0,charArrayLenght=charArray.length;i<charArrayLenght;i++){ |
|
|
|
|
if (i==0){ |
|
|
|
|
strBuffer.append(charArray[i]); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (Character.isUpperCase(charArray[i])){ |
|
|
|
|
strBuffer.append("_"+charArray[i]); |
|
|
|
|
strBuffer.append(SQL_CHARACTER+charArray[i]); |
|
|
|
|
}else { |
|
|
|
|
strBuffer.append(charArray[i]); |
|
|
|
|
} |
|
|
|
@ -46,7 +48,7 @@ public class BeanSqlUtil { |
|
|
|
|
StringBuffer strBuffer=new StringBuffer(); |
|
|
|
|
char[] charArray=str.toCharArray(); |
|
|
|
|
for (int i=0;i<charArray.length;i++){ |
|
|
|
|
if (charArray[i] == '_'){ |
|
|
|
|
if (SQL_CHARACTER.equals(charArray[i])){ |
|
|
|
|
i++; |
|
|
|
|
strBuffer.append(Character.toUpperCase(charArray[i])); |
|
|
|
|
}else { |
|
|
|
|