Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
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
西魏
cms_sys
Commits
6a09791e
Commit
6a09791e
authored
Mar 13, 2019
by
sunxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索修改
parent
4ed1a36a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
18 deletions
+28
-18
SearchAction.java
src/main/java/net/mingsoft/cms/action/web/SearchAction.java
+28
-18
No files found.
src/main/java/net/mingsoft/cms/action/web/SearchAction.java
View file @
6a09791e
...
...
@@ -62,6 +62,7 @@ import net.mingsoft.mdiy.biz.ISearchBiz;
import
net.mingsoft.mdiy.entity.ContentModelEntity
;
import
net.mingsoft.mdiy.entity.ContentModelFieldEntity
;
import
net.mingsoft.mdiy.entity.SearchEntity
;
import
net.mingsoft.mdiy.parser.TagParser
;
import
net.mingsoft.mdiy.util.ParserUtil
;
/**
...
...
@@ -178,7 +179,7 @@ public class SearchAction extends BaseAction {
}
map
.
put
(
ParserUtil
.
COLUMN
,
column
);
//设置栏目编号
map
.
put
(
ParserUtil
.
TYPE_ID
,
typeId
);
//
map.put(ParserUtil.TYPE_ID, typeId);
}
// 遍历取字段集合
...
...
@@ -225,42 +226,51 @@ public class SearchAction extends BaseAction {
int
count
=
articleBiz
.
getSearchCount
(
contentModel
,
whereMap
,
BasicUtil
.
getAppId
(),
null
);
//设置分页类
PageBean
page
=
new
PageBean
();
//读取模板的分页数量
int
size
=
BasicUtil
.
getInt
(
ParserUtil
.
SIZE
,
10
);
try
{
size
=
TagParser
.
getPageSize
(
ParserUtil
.
read
(
search
.
getSearchTemplets
(),
false
));
}
catch
(
TemplateNotFoundException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
MalformedTemplateNameException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
ParseException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
}
int
total
=
PageUtil
.
totalPage
(
count
,
size
);
//获取总数
int
pageNo
=
BasicUtil
.
getInt
(
ParserUtil
.
PAGE_NO
,
1
);
if
(
pageNo
>=
total
)
{
pageNo
=
total
;
}
//获取总数
page
.
setTotal
(
total
);
//设置页面显示数量
page
.
setSize
(
size
);
//设置列表当前页
int
pageNo
=
BasicUtil
.
getInt
(
ParserUtil
.
PAGE_NO
,
1
);
page
.
setPageNo
(
pageNo
);
int
next
,
pre
;
if
(
StringUtil
.
isBlank
(
pageNo
)
||
pageNo
==
1
){
//如果总页数等于1,下一页就是第一页,不等于就有第二页
next
=
1
==
total
?
total
:
2
;
pre
=
1
;
}
else
{
next
=
pageNo
==
total
?
total
:
pageNo
+
1
;
pre
=
pageNo
-
1
==
0
?
1
:
pageNo
-
1
;
}
String
str
=
ParserUtil
.
PAGE_NO
+
","
;
String
str
=
ParserUtil
.
PAGE_NO
+
","
+
ParserUtil
.
SIZE
;
//设置分页的统一链接
String
url
=
BasicUtil
.
getUrl
()
+
request
.
getServletPath
()
+
"?"
+
BasicUtil
.
assemblyRequestUrlParams
(
str
.
split
(
","
));
String
pageNoStr
=
"&"
+
ParserUtil
.
PAGE_NO
+
"="
;
String
url
=
request
.
getServletPath
()
+
"?"
+
BasicUtil
.
assemblyRequestUrlParams
(
str
.
split
(
","
));
String
pageNoStr
=
"&"
+
ParserUtil
.
SIZE
+
"="
+
size
+
"&"
+
ParserUtil
.
PAGE_NO
+
"="
;
//下一页
String
nextUrl
=
url
+
pageNoStr
+
next
;
String
nextUrl
=
url
+
pageNoStr
+
((
pageNo
+
1
>
total
)?
total:
++
pageNo
)
;
//首页
String
indexUrl
=
url
+
pageNoStr
+
1
;
//尾页
String
lastUrl
=
url
+
pageNoStr
+
total
;
//上一页
String
preUrl
=
url
+
pageNoStr
+
pre
;
String
preUrl
=
url
+
pageNoStr
+
(--
pageNo
)
;
page
.
setIndexUrl
(
indexUrl
);
page
.
setNextUrl
(
nextUrl
);
page
.
setPreUrl
(
preUrl
);
page
.
setLastUrl
(
lastUrl
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
Map
<
Object
,
Object
>
searchMap
=
new
HashMap
<>();
searchMap
.
put
(
BASIC_TITLE
,
BasicUtil
.
getString
(
BASIC_TITLE
));
searchMap
.
put
(
ParserUtil
.
PAGE_NO
,
pageNo
);
...
...
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