Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
5295f909
Commit
5295f909
authored
May 06, 2020
by
ZhengJie
Browse files
[代码完善](v2.5): v2.5 beta 代码生成ftl模板中使用@RequiredArgsConstructor注解
2.5 Beta 详情:
https://www.ydyno.com/archives/1225.html
parent
ca88185a
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/resources/template/generator/admin/Controller.ftl
View file @
5295f909
...
@@ -20,6 +20,7 @@ import ${package}.domain.${className};
...
@@ -20,6 +20,7 @@ import ${package}.domain.${className};
import
$
{
package
}
.service.$
{
className
}
Service;
import
$
{
package
}
.service.$
{
className
}
Service;
import
$
{
package
}
.service.dto.$
{
className
}
QueryCriteria;
import
$
{
package
}
.service.dto.$
{
className
}
QueryCriteria;
import
org.springframework.data.domain.Pageable;
import
org.springframework.data.domain.Pageable;
import
lombok.RequiredArgsConstructor;
import
org.springframework.http.HttpStatus;
import
org.springframework.http.HttpStatus;
import
org.springframework.http.ResponseEntity;
import
org.springframework.http.ResponseEntity;
import
org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.security.access.prepost.PreAuthorize;
...
@@ -35,17 +36,14 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -35,17 +36,14 @@ import javax.servlet.http.HttpServletResponse;
*
@author $
{
author
}
*
@author $
{
author
}
*
@date $
{
date
}
*
@date $
{
date
}
**/
**/
@
Api
(
tags
=
"$
{
apiAlias
}
管理")
@
RestController
@
RestController
@
RequiredArgsConstructor
@
Api
(
tags
=
"$
{
apiAlias
}
管理")
@
RequestMapping
("/
api
/${
changeClassName
}")
@
RequestMapping
("/
api
/${
changeClassName
}")
public
class $
{
className
}
Controller
{
public
class $
{
className
}
Controller
{
private
final
$
{
className
}
S
ervice
$
{
changeClassName
}
S
ervice
;
private
final
$
{
className
}
S
ervice
$
{
changeClassName
}
S
ervice
;
public
$
{
className
}
C
ontroller
(
$
{
className
}
S
ervice
$
{
changeClassName
}
S
ervice
)
{
this
.$
{
changeClassName
}
S
ervice
=
$
{
changeClassName
}
S
ervice
;
}
@
L
og
(
"导出数据"
)
@
L
og
(
"导出数据"
)
@
A
piOperation
(
"导出数据"
)
@
A
piOperation
(
"导出数据"
)
@
G
etMapping
(
value
=
"/download"
)
@
G
etMapping
(
value
=
"/download"
)
...
...
eladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl
View file @
5295f909
...
@@ -27,6 +27,7 @@ import me.zhengjie.exception.EntityExistException;
...
@@ -27,6 +27,7 @@ import me.zhengjie.exception.EntityExistException;
</#
if
>
</#
if
>
import
me.zhengjie.utils.ValidationUtil;
import
me.zhengjie.utils.ValidationUtil;
import
me.zhengjie.utils.FileUtil;
import
me.zhengjie.utils.FileUtil;
import
lombok.RequiredArgsConstructor;
import
$
{
package
}
.repository.$
{
className
}
Repository;
import
$
{
package
}
.repository.$
{
className
}
Repository;
import
$
{
package
}
.service.$
{
className
}
Service;
import
$
{
package
}
.service.$
{
className
}
Service;
import
$
{
package
}
.service.dto.$
{
className
}
Dto;
import
$
{
package
}
.service.dto.$
{
className
}
Dto;
...
@@ -60,18 +61,13 @@ import java.util.LinkedHashMap;
...
@@ -60,18 +61,13 @@ import java.util.LinkedHashMap;
*
@date $
{
date
}
*
@date $
{
date
}
**/
**/
@
Service
@
Service
@
RequiredArgsConstructor
@
Transactional
(
propagation
=
Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
@
Transactional
(
propagation
=
Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public
class $
{
className
}
ServiceImpl implements $
{
className
}
Service
{
public
class $
{
className
}
ServiceImpl implements $
{
className
}
Service
{
private
final
$
{
className
}
R
epository
$
{
changeClassName
}
R
epository
;
private
final
$
{
className
}
R
epository
$
{
changeClassName
}
R
epository
;
private
final
$
{
className
}
M
apper
$
{
changeClassName
}
M
apper
;
private
final
$
{
className
}
M
apper
$
{
changeClassName
}
M
apper
;
public
$
{
className
}
S
erviceImpl
(
$
{
className
}
R
epository
$
{
changeClassName
}
R
epository
,
$
{
className
}
M
apper
$
{
changeClassName
}
M
apper
)
{
this
.$
{
changeClassName
}
R
epository
=
$
{
changeClassName
}
R
epository
;
this
.$
{
changeClassName
}
M
apper
=
$
{
changeClassName
}
M
apper
;
}
@
O
verride
@
O
verride
public
M
ap
<
S
tring
,
O
bject
>
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
,
P
ageable
pageable
){
public
M
ap
<
S
tring
,
O
bject
>
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
,
P
ageable
pageable
){
P
age
<$
{
className
}
>
page
=
$
{
changeClassName
}
R
epository
.findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
Q
ueryHelp
.getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
)
;
P
age
<$
{
className
}
>
page
=
$
{
changeClassName
}
R
epository
.findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
Q
ueryHelp
.getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
)
;
...
...
Write
Preview
Supports
Markdown
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