diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/TableConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/TableConfig.java index c9239cb0..fa87c506 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/TableConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/TableConfig.java @@ -48,6 +48,8 @@ public class TableConfig { private Map columnConfigMap; + private Boolean mapperGenerateEnable = Boolean.TRUE; + public String getTableName() { return tableName; @@ -105,6 +107,14 @@ public class TableConfig { this.columnConfigMap = columnConfigMap; } + public Boolean getMapperGenerateEnable() { + return mapperGenerateEnable; + } + + public void setMapperGenerateEnable(Boolean mapperGenerateEnable) { + this.mapperGenerateEnable = mapperGenerateEnable; + } + public void addColumnConfig(ColumnConfig columnConfig) { if (columnConfigMap == null) { columnConfigMap = new HashMap<>(); diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java index 67a50c50..b54eb846 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java @@ -117,22 +117,22 @@ public class Column { boolean needComma = false; if (isAutoIncrement) { - annotations.append("keyType=KeyType.Auto"); + annotations.append("keyType = KeyType.Auto"); needComma = true; } else if (columnConfig.getKeyType() != null) { - annotations.append("keyType=KeyType." + columnConfig.getKeyType().name()); + annotations.append("keyType = KeyType." + columnConfig.getKeyType().name()); needComma = true; } if (columnConfig.getKeyValue() != null) { addComma(annotations, needComma); - annotations.append("value=\"" + columnConfig.getKeyValue() + "\""); + annotations.append("value = \"" + columnConfig.getKeyValue() + "\""); needComma = true; } if (columnConfig.getKeyBefore() != null) { addComma(annotations, needComma); - annotations.append("before=" + columnConfig.getKeyBefore()); + annotations.append("before = " + columnConfig.getKeyBefore()); } if (annotations.length() == 4) { @@ -155,42 +155,42 @@ public class Column { annotations.append("@Column("); boolean needComma = false; if (columnConfig.getOnInsertValue() != null) { - annotations.append("onInsertValue=\"" + columnConfig.getOnInsertValue() + "\""); + annotations.append("onInsertValue = \"" + columnConfig.getOnInsertValue() + "\""); needComma = true; } if (columnConfig.getOnUpdateValue() != null) { addComma(annotations, needComma); - annotations.append("onUpdateValue=\"" + columnConfig.getOnUpdateValue() + "\""); + annotations.append("onUpdateValue = \"" + columnConfig.getOnUpdateValue() + "\""); needComma = true; } if (columnConfig.getLarge() != null) { addComma(annotations, needComma); - annotations.append("isLarge=" + columnConfig.getLarge()); + annotations.append("isLarge = " + columnConfig.getLarge()); needComma = true; } if (columnConfig.getLogicDelete() != null) { addComma(annotations, needComma); - annotations.append("isLogicDelete=" + columnConfig.getLogicDelete()); + annotations.append("isLogicDelete = " + columnConfig.getLogicDelete()); needComma = true; } if (columnConfig.getVersion() != null) { addComma(annotations, needComma); - annotations.append("version=" + columnConfig.getVersion()); + annotations.append("version = " + columnConfig.getVersion()); needComma = true; } if (columnConfig.getJdbcType() != null) { addComma(annotations, needComma); - annotations.append("jdbcType=JdbcType." + columnConfig.getJdbcType().name()); + annotations.append("jdbcType = JdbcType." + columnConfig.getJdbcType().name()); needComma = true; } if (columnConfig.getTypeHandler() != null) { addComma(annotations, needComma); - annotations.append("typeHandler=" + columnConfig.getTypeHandler().getSimpleName() + ".class"); + annotations.append("typeHandler = " + columnConfig.getTypeHandler().getSimpleName() + ".class"); needComma = true; } if (Boolean.TRUE.equals(columnConfig.getTenantId())) { addComma(annotations, needComma); - annotations.append("tenantId=true"); + annotations.append("tenantId = true"); } annotations.append(")"); } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java index a39fd612..a05fdf5f 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java @@ -249,15 +249,18 @@ public class Table { if (tableConfig.getSetListenerClass() != null) { tableAnnotation.append(", onSet = " + tableConfig.getUpdateListenerClass().getSimpleName() + ".class"); } + if (Boolean.FALSE.equals(tableConfig.getMapperGenerateEnable())) { + tableAnnotation.append(", mapperGenerateEnable = false"); + } } return tableAnnotation.append(")").toString(); } - public String buildMapperImport(){ + public String buildMapperImport() { return globalConfig.getMapperSupperClass().getName(); } - public String buildMapperName(){ + public String buildMapperName() { return globalConfig.getMapperSupperClass().getSimpleName(); }