add 面试相关表
This commit is contained in:
@@ -15,7 +15,7 @@ public class GeneratorCodeMain {
|
||||
try {
|
||||
// 解析
|
||||
ConfigurationParser cp = new ConfigurationParser(warnings);
|
||||
Configuration config = cp.parseConfiguration(GeneratorCodeMain.class.getResourceAsStream("/mybatis-generator.xml"));
|
||||
Configuration config = cp.parseConfiguration(GeneratorCodeMain.class.getResourceAsStream("/mybatis-generator-tk.xml"));
|
||||
// 是否覆盖
|
||||
DefaultShellCallback dsc = new DefaultShellCallback(false);
|
||||
MyBatisGenerator mg = new MyBatisGenerator(config, dsc, warnings);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MyIntrospectedTableMyBatis3Impl extends IntrospectedTableMyBatis3Im
|
||||
return tableName.substring(0, tableName.lastIndexOf("_")) + enterpriseIdTableSuffix;
|
||||
}
|
||||
//平台库
|
||||
return tableName;
|
||||
return tableName.replace("xfsg_","");
|
||||
}
|
||||
|
||||
private String getTableNameFromConfigFile() {
|
||||
|
||||
@@ -188,4 +188,41 @@ public class MyPluginAdapter extends PluginAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialized(IntrospectedTable introspectedTable) {
|
||||
String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
|
||||
// 将tableName转换为驼峰命名(这里假设你已经有了相应的方法)
|
||||
String camelCaseTableName = toCamelCase(tableName.replace("xfsg", ""));
|
||||
|
||||
// 设置 domainObjectName
|
||||
introspectedTable.setIbatis2SqlMapFileName(camelCaseTableName + "DO");
|
||||
|
||||
// 设置 mapperName,注意这个属性可能需要在生成XML后手动设置到XML文件中
|
||||
introspectedTable.setMyBatis3XmlMapperFileName(camelCaseTableName + "Mapper.xml");
|
||||
}
|
||||
|
||||
public static String toCamelCase(String input) {
|
||||
if (input == null || input.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder camelCaseString = new StringBuilder(input.length());
|
||||
boolean capitalizeNext = false;
|
||||
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
char ch = input.charAt(i);
|
||||
|
||||
if (ch == '_') {
|
||||
capitalizeNext = true;
|
||||
} else if (capitalizeNext) {
|
||||
camelCaseString.append(Character.toUpperCase(ch));
|
||||
capitalizeNext = false;
|
||||
} else {
|
||||
camelCaseString.append(Character.toLowerCase(ch));
|
||||
}
|
||||
}
|
||||
|
||||
return camelCaseString.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package generator.defined;
|
||||
|
||||
import org.mybatis.generator.api.IntrospectedTable;
|
||||
import org.mybatis.generator.api.PluginAdapter;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: MyPluginAdapter
|
||||
* @Description: 自定义生成器
|
||||
* @date 2021-11-18 14:11
|
||||
*/
|
||||
public class TKMyPluginAdapter extends PluginAdapter {
|
||||
|
||||
@Override
|
||||
public boolean validate(List<String> list) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialized(IntrospectedTable introspectedTable) {
|
||||
String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
|
||||
// 将tableName转换为驼峰命名(这里假设你已经有了相应的方法)
|
||||
String camelCaseTableName = toCamelCase(tableName.replace("xfsg", ""));
|
||||
|
||||
// 设置 domainObjectName
|
||||
introspectedTable.setIbatis2SqlMapFileName(camelCaseTableName + "DO");
|
||||
|
||||
// 设置 mapperName,注意这个属性可能需要在生成XML后手动设置到XML文件中
|
||||
introspectedTable.setMyBatis3XmlMapperFileName(camelCaseTableName + "Mapper.xml");
|
||||
}
|
||||
|
||||
public static String toCamelCase(String input) {
|
||||
if (input == null || input.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder camelCaseString = new StringBuilder(input.length());
|
||||
boolean capitalizeNext = false;
|
||||
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
char ch = input.charAt(i);
|
||||
|
||||
if (ch == '_') {
|
||||
capitalizeNext = true;
|
||||
} else if (capitalizeNext) {
|
||||
camelCaseString.append(Character.toUpperCase(ch));
|
||||
capitalizeNext = false;
|
||||
} else {
|
||||
camelCaseString.append(Character.toLowerCase(ch));
|
||||
}
|
||||
}
|
||||
|
||||
return camelCaseString.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
</jdbcConnection>
|
||||
|
||||
<!-- targetProject:生成PO类的位置 -->
|
||||
<javaModelGenerator targetPackage="com.cool.store.entity" targetProject="coolstore-partner-model/src/main/java">
|
||||
<javaModelGenerator targetPackage="com.cool.store.entity" targetProject="coolstore-partner-model/src/main/java" >
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</javaModelGenerator>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<javaClientGenerator targetPackage="com.cool.store.mapper" targetProject="coolstore-partner-dao/src/main/java" type="XMLMAPPER" />
|
||||
|
||||
<table tableName="${table.name}" enableCountByExample="false" enableUpdateByExample="true" enableDeleteByExample="false"
|
||||
enableSelectByExample="true" selectByExampleQueryId="true">
|
||||
enableSelectByExample="true" selectByExampleQueryId="true" domainObjectName="${table.object.class}" mapperName="${table.mapper}" >
|
||||
<generatedKey column="id" sqlStatement="Mysql" identity="true" type=""/>
|
||||
</table>
|
||||
</context>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
jdbc.driver = com.mysql.cj.jdbc.Driver
|
||||
jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
|
||||
jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_36?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
|
||||
jdbc.user= coolstore
|
||||
jdbc.password = CSCErYcXniNYm7bT
|
||||
|
||||
table.name = sys_menu_copy1
|
||||
table.name = xfsg_line_interview
|
||||
table.object.class = LineInterviewDO
|
||||
table.mapper = LineInterviewMapper
|
||||
@@ -30,7 +30,7 @@
|
||||
<javaClientGenerator targetPackage="com.cool.store.mapper" targetProject="coolstore-partner-dao/src/main/java" type="XMLMAPPER" />
|
||||
|
||||
<table tableName="super_admin_config" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false">
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
<generatedKey column="id" sqlStatement="Mysql" identity="true" type=""/>
|
||||
</table>
|
||||
</context>
|
||||
|
||||
Reference in New Issue
Block a user