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