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
704aa573
Commit
704aa573
authored
Jul 07, 2021
by
yubaogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tett
parent
7afec11c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
27 deletions
+34
-27
dao.ftl
src/main/resources/freemarker/ftl/dao.ftl
+2
-1
entity.ftl
src/main/resources/freemarker/ftl/entity.ftl
+1
-1
serviceImpl.ftl
src/main/resources/freemarker/ftl/serviceImpl.ftl
+2
-1
MyGenerator.java
src/test/java/com/flying/cattle/mdg/MyGenerator.java
+29
-24
No files found.
src/main/resources/freemarker/ftl/dao.ftl
View file @
704aa573
...
...
@@ -19,7 +19,7 @@ import ${entityUrl}.${entityName};
*
*/
@
Mapper
public
interface
${
entityName
}
Dao
extends
BaseMapper
<${
entityName
}>
{
public
interface
${
entityName
}
Mapper
extends
BaseMapper
<${
entityName
}>
{
}
\ No newline at end of file
src/main/resources/freemarker/ftl/entity.ftl
View file @
704aa573
...
...
@@ -32,7 +32,7 @@ import ${ps};
@
Data
@
EqualsAndHashCode
(
callSuper
=
false
)
@
Accessors
(
chain
=
true
)
public
class
${
entityName
}
extends
Model
<${
entityName
}>
{
public
class
${
entityName
}
implements
Serializable
{
private
static
final
long
serialVersionUID
=
${
agile
}
L
;
...
...
src/main/resources/freemarker/ftl/serviceImpl.ftl
View file @
704aa573
...
...
@@ -22,6 +22,6 @@ import com.github.pagehelper.PageHelper;
*
*/
@
Service
public
class
${
entityName
}
ServiceImpl
extends
ServiceImpl
<${
entityName
}
Dao
,
${
entityName
}>
implements
${
entityName
}
Service
{
public
class
${
entityName
}
ServiceImpl
extends
BaseService
<
${
entityName
}>
implements
${
entityName
}
Service
{
}
\ No newline at end of file
src/test/java/com/flying/cattle/mdg/MyGenerator.java
View file @
704aa573
...
...
@@ -7,6 +7,7 @@
package
com
.
flying
.
cattle
.
mdg
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -25,28 +26,28 @@ import javax.swing.text.DateFormatter;
* <p>说明: 自动生成工具</P>
* <p>源码地址:https://gitee.com/flying-cattle/mybatis-dsc-generator</P>
*/
public
class
MyGenerator
{
public
class
MyGenerator
implements
Serializable
{
// 基础信息:项目名、作者、版本
public
static
final
String
PROJECT
=
"wallet-sign"
;
public
static
final
String
AUTHOR
=
"BianPeng"
;
public
static
final
String
VERSION
=
"V1.0"
;
// 数据库连接信息:连接URL、用户名、秘密、数据库名
public
static
final
String
URL
=
"jdbc:mysql://
localhost:3306/seata
?useSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8"
;
public
static
final
String
NAME
=
"
root
"
;
public
static
final
String
PASS
=
"
12345678
"
;
public
static
final
String
DATABASE
=
"
seata
"
;
public
static
final
String
URL
=
"jdbc:mysql://
120.26.213.52:3306/ydl
?useSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8"
;
public
static
final
String
NAME
=
"
ydl
"
;
public
static
final
String
PASS
=
"
tt12345
"
;
public
static
final
String
DATABASE
=
"
ydl
"
;
// 类信息:类名、对象名(一般是【类名】的首字母小些)、类说明、时间
public
static
final
String
TABLE
=
"
undo_log
"
;
public
static
final
String
CLASSCOMMENT
=
"
日志
"
;
public
static
final
String
TABLE
=
"
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.
buybit.power
.entity"
;
public
static
final
String
DAO_URL
=
"com.
buybit.power
.mapper"
;
public
static
final
String
XML_URL
=
"com.
buybit.power
.mapper.xml"
;
public
static
final
String
SERVICE_URL
=
"com.
buybit.power
.service"
;
public
static
final
String
SERVICE_IMPL_URL
=
"com.
buybit.power
.service.impl"
;
public
static
final
String
CONTROLLER_URL
=
"com.
buybit.power
.api"
;
public
static
final
String
ENTITY_URL
=
"com.
ydl.demo
.entity"
;
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
CONTROLLER_URL
=
"com.
ydl.demo
.api"
;
//是否是Swagger配置
public
static
final
String
IS_SWAGGER
=
"true"
;
...
...
@@ -60,21 +61,25 @@ public class MyGenerator {
bi
.
setEntityComment
(
CLASSCOMMENT
);
try
{
bi
=
EntityInfoUtil
.
getInfo
(
bi
);
String
fileUrl
=
"D:\\ydlwork\\
generator\\demo
\\src\\main\\java\\"
;
// 生成文件存放位置
String
fileUrl
=
"D:\\ydlwork\\
ydl-demo\\ydl-demo-api
\\src\\main\\java\\"
;
// 生成文件存放位置
//开始生成文件
String
aa1
=
Generator
.
createEntity
(
fileUrl
,
bi
).
toString
();
String
aa2
=
Generator
.
createDao
(
fileUrl
,
bi
).
toString
();
String
aa3
=
Generator
.
createDaoImpl
(
fileUrl
,
bi
).
toString
();
String
aa4
=
Generator
.
createService
(
fileUrl
,
bi
).
toString
();
String
aa5
=
Generator
.
createServiceImpl
(
fileUrl
,
bi
).
toString
();
//
String aa1 = Generator.createEntity(fileUrl, bi).toString();
// String aa2 = Generator.createDao(fileUrl, bi).toString();
//
String aa3 = Generator.createDaoImpl(fileUrl, bi).toString();
String
aa4
=
Generator
.
createService
(
fileUrl
,
bi
).
toString
();
String
aa5
=
Generator
.
createServiceImpl
(
fileUrl
,
bi
).
toString
();
String
aa6
=
Generator
.
createController
(
fileUrl
,
bi
).
toString
();
// 是否创建swagger配置文件
String
aa7
=
Generator
.
createSwaggerConfig
(
fileUrl
,
bi
).
toString
();
System
.
out
.
println
(
aa1
);
System
.
out
.
println
(
aa2
);
System
.
out
.
println
(
aa3
);
System
.
out
.
println
(
aa4
);
System
.
out
.
println
(
aa5
);
System
.
out
.
println
(
aa6
);
System
.
out
.
println
(
aa7
);
// String aa7 = Generator.createSwaggerConfig(fileUrl, bi).toString();
// System.out.println(aa1);
// System.out.println(aa2);
// System.out.println(aa3);
System
.
out
.
println
(
aa4
);
System
.
out
.
println
(
aa5
);
System
.
out
.
println
(
aa6
);
// System.out.println(aa7);
//System.out.println(aa7);
}
catch
(
SQLException
e
)
{
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