| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 633340d commit 27ab1ea
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -409,18 +409,21 @@ public static String getTableName(String fullName) { | |||
| 409 | 409 | int index = fullName == null ? -1 : fullName.indexOf(":"); | |
| 410 | 410 | return index < 0 ? fullName : fullName.substring(0, index); | |
| 411 | 411 | } | |
| 412 | - | ||
| 412 | + | ||
| 413 | 413 | /**获取变量名 | |
| 414 | 414 | * @param fullName | |
| 415 | 415 | * @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = true, formatAt = true, formatHyphen = true, firstCase = true | |
| 416 | 416 | */ | |
| 417 | 417 | public static String getVariableName(String fullName) { | |
| 418 | + if (isArrayKey(fullName)) { | ||
| 419 | + fullName = StringUtil.addSuffix(fullName.substring(0, fullName.length() - 2), "list"); | ||
| 420 | + } | ||
| 418 | 421 | return formatKey(fullName, true, true, true, true); | |
| 419 | 422 | } | |
| 420 | 423 | ||
| 421 | 424 | /**格式化数组的名称 key[] => keyList; key:alias[] => aliasList; Table-column[] => tableColumnList | |
| 422 | 425 | * @param key empty ? "list" : key + "List" 且首字母小写 | |
| 423 | - * @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = false, formatHyphen = true, firstCase = true | ||
| 426 | + * @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = true, formatHyphen = true, firstCase = true | ||
| 424 | 427 | */ | |
| 425 | 428 | public static String formatArrayKey(String key) { | |
| 426 | 429 | if (isArrayKey(key)) { | |
@@ -431,20 +434,20 @@ public static String formatArrayKey(String key) { | |||
| 431 | 434 | return key.substring(index + 1); //不处理自定义的 | |
| 432 | 435 | } | |
| 433 | 436 | ||
| 434 | - return formatKey(key, false, false, true, true); //节约性能,除了表对象 Table-column:alias[] ,一般都符合变量命名规范 | ||
| 437 | + return formatKey(key, false, true, true, true); //节约性能,除了数组对象 Table-column:alias[] ,一般都符合变量命名规范 | ||
| 435 | 438 | } | |
| 436 | 439 | ||
| 437 | 440 | /**格式化对象的名称 name => name; name:alias => alias | |
| 438 | 441 | * @param key name 或 name:alias | |
| 439 | - * @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = false, formatHyphen = false, firstCase = true | ||
| 442 | + * @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = true, formatHyphen = false, firstCase = true | ||
| 440 | 443 | */ | |
| 441 | 444 | public static String formatObjectKey(String key) { | |
| 442 | 445 | int index = key == null ? -1 : key.indexOf(":"); | |
| 443 | 446 | if (index >= 0) { | |
| 444 | 447 | return key.substring(index + 1); //不处理自定义的 | |
| 445 | 448 | } | |
| 446 | 449 | ||
| 447 | - return formatKey(key, false, false, false, true); //节约性能,除了表对象 Table:alias ,一般都符合变量命名规范 | ||
| 450 | + return formatKey(key, false, true, false, true); //节约性能,除了表对象 Table:alias ,一般都符合变量命名规范 | ||
| 448 | 451 | } | |
| 449 | 452 | ||
| 450 | 453 | /**格式化普通值的名称 name => name; name:alias => alias | |
| Back | FazBrowse Home | New Git URL |
0 commit comments