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
1bc03dab
Commit
1bc03dab
authored
Jul 07, 2021
by
yubaogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tett
parent
704aa573
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
6 deletions
+66
-6
BasisInfo.java
src/main/java/com/gitee/flying/cattle/mdg/entity/BasisInfo.java
+7
-1
facade.ftl
src/main/resources/freemarker/ftl/facade.ftl
+23
-0
facadeImpl.ftl
src/main/resources/freemarker/ftl/facadeImpl.ftl
+25
-0
MyGenerator.java
src/test/java/com/flying/cattle/mdg/MyGenerator.java
+11
-5
No files found.
src/main/java/com/gitee/flying/cattle/mdg/entity/BasisInfo.java
View file @
1bc03dab
...
...
@@ -69,6 +69,10 @@ public class BasisInfo implements Serializable{
private
String
serviceImplUrl
;
private
String
facadeUrl
;
private
String
facadeImplUrl
;
private
String
abstractControllerUrl
;
private
String
controllerUrl
;
...
...
@@ -87,7 +91,7 @@ public class BasisInfo implements Serializable{
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
)
{
String
serviceUrl
,
String
serviceImplUrl
,
String
facadeUrl
,
String
facadeImplUrl
,
String
controllerUrl
,
String
isSwagger
)
{
super
();
this
.
project
=
project
;
this
.
author
=
author
;
...
...
@@ -103,6 +107,8 @@ public class BasisInfo implements Serializable{
this
.
mapperUrl
=
mapperUrl
;
this
.
serviceUrl
=
serviceUrl
;
this
.
serviceImplUrl
=
serviceImplUrl
;
this
.
facadeUrl
=
facadeUrl
;
this
.
facadeImplUrl
=
facadeImplUrl
;
this
.
controllerUrl
=
controllerUrl
;
this
.
abstractControllerUrl
=
controllerUrl
.
substring
(
0
,
controllerUrl
.
lastIndexOf
(
"."
))+
".aid"
;
this
.
swaggerConfigUrl
=
controllerUrl
.
substring
(
0
,
controllerUrl
.
lastIndexOf
(
"."
))+
".config"
;
...
...
src/main/resources/freemarker/ftl/facade.ftl
0 → 100644
View file @
1bc03dab
/**
*
@
filename
:${
entityName
}
Service
${
createTime
}
*
@
project
${
project
}
${
version
}
*
Copyright
(
c
)
2020
${
author
}
Co
.
Ltd
.
*
All
right
reserved
.
*/
package
${
facadeUrl
};
import
${
entityUrl
}.${
entityName
};
import
java
.
util
.
LinkedHashMap
;
import
java
.
util
.
List
;
import
com
.
ydl
.
common
.
dto
.
BaseDtoResponse
;
/**
*
@
Description
:
TODO
(${
entityComment
}
服务层
)
*
@
version
:
${
version
}
*
@
author
:
${
author
}
*
*/
public
interface
${
entityName
}
Facade
{
}
\ No newline at end of file
src/main/resources/freemarker/ftl/facadeImpl.ftl
0 → 100644
View file @
1bc03dab
/**
*
@
filename
:${
entityName
}
ServiceImpl
${
createTime
}
*
@
project
${
project
}
${
version
}
*
Copyright
(
c
)
2018
${
author
}
Co
.
Ltd
.
*
All
right
reserved
.
*/
package
${
serviceImplUrl
};
import
${
entityUrl
}.${
entityName
};
import
${
facadeUrl
}.${
entityName
}
Facade
;
import
org
.
springframework
.
stereotype
.
Service
;
import
com
.
alibaba
.
dubbo
.
config
.
annotation
.
Service
;
import
com
.
github
.
pagehelper
.
PageHelper
;
/**
*
@
Description
:
TODO
(${
entityComment
}
服务实现
)
*
*
@
version
:
${
version
}
*
@
author
:
${
author
}
*
*/
@
Service
(
version
=
"1.0.0"
,
interfaceClass
=
${
entityName
}
Facade
.
class
)
public
class
${
entityName
}
FacadeImpl
implements
${
entityName
}
Facade
{
}
\ No newline at end of file
src/test/java/com/flying/cattle/mdg/MyGenerator.java
View file @
1bc03dab
...
...
@@ -10,6 +10,7 @@ import java.io.IOException;
import
java.io.Serializable
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.alibaba.druid.support.json.JSONUtils
;
...
...
@@ -38,15 +39,18 @@ public class MyGenerator implements Serializable {
public
static
final
String
DATABASE
=
"ydl"
;
// 类信息:类名、对象名(一般是【类名】的首字母小些)、类说明、时间
public
static
final
String
TABLE
=
"doctor"
;
public
static
final
String
[]
TABLES
=
{
"doctor"
};
public
static
final
String
CLASSCOMMENT
=
"专家"
;
public
static
final
String
TIME
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
public
static
final
String
AGILE
=
new
Date
().
getTime
()
+
""
;
// 路径信息,分开路径方便聚合工程项目,微服务项目
public
static
final
String
ENTITY_URL
=
"com.ydl.demo.
entity
"
;
public
static
final
String
ENTITY_URL
=
"com.ydl.demo.
po
"
;
public
static
final
String
DAO_URL
=
"com.ydl.demo.mapper"
;
public
static
final
String
XML_URL
=
"com.ydl.demo.mapper.xml"
;
public
static
final
String
SERVICE_URL
=
"com.ydl.demo.service"
;
public
static
final
String
SERVICE_IMPL_URL
=
"com.ydl.demo.service.impl"
;
public
static
final
String
FACADE_URL
=
"com.ydl.demo.facade"
;
public
static
final
String
FACADE_URL_IMPL
=
"com.ydl.demo.facade"
;
public
static
final
String
CONTROLLER_URL
=
"com.ydl.demo.api"
;
//是否是Swagger配置
public
static
final
String
IS_SWAGGER
=
"true"
;
...
...
@@ -54,10 +58,11 @@ public class MyGenerator implements Serializable {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
System
.
out
.
println
(
MyGenerator
.
class
.
getResource
(
""
).
getPath
());
BasisInfo
bi
=
new
BasisInfo
(
PROJECT
,
AUTHOR
,
VERSION
,
URL
,
NAME
,
PASS
,
DATABASE
,
TIME
,
AGILE
,
ENTITY_URL
,
DAO_URL
,
XML_URL
,
SERVICE_URL
,
SERVICE_IMPL_URL
,
CONTROLLER_URL
,
IS_SWAGGER
);
bi
.
setTable
(
TABLE
);
bi
.
setEntityName
(
MySqlToJavaUtil
.
getClassName
(
TABLE
));
bi
.
setObjectName
(
MySqlToJavaUtil
.
changeToJavaFiled
(
TABLE
));
DAO_URL
,
XML_URL
,
SERVICE_URL
,
SERVICE_IMPL_URL
,
FACADE_URL
,
FACADE_URL_IMPL
,
CONTROLLER_URL
,
IS_SWAGGER
);
for
(
String
table
:
TABLES
)
{
bi
.
setTable
(
table
);
bi
.
setEntityName
(
MySqlToJavaUtil
.
getClassName
(
table
));
bi
.
setObjectName
(
MySqlToJavaUtil
.
changeToJavaFiled
(
table
));
bi
.
setEntityComment
(
CLASSCOMMENT
);
try
{
bi
=
EntityInfoUtil
.
getInfo
(
bi
);
...
...
@@ -85,4 +90,5 @@ public class MyGenerator implements Serializable {
e
.
printStackTrace
();
}
}
}
}
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