Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
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
耿迪迪
gassafety
Commits
296225c3
Commit
296225c3
authored
Sep 03, 2021
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页框架自动生成工具修改 gengdidi
parent
29299ece
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
1 deletion
+72
-1
PageInfoUtil.java
...n/src/main/java/com/zehong/common/utils/PageInfoUtil.java
+30
-0
controller.java.vm
...y-generator/src/main/resources/vm/java/controller.java.vm
+11
-0
service.java.vm
...fety-generator/src/main/resources/vm/java/service.java.vm
+8
-0
serviceImpl.java.vm
...-generator/src/main/resources/vm/java/serviceImpl.java.vm
+13
-0
api.js.vm
gassafety-generator/src/main/resources/vm/js/api.js.vm
+9
-0
index.vue.vm
gassafety-generator/src/main/resources/vm/vue/index.vue.vm
+1
-1
No files found.
gassafety-common/src/main/java/com/zehong/common/utils/PageInfoUtil.java
0 → 100644
View file @
296225c3
package
com
.
zehong
.
common
.
utils
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.beans.BeanUtils
;
/**
* @description:github Pagehelper工具
* @Author:yuyufeng
* @Date:2019/7/22 10:38
*/
public
class
PageInfoUtil
{
public
static
<
P
,
D
>
PageInfo
<
D
>
pageInfo2PageInfoDTO
(
PageInfo
<
P
>
pageInfoPO
,
Class
<
D
>
dClass
)
{
Page
<
D
>
page
=
new
Page
<>(
pageInfoPO
.
getPageNum
(),
pageInfoPO
.
getPageSize
());
page
.
setTotal
(
pageInfoPO
.
getTotal
());
for
(
P
p
:
pageInfoPO
.
getList
())
{
D
d
=
null
;
try
{
d
=
dClass
.
newInstance
();
}
catch
(
InstantiationException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
BeanUtils
.
copyProperties
(
p
,
d
);
page
.
add
(
d
);
}
return
new
PageInfo
<>(
page
);
}
}
gassafety-generator/src/main/resources/vm/java/controller.java.vm
View file @
296225c3
...
...
@@ -37,6 +37,17 @@ public class ${ClassName}Controller extends BaseController
private
I
${
ClassName
}
Service
${
className
}
Service
;
/**
*
${
functionName
}
分页查询
*/
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:pageList')"
)
@
GetMapping
(
"/pageList"
)
public
TableDataInfo
pageList
(${
ClassName
}
${
className
}){
startPage
();
PageInfo
<${
ClassName
}>
page
=
${
className
}
Service
.
select
${
ClassName
}
Page
(${
className
});
return
getDataTable
(
page
);
}
/**
*
查询
${
functionName
}
列表
*/
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:list')"
)
...
...
gassafety-generator/src/main/resources/vm/java/service.java.vm
View file @
296225c3
...
...
@@ -27,6 +27,14 @@ public interface I${ClassName}Service
*/
public
List
<${
ClassName
}>
select
${
ClassName
}
List
(${
ClassName
}
${
className
});
/**
*
查询
${
functionName
}
分页列表
*
*
@
param
${
className
}
${
functionName
}
*
@
return
${
functionName
}
分页集合
*/
public
List
<${
ClassName
}>
select
${
ClassName
}
Page
(${
ClassName
}
${
className
});
/**
*
新增
${
functionName
}
*
...
...
gassafety-generator/src/main/resources/vm/java/serviceImpl.java.vm
View file @
296225c3
...
...
@@ -3,6 +3,7 @@ package ${packageName}.service.impl;
import
java
.
util
.
List
;
#
foreach
($
column
in
$
columns
)
#
if
($
column
.
javaField
==
'createTime'
||
$
column
.
javaField
==
'updateTime'
)
import
com
.
github
.
pagehelper
.
PageInfo
;
import
com
.
zehong
.
common
.
utils
.
DateUtils
;
#
break
#
end
...
...
@@ -55,6 +56,18 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
return
${
className
}
Mapper
.
select
${
ClassName
}
List
(${
className
});
}
/**
*
查询
${
functionName
}
分页列表
*
*
@
param
${
className
}
${
functionName
}
*
@
return
${
functionName
}
*/
@
Override
public
PageInfo
<${
ClassName
}>
select
${
ClassName
}
List
(${
ClassName
}
${
className
})
{
return
new
PageInfo
<>(${
className
}
Mapper
.
select
${
ClassName
}
List
(${
className
}));
}
/**
*
新增
${
functionName
}
*
...
...
gassafety-generator/src/main/resources/vm/js/api.js.vm
View file @
296225c3
import request from '@/utils/request'
// 查询${functionName}列表
export function page${BusinessName}(query) {
return request({
url: '/${moduleName}/${businessName}/pageList',
method: 'get',
params: query
})
}
// 查询${functionName}列表
export function list${BusinessName}(query) {
return request({
...
...
gassafety-generator/src/main/resources/vm/vue/index.vue.vm
View file @
296225c3
...
...
@@ -458,7 +458,7 @@ export default {
}
#end
#end
list
${BusinessName}(this.queryParams).then(response => {
page
${BusinessName}(this.queryParams).then(response => {
this.${businessName}List = response.rows;
this.total = response.total;
this.loading = false;
...
...
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