Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-generator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
余保谷
ydl-generator
Commits
1ab6c644
Commit
1ab6c644
authored
Sep 11, 2019
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sawwager改为可选择,修改实体类特殊包引用bug,上线版本:3.0.5.RELEASE
parent
75dd86a2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
2 deletions
+27
-2
pom.xml
pom.xml
+1
-1
BasisInfo.java
src/main/java/com/github/flying/cattle/mdg/entity/BasisInfo.java
+4
-0
EntityInfoUtil.java
src/main/java/com/github/flying/cattle/mdg/util/EntityInfoUtil.java
+5
-0
MySqlToJavaUtil.java
src/main/java/com/github/flying/cattle/mdg/util/MySqlToJavaUtil.java
+10
-0
entity.ftl
src/main/resources/freemarker/ftl/entity.ftl
+7
-1
No files found.
pom.xml
View file @
1ab6c644
...
...
@@ -6,7 +6,7 @@
<groupId>
com.github.flying-cattle
</groupId>
<artifactId>
mybatis-dsc-generator
</artifactId>
<version>
3.0.
4
.RELEASE
</version>
<version>
3.0.
5
.RELEASE
</version>
<packaging>
jar
</packaging>
<name>
mybatis-dsc-generator
</name>
...
...
src/main/java/com/github/flying/cattle/mdg/entity/BasisInfo.java
View file @
1ab6c644
...
...
@@ -7,7 +7,9 @@
package
com
.
github
.
flying
.
cattle
.
mdg
.
entity
;
import
java.io.Serializable
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
@@ -81,6 +83,8 @@ public class BasisInfo implements Serializable{
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
,
String
database
,
String
createTime
,
String
agile
,
String
entityUrl
,
String
daoUrl
,
String
mapperUrl
,
String
serviceUrl
,
String
serviceImplUrl
,
String
controllerUrl
,
String
isSwagger
)
{
...
...
src/main/java/com/github/flying/cattle/mdg/util/EntityInfoUtil.java
View file @
1ab6c644
...
...
@@ -13,6 +13,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
com.github.flying.cattle.mdg.entity.BasisInfo
;
import
com.github.flying.cattle.mdg.entity.PropertyInfo
;
...
...
@@ -63,6 +64,10 @@ public class EntityInfoUtil {
bi
.
setIdJdbcType
(
ci
.
getJdbcType
());
}
columns
.
add
(
ci
);
//添加包路径
Set
<
String
>
pkgs
=
bi
.
getPkgs
();
pkgs
.
add
(
MySqlToJavaUtil
.
jdbcTypeToJavaTypePck
(
jdbcType
));
bi
.
setPkgs
(
pkgs
);
}
bi
.
setCis
(
columns
);
// 完成后关闭
...
...
src/main/java/com/github/flying/cattle/mdg/util/MySqlToJavaUtil.java
View file @
1ab6c644
...
...
@@ -62,4 +62,14 @@ public class MySqlToJavaUtil {
MySqlTypeConvert
typeConvert
=
new
MySqlTypeConvert
();
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
();
}
}
src/main/resources/freemarker/ftl/entity.ftl
View file @
1ab6c644
...
...
@@ -15,9 +15,13 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok
.
Data
;
import
lombok
.
EqualsAndHashCode
;
import
lombok
.
experimental
.
Accessors
;
import
java
.
util
.
Date
;
import
org
.
springframework
.
format
.
annotation
.
DateTimeFormat
;
import
java
.
io
.
Serializable
;
<#
list
pkgs
as
ps
>
<#
if
ps
??>
import
${
ps
};
</#
if
>
</#
list
>
/**
*
<
p
>
自动生成工具:
mybatis
-
dsc
-
generator
</
p
>
...
...
@@ -54,7 +58,9 @@ public class ${entityName} extends Model<${entityName}> {
@
ApiModelProperty
(
name
=
"${ci.property}"
,
value
=
"${ci.comment}"
)
</#
if
>
private
${
ci
.
javaType
}
${
ci
.
property
};
</#
list
>
@
Override
protected
Serializable
pkVal
()
{
return
this
.
id
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment