Commit 1ab6c644 by

sawwager改为可选择,修改实体类特殊包引用bug,上线版本:3.0.5.RELEASE

parent 75dd86a2
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>com.github.flying-cattle</groupId> <groupId>com.github.flying-cattle</groupId>
<artifactId>mybatis-dsc-generator</artifactId> <artifactId>mybatis-dsc-generator</artifactId>
<version>3.0.4.RELEASE</version> <version>3.0.5.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>mybatis-dsc-generator</name> <name>mybatis-dsc-generator</name>
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
package com.github.flying.cattle.mdg.entity; package com.github.flying.cattle.mdg.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -81,6 +83,8 @@ public class BasisInfo implements Serializable{ ...@@ -81,6 +83,8 @@ public class BasisInfo implements Serializable{
private String isSwagger="true"; private String isSwagger="true";
private Set<String> pkgs = new HashSet<String>();
public BasisInfo(String project, String author, String version, String dbUrl, String dbName, String dbPassword, public BasisInfo(String project, String author, String version, String dbUrl, String dbName, String dbPassword,
String database, String createTime, String agile, String entityUrl, String daoUrl, String mapperUrl, String database, String createTime, String agile, String entityUrl, String daoUrl, String mapperUrl,
String serviceUrl, String serviceImplUrl, String controllerUrl,String isSwagger) { String serviceUrl, String serviceImplUrl, String controllerUrl,String isSwagger) {
......
...@@ -13,6 +13,7 @@ import java.sql.ResultSet; ...@@ -13,6 +13,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import com.github.flying.cattle.mdg.entity.BasisInfo; import com.github.flying.cattle.mdg.entity.BasisInfo;
import com.github.flying.cattle.mdg.entity.PropertyInfo; import com.github.flying.cattle.mdg.entity.PropertyInfo;
...@@ -63,6 +64,10 @@ public class EntityInfoUtil { ...@@ -63,6 +64,10 @@ public class EntityInfoUtil {
bi.setIdJdbcType(ci.getJdbcType()); bi.setIdJdbcType(ci.getJdbcType());
} }
columns.add(ci); columns.add(ci);
//添加包路径
Set<String> pkgs= bi.getPkgs();
pkgs.add(MySqlToJavaUtil.jdbcTypeToJavaTypePck(jdbcType));
bi.setPkgs(pkgs);
} }
bi.setCis(columns); bi.setCis(columns);
// 完成后关闭 // 完成后关闭
......
...@@ -62,4 +62,14 @@ public class MySqlToJavaUtil { ...@@ -62,4 +62,14 @@ public class MySqlToJavaUtil {
MySqlTypeConvert typeConvert= new MySqlTypeConvert(); MySqlTypeConvert typeConvert= new MySqlTypeConvert();
return typeConvert.processTypeConvert(DateType.ONLY_DATE, sqlType).getType(); return typeConvert.processTypeConvert(DateType.ONLY_DATE, sqlType).getType();
} }
/**
* <p>说明:把sql的数据类型转为java需要的类型</p>
* @param sqlType sql类型
* @return String java类型
*/
public static String jdbcTypeToJavaTypePck(String sqlType) {
MySqlTypeConvert typeConvert= new MySqlTypeConvert();
return typeConvert.processTypeConvert(DateType.ONLY_DATE, sqlType).getPkg();
}
} }
...@@ -15,9 +15,13 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -15,9 +15,13 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
<#list pkgs as ps>
<#if ps??>
import ${ps};
</#if>
</#list>
/** /**
* <p>自动生成工具:mybatis-dsc-generator</p> * <p>自动生成工具:mybatis-dsc-generator</p>
...@@ -54,7 +58,9 @@ public class ${entityName} extends Model<${entityName}> { ...@@ -54,7 +58,9 @@ public class ${entityName} extends Model<${entityName}> {
@ApiModelProperty(name = "${ci.property}" , value = "${ci.comment}") @ApiModelProperty(name = "${ci.property}" , value = "${ci.comment}")
</#if> </#if>
private ${ci.javaType} ${ci.property}; private ${ci.javaType} ${ci.property};
</#list> </#list>
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
return this.id; return this.id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment