Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projectArtifacture
Project
Project
Details
Activity
Releases
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
yangzhaojun
projectArtifacture
Commits
8de48b09
Commit
8de48b09
authored
Jan 18, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善rows page
parent
85f09dc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
PaginationController.java
...a/org/rcisoft/common/controller/PaginationController.java
+15
-9
controller.ftl
src/main/resources/templates/codeftl/controller.ftl
+1
-1
repository.ftl
src/main/resources/templates/codeftl/repository.ftl
+2
-2
No files found.
src/main/java/org/rcisoft/common/controller/PaginationController.java
View file @
8de48b09
...
...
@@ -19,6 +19,10 @@ public class PaginationController<T> extends ResponseController {
protected
static
final
String
PAGINATIONKEY
=
"pagination"
;
protected
static
final
int
INIT_PAGE
=
1
;
protected
static
final
int
INIT_ROWS
=
10
;
public
PaginationController
()
{
}
...
...
@@ -32,10 +36,9 @@ public class PaginationController<T> extends ResponseController {
}
@ModelAttribute
private
void
setPagnationAttribute
(
HttpServletRequest
request
,
Integer
rows
,
Integer
page
,
String
sort
,
String
order
)
{
PageUtil
_paginationUtility
;
private
void
setPagnationAttribute
(
HttpServletRequest
request
,
Integer
rows
,
Integer
page
,
String
sort
)
{
PageUtil
_paginationUtility
=
new
PageUtil
()
;
if
(
rows
!=
null
&&
page
!=
null
&&
sort
!=
null
)
{
_paginationUtility
=
new
PageUtil
();
_paginationUtility
.
setPageNum
(
page
.
intValue
());
_paginationUtility
.
setPageSize
(
rows
.
intValue
());
_paginationUtility
.
setOrderBy
(
sort
);
...
...
@@ -43,15 +46,18 @@ public class PaginationController<T> extends ResponseController {
}
else
if
(
rows
!=
null
&&
page
!=
null
)
{
_paginationUtility
=
new
PageUtil
();
_paginationUtility
.
setPageNum
(
page
.
intValue
());
_paginationUtility
.
setPageSize
(
rows
.
intValue
());
request
.
setAttribute
(
PAGINATIONKEY
,
_paginationUtility
);
}
else
if
(
sort
!=
null
&&
order
!=
null
)
{
_paginationUtility
=
new
PageUtil
();
_paginationUtility
.
setOrderBy
(
sort
+
" "
+
order
);
request
.
setAttribute
(
PAGINATIONKEY
,
_paginationUtility
);
}
else
if
(
sort
!=
null
)
{
_paginationUtility
.
setOrderBy
(
sort
);
}
else
{
_paginationUtility
.
setPageNum
(
INIT_ROWS
);
_paginationUtility
.
setPageSize
(
INIT_PAGE
);
}
request
.
setAttribute
(
PAGINATIONKEY
,
_paginationUtility
);
}
...
...
src/main/resources/templates/codeftl/controller.ftl
View file @
8de48b09
...
...
@@ -29,7 +29,7 @@ import java.util.List;
*
Created
by
${
author
}
on
${.
now
}.
*/
@
RestController
@
RequestMapping
(
"${table.
mappingPath!
}"
)
@
RequestMapping
(
"${table.
entityName?lower_case
}"
)
public
class
${
table
.
entityName
}
Controller
extends
PaginationController
<${
table
.
entityName
}>
{
@
Autowired
...
...
src/main/resources/templates/codeftl/repository.ftl
View file @
8de48b09
...
...
@@ -20,8 +20,8 @@ public interface ${table.entityName}Repository extends BaseMapper<${table.entity
*
*/
@
Select
(
"<script>select * from ${table.tableName} where 1=1 "
+
"<if test=
\"
delFlag !=null and delFlag != ''
\"
>and del_flag = ${r'#{delFlag}'} </if>
'
"
+
"<if test=
\"
flag !=null and flag != ''
\"
>and flag = ${r'#{flag}'} </if>
'
"
+
"<if test=
\"
delFlag !=null and delFlag != ''
\"
>and del_flag = ${r'#{delFlag}'} </if> "
+
"<if test=
\"
flag !=null and flag != ''
\"
>and flag = ${r'#{flag}'} </if> "
+
"</script>"
)
@
ResultMap
(
value
=
"BaseResultMap"
)
List
<${
table
.
entityName
}>
query
${
table
.
entityName
}
s
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
...
...
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