Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
98f89d4a
Commit
98f89d4a
authored
Jun 24, 2021
by
李成龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码生成模板
parent
d29d1971
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
156 additions
and
182 deletions
+156
-182
MyBatisPlusCodeGenerator.java
.../amos/boot/biz/common/utils/MyBatisPlusCodeGenerator.java
+46
-24
bean.java.ftl
...boot-biz-common/src/main/resources/template/bean.java.ftl
+0
-5
controller.java.ftl
...iz-common/src/main/resources/template/controller.java.ftl
+68
-97
dto.java.ftl
...-boot-biz-common/src/main/resources/template/dto.java.ftl
+5
-25
bean.java.vm
...biz-common/src/main/resources/template/other/bean.java.vm
+0
-0
beanback.java.ftl
...ommon/src/main/resources/template/other/beanback.java.ftl
+0
-0
controller.java.vm
...mmon/src/main/resources/template/other/controller.java.vm
+0
-0
mapper.java.vm
...z-common/src/main/resources/template/other/mapper.java.vm
+0
-0
mapper.xml.vm
...iz-common/src/main/resources/template/other/mapper.xml.vm
+0
-0
service.java.vm
...-common/src/main/resources/template/other/service.java.vm
+0
-0
serviceImpl.java.vm
...mon/src/main/resources/template/other/serviceImpl.java.vm
+0
-0
vo.java.ftl
...-biz-common/src/main/resources/template/other/vo.java.ftl
+0
-0
service.java.ftl
...t-biz-common/src/main/resources/template/service.java.ftl
+2
-4
serviceImpl.java.ftl
...z-common/src/main/resources/template/serviceImpl.java.ftl
+18
-10
controller.java.vm
...iz-common/src/main/resources/template1/controller.java.vm
+1
-4
pom.xml
amos-boot-jcs-system/pom.xml
+5
-0
AmosJcsApplication.java
...em/src/main/java/com/yeejoin/amos/AmosJcsApplication.java
+1
-1
pom.xml
.../amos-boot-module-api/amos-boot-module-common-api/pom.xml
+5
-6
pom.xml
.../amos-boot-module-biz/amos-boot-module-common-biz/pom.xml
+5
-6
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/MyBatisPlusCodeGenerator.java
View file @
98f89d4a
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Scanner
;
import
org.apache.commons.lang.StringUtils
;
import
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException
;
import
com.baomidou.mybatisplus.core.toolkit.StringPool
;
import
com.baomidou.mybatisplus.generator.AutoGenerator
;
import
com.baomidou.mybatisplus.generator.InjectionConfig
;
import
com.baomidou.mybatisplus.generator.config.*
;
import
com.baomidou.mybatisplus.generator.config.DataSourceConfig
;
import
com.baomidou.mybatisplus.generator.config.FileOutConfig
;
import
com.baomidou.mybatisplus.generator.config.GlobalConfig
;
import
com.baomidou.mybatisplus.generator.config.ITypeConvert
;
import
com.baomidou.mybatisplus.generator.config.PackageConfig
;
import
com.baomidou.mybatisplus.generator.config.StrategyConfig
;
import
com.baomidou.mybatisplus.generator.config.TemplateConfig
;
import
com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert
;
import
com.baomidou.mybatisplus.generator.config.po.TableInfo
;
import
com.baomidou.mybatisplus.generator.config.rules.DbColumnType
;
import
com.baomidou.mybatisplus.generator.config.rules.IColumnType
;
import
com.baomidou.mybatisplus.generator.config.rules.NamingStrategy
;
import
com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Scanner
;
/**
* @author DELL
...
...
@@ -26,7 +33,7 @@ public class MyBatisPlusCodeGenerator {
/**
* 项目名称缩写
*/
static
String
projectShortName
=
"
jcs
"
;
static
String
projectShortName
=
"
common
"
;
/**
* 项目api目录
...
...
@@ -53,13 +60,13 @@ public class MyBatisPlusCodeGenerator {
/**
* 接口及实体等代码生成路径
*/
static
String
interfaceCodeOutPath
=
System
.
getProperty
(
"user.dir"
)
+
apiPath
;
static
String
interfaceCodeOutPath
=
System
.
getProperty
(
"user.dir"
)
.
replace
(
"\\amos-boot-biz-common"
,
""
)
+
apiPath
;
/**
* 控制器及接口实现等代码生成路径
*/
static
String
controllerCodeOutPath
=
System
.
getProperty
(
"user.dir"
)
+
bizPath
;
static
String
controllerCodeOutPath
=
System
.
getProperty
(
"user.dir"
)
.
replace
(
"\\amos-boot-biz-common"
,
""
)
+
bizPath
;
/**
...
...
@@ -86,11 +93,12 @@ public class MyBatisPlusCodeGenerator {
// 全局配置
GlobalConfig
gc
=
new
GlobalConfig
();
// 工程路径-最外层
final
String
projectPath
=
System
.
getProperty
(
"user.dir"
);
final
String
projectPath
=
System
.
getProperty
(
"user.dir"
).
replace
(
"\\amos-boot-biz-common"
,
""
);
System
.
out
.
println
(
"projectPath:"
+
projectPath
);
// 代码输出目录
//gc.setOutputDir(codeOutPath);
// 作者
gc
.
setAuthor
(
"
tb
"
);
gc
.
setAuthor
(
"
system_generator
"
);
// 是否自动打开文件夹 建议开启
gc
.
setOpen
(
false
);
// 开启Swagger2 注解支持
...
...
@@ -103,7 +111,8 @@ public class MyBatisPlusCodeGenerator {
DataSourceConfig
dsc
=
new
DataSourceConfig
();
dsc
.
setUrl
(
"jdbc:mysql://172.16.6.60:3306/amos-jcs-biz?serverTimezone=GMT%2B8"
);
// dsc.setSchemaName("public");
dsc
.
setDriverName
(
"com.mysql.jdbc.Driver"
);
// dsc.setDriverName("com.mysql.jdbc.Driver");
dsc
.
setDriverName
(
"com.mysql.cj.jdbc.Driver"
);
dsc
.
setUsername
(
"root"
);
dsc
.
setPassword
(
"root_123"
);
...
...
@@ -135,6 +144,7 @@ public class MyBatisPlusCodeGenerator {
pc
.
setService
(
"api.service"
);
pc
.
setServiceImpl
(
"biz.service.impl"
);
pc
.
setController
(
"biz.controller"
);
pc
.
setXml
(
"api.dto"
);
autoGenerator
.
setPackageInfo
(
pc
);
// 自定义配置
...
...
@@ -162,6 +172,7 @@ public class MyBatisPlusCodeGenerator {
public
String
outputFile
(
TableInfo
tableInfo
)
{
String
filePath
=
controllerCodeOutPath
+
"/controller/"
+
tableInfo
.
getControllerName
()
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"controller:"
+
filePath
);
return
filePath
;
}
});
...
...
@@ -171,6 +182,7 @@ public class MyBatisPlusCodeGenerator {
public
String
outputFile
(
TableInfo
tableInfo
)
{
String
filePath
=
interfaceCodeOutPath
+
"/entity/"
+
tableInfo
.
getEntityName
()
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"entity:"
+
filePath
);
return
filePath
;
}
});
...
...
@@ -181,40 +193,48 @@ public class MyBatisPlusCodeGenerator {
public
String
outputFile
(
TableInfo
tableInfo
)
{
String
filePath
=
interfaceCodeOutPath
+
"/dto/"
+
tableInfo
.
getEntityName
()
+
"Dto"
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"dto:"
+
filePath
);
return
filePath
;
}
});
focList
.
add
(
new
FileOutConfig
(
vo
)
{
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
String
filePath
=
interfaceCodeOutPath
+
"/vo/"
+
tableInfo
.
getEntityName
()
+
"Vo"
+
StringPool
.
DOT_JAVA
;
return
filePath
;
}
});
// focList.add(new FileOutConfig(vo) {
// @Override
// public String outputFile(TableInfo tableInfo) {
// String filePath = interfaceCodeOutPath
// + "/vo/" + tableInfo.getEntityName() + "Vo" + StringPool.DOT_JAVA;
// System.out.println("vo:"+filePath);
// return filePath;
// }
// });
focList
.
add
(
new
FileOutConfig
(
mapper
)
{
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
return
interfaceCodeOutPath
String
filePath
=
interfaceCodeOutPath
+
"/mapper/"
+
tableInfo
.
getEntityName
()
+
"Mapper"
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"mapper:"
+
filePath
);
return
filePath
;
}
});
focList
.
add
(
new
FileOutConfig
(
service
)
{
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
return
interfaceCodeOutPath
String
filePath
=
interfaceCodeOutPath
+
"/service/"
+
tableInfo
.
getServiceName
()
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"service:"
+
filePath
);
return
filePath
;
}
});
focList
.
add
(
new
FileOutConfig
(
serviceImpl
)
{
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
return
controllerCodeOutPath
String
filePath
=
controllerCodeOutPath
+
"/service/impl/"
+
tableInfo
.
getServiceImplName
()
+
StringPool
.
DOT_JAVA
;
System
.
out
.
println
(
"service/impl:"
+
filePath
);
return
filePath
;
}
});
...
...
@@ -231,7 +251,9 @@ public class MyBatisPlusCodeGenerator {
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return
projectPath
+
apiAddress
+
"src/main/resources/mapper/"
+
tableInfo
.
getEntityName
()
+
"Mapper"
+
StringPool
.
DOT_XML
;
String
filePath
=
projectPath
+
apiAddress
+
"src/main/resources/mapper/"
+
tableInfo
.
getEntityName
()
+
"Mapper"
+
StringPool
.
DOT_XML
;
System
.
out
.
println
(
"mapper:"
+
filePath
);
return
filePath
;
}
});
...
...
amos-boot-biz-common/src/main/resources/template/bean.java.ftl
View file @
98f89d4a
...
...
@@ -12,11 +12,6 @@ import lombok.Data;
import
lombok
.
EqualsAndHashCode
;
import
lombok
.
experimental
.
Accessors
;
</#
if
>
import
com
.
baomidou
.
mybatisplus
.
annotation
.
IdType
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableId
;
import
com
.
fasterxml
.
jackson
.
databind
.
annotation
.
JsonSerialize
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableName
;
import
com
.
fasterxml
.
jackson
.
databind
.
ser
.
std
.
ToStringSerializer
;
/**
*
${
table
.
comment
!}
*
...
...
amos-boot-biz-common/src/main/resources/template/controller.java.ftl
View file @
98f89d4a
...
...
@@ -2,7 +2,6 @@ package ${package.Controller};
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMapping
;
import
io
.
swagger
.
annotations
.
ApiOperation
;
import
io
.
swagger
.
annotations
.
Api
;
import
org
.
apache
.
commons
.
lang3
.
StringUtils
;
<#
if
restControllerStyle
>
import
org
.
springframework
.
web
.
bind
.
annotation
.
RestController
;
<#
else
>
...
...
@@ -11,20 +10,17 @@ import org.springframework.stereotype.Controller;
<#
if
superControllerClassPackage
??>
import
${
superControllerClassPackage
};
</#
if
>
import
${
package
.
Service
}.${
table
.
service
Name
};
import
com
.
baomidou
.
mybatisplus
.
core
.
conditions
.
query
.
QueryWrapper
;
import
java
.
util
.
List
;
import
${
package
.
Service
Impl
}.${
table
.
serviceImpl
Name
};
import
org
.
typroject
.
tyboot
.
core
.
restful
.
utils
.
ResponseHelper
;
import
org
.
typroject
.
tyboot
.
core
.
restful
.
utils
.
ResponseModel
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
javax
.
servlet
.
http
.
HttpServletRequest
;
import
com
.
baomidou
.
mybatisplus
.
core
.
metadata
.
IPage
;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
import
${
package
.
Entity
}.${
entity
};
import
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
NameUtils
;
import
${
package
.
Xml
}.${
entity
}
Dto
;
import
org
.
typroject
.
tyboot
.
core
.
restful
.
doc
.
TycloudOperation
;
import
org
.
typroject
.
tyboot
.
core
.
foundation
.
enumeration
.
UserType
;
import
java
.
util
.
Arrays
;
/**
...
...
@@ -50,106 +46,81 @@ public class ${table.controllerName} {
</#
if
>
@
Autowired
${
table
.
service
Name
}
${
table
.
service
Name
?
uncap_first
};
${
table
.
service
ImplName
}
${
table
.
serviceImpl
Name
?
uncap_first
};
/**
*
新增
${
table
.
comment
}
*
新增
${
table
.
comment
}
*
@
return
*/
@
TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@
RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@
ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增${table.comment}"
,
notes
=
"新增${table.comment}"
)
public
boolean
save
${
entity
}(
HttpServletRequest
request
,
@
RequestBody
${
entity
}
${
entity
?
uncap_first
}){
return
${
table
.
serviceName
?
uncap_first
}.
save
(${
entity
?
uncap_first
});
}
/**
*
根据
id
删除
*
@
param
id
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
PostMapping
(
value
=
"/save"
)
@
ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增${table.comment}"
,
notes
=
"新增${table.comment}"
)
public
ResponseModel
<${
entity
}
Dto
>
save
(@
RequestBody
${
entity
}
Dto
model
)
{
model
=${
table
.
serviceImplName
?
uncap_first
}.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
*
根据
sequenceNbr
更新
*
@
param
sequenceNbr
主键
*
@
return
*/
@
TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@
RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@
ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@
PathVariable
Long
id
){
return
${
table
.
serviceName
?
uncap_first
}.
removeById
(
id
);
}
/**
*
修改
${
table
.
comment
}
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
PutMapping
(
value
=
"/{sequenceNbr}"
)
@
ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新${table.comment}"
,
notes
=
"根据sequenceNbr更新${table.comment}"
)
public
ResponseModel
<${
entity
}
Dto
>
updateBySequenceNbr
${
entity
}(@
RequestBody
${
entity
}
Dto
model
,@
PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
updateWithModel
(
model
));
}
/**
*
根据
sequenceNbr
删除
*
@
param
sequenceNbr
主键
*
@
return
*/
@
TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@
RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@
ApiOperation
(
httpMethod
=
"
PUT"
,
value
=
"修改${table.comment}"
,
notes
=
"修改
${table.comment}"
)
public
boolean
updateById
${
entity
}(
HttpServletRequest
request
,
@
RequestBody
${
entity
}
${
entity
?
uncap_first
}
){
return
${
table
.
serviceName
?
uncap_first
}.
updateById
(${
entity
?
uncap_first
}
);
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@
ApiOperation
(
httpMethod
=
"
DELETE"
,
value
=
"根据sequenceNbr删除${table.comment}"
,
notes
=
"根据sequenceNbr删除
${table.comment}"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@
PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
removeById
(
sequenceNbr
)
);
}
/**
*
根据
id
查询
*
@
param
id
*
根据
sequenceNbr
查询
*
@
param
sequenceNbr
主键
*
@
return
*/
@
TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@
RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询
"
)
public
${
entity
}
selectById
(
HttpServletRequest
request
,
@
PathVariable
Long
id
){
return
${
table
.
serviceName
?
uncap_first
}.
getById
(
id
);
}
/**
*
列表分页查询
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
GetMapping
(
value
=
"/{sequenceNbr}"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个${table.comment}"
,
notes
=
"根据sequenceNbr查询单个${table.comment}
"
)
public
ResponseModel
<${
entity
}
Dto
>
seleteOne
(@
PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryBySeq
(
sequenceNbr
));
}
/**
*
列表分页查询
*@
param
current
当前页
*
@
param
current
每页大小
*
@
return
*/
@
TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@
RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<${
entity
}>
listPage
(
String
pageNum
,
String
pageSize
,
${
entity
}
${
entity
?
uncap_first
}){
Page
<${
entity
}>
pageBean
;
QueryWrapper
<${
entity
}>
${
entity
?
uncap_first
}
QueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
${
entity
}>
aClass
=
${
entity
?
uncap_first
}.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(${
entity
?
uncap_first
});
if
(
o
!= null) {
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(${
entity
?
uncap_first
});
${
entity
?
uncap_first
}
QueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(${
entity
?
uncap_first
});
${
entity
?
uncap_first
}
QueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(${
entity
?
uncap_first
});
${
entity
?
uncap_first
}
QueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
String
fileValue
=
(
String
)
field
.
get
(${
entity
?
uncap_first
});
${
entity
?
uncap_first
}
QueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
catch
(
Exception
e
)
{
}
});
IPage
<${
entity
}>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
${
table
.
serviceName
?
uncap_first
}.
page
(
pageBean
,
${
entity
?
uncap_first
}
QueryWrapper
);
return
page
;
}
}
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
GetMapping
(
value
=
"/page"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"${table.comment}分页查询"
,
notes
=
"${table.comment}分页查询"
)
public
ResponseModel
<
Page
<${
entity
}
Dto
>>
queryForPage
(@
RequestParam
(
value
=
"current"
)
int
current
,@
RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<${
entity
}
Dto
>
page
=
new
Page
<${
entity
}
Dto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
Page
(
page
));
}
/**
*
列表全部数据查询
*@
return
*/
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"${table.comment}列表全部数据查询"
,
notes
=
"${table.comment}列表全部数据查询"
)
@
GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<${
entity
}
Dto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
List
());
}
}
</#
if
>
amos-boot-biz-common/src/main/resources/template/dto.java.ftl
View file @
98f89d4a
package
com
.
yeejoin
.
amos
.
boot
.
module
.${
package
.
ModuleName
}.
api
.
dto
;
<#
list
table
.
importPackages
as
pkg
>
import
${
pkg
};
</#
list
>
<#
if
swagger2
>
import
io
.
swagger
.
annotations
.
ApiModel
;
import
io
.
swagger
.
annotations
.
ApiModelProperty
;
</#
if
>
import
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
dto
.
BaseDto
;
<#
if
entityLombokModel
>
import
lombok
.
Data
;
import
lombok
.
EqualsAndHashCode
;
import
lombok
.
experimental
.
Accessors
;
</#
if
>
import
com
.
baomidou
.
mybatisplus
.
annotation
.
IdType
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableId
;
import
com
.
fasterxml
.
jackson
.
databind
.
annotation
.
JsonSerialize
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableName
;
import
com
.
fasterxml
.
jackson
.
databind
.
ser
.
std
.
ToStringSerializer
;
/**
*
${
table
.
comment
!}
*
...
...
@@ -30,24 +20,14 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
<#
else
>
@
EqualsAndHashCode
(
callSuper
=
false
)
</#
if
>
@
Accessors
(
chain
=
true
)
</#
if
>
<#
if
table
.
convert
>
@
TableName
(
"${table.name}"
)
</#
if
>
<#
if
swagger2
>
@
ApiModel
(
value
=
"${entity}Dto"
,
description
=
"${table.comment!}"
)
</#
if
>
<#
if
superEntityClass
??>
public
class
${
entity
}
Dto
extends
${
superEntityClass
}<#
if
activeRecord
><${
entity
}></#
if
>
{
<#
elseif
activeRecord
>
public
class
${
entity
}
Dto
{
<#
else
>
public
class
${
entity
}
Dto
implements
Serializable
{
</#
if
>
<#
if
entitySerialVersionUID
>
private
static
final
long
serialVersionUID
=
1L
;
</#
if
>
public
class
${
entity
}
Dto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
<#--
----------
BEGIN
字段循环遍历
---------->
<#
list
table
.
fields
as
field
>
...
...
amos-boot-biz-common/src/main/resources/template/bean.java.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
bean.java.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/beanback.java.ftl
→
amos-boot-biz-common/src/main/resources/template/
other/
beanback.java.ftl
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/controller.java.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
controller.java.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/mapper.java.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
mapper.java.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/mapper.xml.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
mapper.xml.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/service.java.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
service.java.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/serviceImpl.java.vm
→
amos-boot-biz-common/src/main/resources/template/
other/
serviceImpl.java.vm
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/vo.java.ftl
→
amos-boot-biz-common/src/main/resources/template/
other/
vo.java.ftl
View file @
98f89d4a
File moved
amos-boot-biz-common/src/main/resources/template/service.java.ftl
View file @
98f89d4a
package
com
.
yeejoin
.
amos
.
boot
.
module
.${
package
.
ModuleName
}.
api
.
service
;
import
${
package
.
Entity
}.${
entity
};
import
${
superServiceClassPackage
};
/**
*
${
table
.
comment
!}
服务
类
*
${
table
.
comment
!}
接口
类
*
*
@
author
${
author
}
*
@
date
${
date
}
...
...
@@ -12,7 +10,7 @@ import ${superServiceClassPackage};
<#
if
kotlin
>
interface
${
table
.
serviceName
}
:
${
superServiceClass
}<${
entity
}>
<#
else
>
public
interface
${
table
.
serviceName
}
extends
${
superServiceClass
}<${
entity
}>
{
public
interface
${
table
.
serviceName
}
{
}
</#
if
>
amos-boot-biz-common/src/main/resources/template/serviceImpl.java.ftl
View file @
98f89d4a
...
...
@@ -3,22 +3,30 @@ package ${package.ServiceImpl};
import
${
package
.
Entity
}.${
entity
};
import
${
package
.
Mapper
}.${
table
.
mapperName
};
import
${
package
.
Service
}.${
table
.
serviceName
};
import
${
superServiceImplClassPackage
};
import
${
package
.
Xml
}.${
entity
}
Dto
;
import
org
.
typroject
.
tyboot
.
core
.
rdbms
.
service
.
BaseService
;
import
org
.
springframework
.
stereotype
.
Service
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
import
java
.
util
.
List
;
/**
*
${
table
.
comment
!}
服务实现类
*
${
table
.
comment
!}服务实现类
*
*
@
author
${
author
}
*
@
date
${
date
}
*/
@
Service
<#
if
kotlin
>
open
class
${
table
.
serviceImplName
}
:
${
superServiceImplClass
}<${
table
.
mapperName
},
${
entity
}>(),
${
table
.
serviceName
}
{
}
<#
else
>
public
class
${
table
.
serviceImplName
}
extends
${
superServiceImplClass
}<${
table
.
mapperName
},
${
entity
}>
implements
${
table
.
serviceName
}
{
public
class
${
table
.
serviceImplName
}
extends
BaseService
<${
entity
}
Dto
,${
entity
},${
table
.
mapperName
}>
implements
${
table
.
serviceName
}
{
/**
*
分页查询
*/
public
Page
<${
entity
}
Dto
>
queryFor
${
entity
}
Page
(
Page
<${
entity
}
Dto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
*
列表查询
示例
*/
public
List
<${
entity
}
Dto
>
queryFor
${
entity
}
List
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
</#
if
>
amos-boot-biz-common/src/main/resources/template1/controller.java.vm
View file @
98f89d4a
...
...
@@ -67,10 +67,7 @@ public ResponseModel<${entity}Model> seleteOne(@PathVariable Long sequenceNbr)
@
TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
)
@
ApiOperation
(
value
=
"分页查询"
)
@
RequestMapping
(
value
=
"/page"
,
method
=
RequestMethod
.
GET
)
public
ResponseModel
<
Page
>
queryForPage
(
@
RequestParam
(
value
=
"agencyCode"
)
String
agencyCode
,
@
RequestParam
(
value
=
"current"
)
int
current
,
@
RequestParam
(
value
=
"size"
)
int
size
)
public
ResponseModel
<
Page
>
queryForPage
(@
RequestParam
(
value
=
"agencyCode"
)
String
agencyCode
,@
RequestParam
(
value
=
"current"
)
int
current
,@
RequestParam
(
value
=
"size"
)
int
size
)
{
Page
page
=
new
Page
();
page
.
setCurrent
(
current
);
...
...
amos-boot-jcs-system/pom.xml
View file @
98f89d4a
...
...
@@ -17,6 +17,11 @@
<artifactId>
amos-boot-module-jcs-biz
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-biz
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
</dependencies>
<build>
...
...
amos-boot-jcs-system/src/main/java/com/yeejoin/amos/AmosJcsApplication.java
View file @
98f89d4a
...
...
@@ -38,7 +38,7 @@ import java.net.UnknownHostException;
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"com.yeejoin.amos.boot.module.
jcs
.api.mapper"
})
"com.yeejoin.amos.boot.module.
*
.api.mapper"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
})
public
class
AmosJcsApplication
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/pom.xml
View file @
98f89d4a
...
...
@@ -7,12 +7,11 @@
<version>
1.0.0
</version>
</parent>
<artifactId>
amos-boot-module-common-api
</artifactId>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-biz-common
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
</dependencies>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/pom.xml
View file @
98f89d4a
...
...
@@ -9,12 +9,11 @@
<artifactId>
amos-boot-module-common-biz
</artifactId>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-api
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
</dependencies>
</project>
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