File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
main/java/tk/mybatis/mapper/util
test/java/tk/mybatis/mapper/helper Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -92,9 +92,9 @@ public static String camelhumpToUnderline(String str) {
92
92
for (int i = 0 ; i < size ; i ++) {
93
93
c = chars [i ];
94
94
if (isUppercaseAlpha (c )) {
95
- sb .append ('_' ).append (c );
95
+ sb .append ('_' ).append (toLowerAscii ( c ) );
96
96
} else {
97
- sb .append (toUpperAscii ( c ) );
97
+ sb .append (c );
98
98
}
99
99
}
100
100
return sb .charAt (0 ) == '_' ? sb .substring (1 ) : sb .toString ();
Original file line number Diff line number Diff line change
1
+ package tk .mybatis .mapper .helper ;
2
+
3
+ import org .junit .Assert ;
4
+ import org .junit .Test ;
5
+ import tk .mybatis .mapper .util .StringUtil ;
6
+
7
+ /**
8
+ * @author liuzh_3nofxnp
9
+ * @since 2016-08-29 22:02
10
+ */
11
+ public class CamelCaseTest {
12
+
13
+ @ Test
14
+ public void testCamelhumpToUnderline () {
15
+ Assert .assertEquals ("user_id" , StringUtil .camelhumpToUnderline ("userId" ));
16
+ Assert .assertEquals ("sys_user" , StringUtil .camelhumpToUnderline ("sysUser" ));
17
+ Assert .assertEquals ("sys_user_role" , StringUtil .camelhumpToUnderline ("sysUserRole" ));
18
+ Assert .assertEquals ("s_function" , StringUtil .camelhumpToUnderline ("sFunction" ));
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments