修复代码生成器可能出现类名错误的问题
This commit is contained in:
@@ -172,7 +172,7 @@ public class GenUtils {
|
|||||||
*/
|
*/
|
||||||
public static String tableToJava(String tableName, String tablePrefix) {
|
public static String tableToJava(String tableName, String tablePrefix) {
|
||||||
if (StringUtils.isNotBlank(tablePrefix)) {
|
if (StringUtils.isNotBlank(tablePrefix)) {
|
||||||
tableName = tableName.replace(tablePrefix, "");
|
tableName = tableName.substring(tablePrefix.length());
|
||||||
}
|
}
|
||||||
return columnToJava(tableName);
|
return columnToJava(tableName);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package com.central.generator.utils;
|
||||||
|
|
||||||
|
import org.assertj.core.api.Assertions;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GenUtils测试用例
|
||||||
|
*
|
||||||
|
* @author zlt
|
||||||
|
* @date 2019/5/10
|
||||||
|
*/
|
||||||
|
@SpringBootTest
|
||||||
|
public class GenUtilsTest {
|
||||||
|
@Test
|
||||||
|
public void testTableToJava() {
|
||||||
|
String javaName = GenUtils.tableToJava("t_event_message", "t_");
|
||||||
|
Assertions.assertThat(javaName).isEqualTo("EventMessage");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user