!15 修复代码生成器导入数据表,编辑字段问题,兼容mysql8
Merge pull request !15 from hawk/master
This commit is contained in:
commit
dacded0e7a
|
|
@ -54,7 +54,7 @@ public interface GenTableMapper extends IBaseMapper<GenTable> {
|
||||||
"#{name}" +
|
"#{name}" +
|
||||||
"</foreach>",
|
"</foreach>",
|
||||||
"</script>"})
|
"</script>"})
|
||||||
List<Map<String, String>> selectDbTableListByNames(String[] tableNames);
|
List<DbTableVo> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据表名查询列信息
|
* 根据表名查询列信息
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,8 @@ public class GenerateServiceImpl implements IGenerateService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importTable(String[] tableNames) {
|
public void importTable(String[] tableNames) {
|
||||||
try {
|
try {
|
||||||
List<Map<String, String>> tables = genTableMapper.selectDbTableListByNames(tableNames);
|
List<DbTableVo> tables = genTableMapper.selectDbTableListByNames(tableNames);
|
||||||
for (Map<String, String> map : tables) {
|
for (DbTableVo map : tables) {
|
||||||
// 生成表信息
|
// 生成表信息
|
||||||
GenTable table = new GenTable();
|
GenTable table = new GenTable();
|
||||||
GenUtil.initTable(table, map);
|
GenUtil.initTable(table, map);
|
||||||
|
|
@ -196,7 +196,7 @@ public class GenerateServiceImpl implements IGenerateService {
|
||||||
|
|
||||||
// 生成列信息
|
// 生成列信息
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
String tableName = map.get("table_name");
|
String tableName = map.getTableName();
|
||||||
List<GenTableColumn> genTableColumns = genTableMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> genTableColumns = genTableMapper.selectDbTableColumnsByName(tableName);
|
||||||
for (GenTableColumn column : genTableColumns) {
|
for (GenTableColumn column : genTableColumns) {
|
||||||
GenUtil.initColumn(column, table);
|
GenUtil.initColumn(column, table);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.mdd.generator.constant.JavaConstants;
|
||||||
import com.mdd.generator.constant.SqlConstants;
|
import com.mdd.generator.constant.SqlConstants;
|
||||||
import com.mdd.generator.entity.GenTable;
|
import com.mdd.generator.entity.GenTable;
|
||||||
import com.mdd.generator.entity.GenTableColumn;
|
import com.mdd.generator.entity.GenTableColumn;
|
||||||
|
import com.mdd.generator.vo.DbTableVo;
|
||||||
import org.apache.commons.lang3.RegExUtils;
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -23,12 +24,12 @@ public class GenUtil {
|
||||||
* @param table 表
|
* @param table 表
|
||||||
* @param map 参数
|
* @param map 参数
|
||||||
*/
|
*/
|
||||||
public static void initTable(GenTable table, Map<String, String> map) {
|
public static void initTable(GenTable table, DbTableVo map) {
|
||||||
String tableName = map.get("table_name");
|
String tableName = map.getTableName();
|
||||||
String tableDesc = map.get("table_comment");
|
String tableDesc = map.getTableComment();
|
||||||
table.setTableName(tableName);
|
table.setTableName(tableName);
|
||||||
table.setTableComment(tableDesc);
|
table.setTableComment(tableDesc);
|
||||||
table.setAuthorName(map.getOrDefault("author_name", ""));
|
table.setAuthorName(map.getAuthorName());
|
||||||
table.setEntityName(GenUtil.toClassName(tableName));
|
table.setEntityName(GenUtil.toClassName(tableName));
|
||||||
table.setModuleName(GenUtil.toModuleName(tableName));
|
table.setModuleName(GenUtil.toModuleName(tableName));
|
||||||
table.setFunctionName(GenUtil.replaceText(tableDesc));
|
table.setFunctionName(GenUtil.replaceText(tableDesc));
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ public class DbTableVo implements Serializable {
|
||||||
|
|
||||||
private String tableName; // 表的名称
|
private String tableName; // 表的名称
|
||||||
private String tableComment; // 表的描述
|
private String tableComment; // 表的描述
|
||||||
|
private String authorName; // 作者名称
|
||||||
private String createTime; // 创建时间
|
private String createTime; // 创建时间
|
||||||
private String updateTime; // 更新时间
|
private String updateTime; // 更新时间
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue