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
c0542503
Commit
c0542503
authored
Mar 13, 2019
by
sunxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页
parent
bd9c9506
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
51 deletions
+71
-51
SearchAction.java
src/main/java/net/mingsoft/cms/action/web/SearchAction.java
+4
-2
CmsParserUtil.java
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
+67
-49
No files found.
src/main/java/net/mingsoft/cms/action/web/SearchAction.java
View file @
c0542503
...
@@ -177,8 +177,8 @@ public class SearchAction extends BaseAction {
...
@@ -177,8 +177,8 @@ public class SearchAction extends BaseAction {
}
}
}
}
map
.
put
(
ParserUtil
.
COLUMN
,
column
);
map
.
put
(
ParserUtil
.
COLUMN
,
column
);
//
设置栏目编号
//
设置栏目编号
map
.
put
(
ParserUtil
.
TYPE_ID
,
typeId
);
//
map.put(ParserUtil.TYPE_ID, typeId);
}
}
// 遍历取字段集合
// 遍历取字段集合
...
@@ -260,10 +260,12 @@ public class SearchAction extends BaseAction {
...
@@ -260,10 +260,12 @@ public class SearchAction extends BaseAction {
page
.
setPreUrl
(
preUrl
);
page
.
setPreUrl
(
preUrl
);
page
.
setLastUrl
(
lastUrl
);
page
.
setLastUrl
(
lastUrl
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
Map
<
Object
,
Object
>
searchMap
=
new
HashMap
<>();
Map
<
Object
,
Object
>
searchMap
=
new
HashMap
<>();
searchMap
.
put
(
BASIC_TITLE
,
BasicUtil
.
getString
(
BASIC_TITLE
));
searchMap
.
put
(
BASIC_TITLE
,
BasicUtil
.
getString
(
BASIC_TITLE
));
searchMap
.
put
(
ParserUtil
.
PAGE_NO
,
pageNo
);
searchMap
.
put
(
ParserUtil
.
PAGE_NO
,
pageNo
);
map
.
put
(
SEARCH
,
searchMap
);
map
.
put
(
SEARCH
,
searchMap
);
map
.
put
(
ParserUtil
.
PAGE
,
page
);
//动态解析
//动态解析
map
.
put
(
ParserUtil
.
IS_DO
,
false
);
map
.
put
(
ParserUtil
.
IS_DO
,
false
);
//设置动态请求的模块路径
//设置动态请求的模块路径
...
...
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
c0542503
...
@@ -82,7 +82,6 @@ public class CmsParserUtil extends ParserUtil {
...
@@ -82,7 +82,6 @@ public class CmsParserUtil extends ParserUtil {
StringWriter
writer
=
new
StringWriter
();
StringWriter
writer
=
new
StringWriter
();
try
{
try
{
// 为了分页添加column,判断栏目是否为父栏目
// 为了分页添加column,判断栏目是否为父栏目
template
.
process
(
null
,
writer
);
template
.
process
(
null
,
writer
);
String
content
=
writer
.
toString
();
String
content
=
writer
.
toString
();
//获取列表页显示的文章数量
//获取列表页显示的文章数量
...
@@ -99,58 +98,77 @@ public class CmsParserUtil extends ParserUtil {
...
@@ -99,58 +98,77 @@ public class CmsParserUtil extends ParserUtil {
contentModel
=
(
ContentModelEntity
)
SpringUtil
.
getBean
(
IContentModelBiz
.
class
).
getEntity
(
columnContentModelId
);
contentModel
=
(
ContentModelEntity
)
SpringUtil
.
getBean
(
IContentModelBiz
.
class
).
getEntity
(
columnContentModelId
);
}
}
int
pageNo
=
1
;
int
pageNo
=
1
;
// 遍历分页
PageBean
page
=
new
PageBean
();
for
(
int
i
=
0
;
i
<
totalPageSize
;
i
++)
{
page
.
setSize
(
pageSize
);
PageBean
page
=
new
PageBean
();
//全局参数设置
Map
parserParams
=
new
HashMap
();
Map
parserParams
=
new
HashMap
();
parserParams
.
put
(
COLUMN
,
column
);
parserParams
.
put
(
COLUMN
,
column
);
page
.
setTotal
(
totalPageSize
);
page
.
setTotal
(
totalPageSize
);
//parserParams.put(TYPE_ID, column.getCategoryId());
parserParams
.
put
(
IS_DO
,
false
);
parserParams
.
put
(
IS_DO
,
false
);
parserParams
.
put
(
HTML
,
HTML
);
parserParams
.
put
(
HTML
,
HTML
);
if
(
contentModel
!=
null
)
{
if
(
contentModel
!=
null
)
{
// 将自定义模型编号设置为key值
// 将自定义模型编号设置为key值
parserParams
.
put
(
TABLE_NAME
,
contentModel
.
getCmTableName
());
parserParams
.
put
(
TABLE_NAME
,
contentModel
.
getCmTableName
());
}
}
//如果单站点,就废弃站点地址
//如果单站点,就废弃站点地址
if
(
ParserUtil
.
IS_SINGLE
)
{
if
(
ParserUtil
.
IS_SINGLE
)
{
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
}
}
if
(
i
==
0
)
{
//文章列表页没有写文章列表标签,总数为0
// 数据库中第一页是从开始0*size
if
(
totalPageSize
<=
0
)
{
// 首页路径index.html
// 数据库中第一页是从开始0*size
mobilePath
=
ParserUtil
// 首页路径index.html
.
buildMobileHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
mobilePath
=
ParserUtil
.
buildMobileHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
columnListPath
=
ParserUtil
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
.
buildHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
// 设置分页的起始位置
}
else
{
// 其他路径list-2.html
mobilePath
=
ParserUtil
.
buildMobileHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
PAGE_LIST
+
pageNo
);
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
PAGE_LIST
+
pageNo
);
}
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
page
.
setPageNo
(
pageNo
);
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
TagParser
tag
=
new
TagParser
(
content
,
parserParams
);
TagParser
tag
=
new
TagParser
(
content
,
parserParams
);
FileUtil
.
writeString
(
tag
.
rendering
(),
columnListPath
,
Const
.
UTF8
);
FileUtil
.
writeString
(
tag
.
rendering
(),
columnListPath
,
Const
.
UTF8
);
// 判断是手机端生成还是pc端,防止重复生成
if
(
ParserUtil
.
hasMobileFile
(
column
.
getColumnListUrl
()))
{
// 判断是手机端生成还是pc端,防止重复生成
writer
=
new
StringWriter
();
if
(
ParserUtil
.
hasMobileFile
(
column
.
getColumnListUrl
()))
{
mobileTemplate
.
process
(
null
,
writer
);
tag
=
new
TagParser
(
writer
.
toString
(),
parserParams
);
// 将tag.getContent()写入路径
FileUtil
.
writeString
(
tag
.
rendering
(),
mobilePath
,
Const
.
UTF8
);
}
writer
=
new
StringWriter
();
}
else
{
// 遍历分页
for
(
int
i
=
0
;
i
<
totalPageSize
;
i
++)
{
if
(
i
==
0
)
{
// 数据库中第一页是从开始0*size
// 首页路径index.html
mobilePath
=
ParserUtil
.
buildMobileHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
}
else
{
// 其他路径list-2.html
mobilePath
=
ParserUtil
.
buildMobileHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
PAGE_LIST
+
pageNo
);
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getColumnPath
()
+
File
.
separator
+
ParserUtil
.
PAGE_LIST
+
pageNo
);
}
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
TagParser
tag
=
new
TagParser
(
content
,
parserParams
);
FileUtil
.
writeString
(
tag
.
rendering
(),
columnListPath
,
Const
.
UTF8
);
// 判断是手机端生成还是pc端,防止重复生成
if
(
ParserUtil
.
hasMobileFile
(
column
.
getColumnListUrl
()))
{
writer
=
new
StringWriter
();
mobileTemplate
.
process
(
null
,
writer
);
tag
=
new
TagParser
(
writer
.
toString
(),
parserParams
);
// 将tag.getContent()写入路径
FileUtil
.
writeString
(
tag
.
rendering
(),
mobilePath
,
Const
.
UTF8
);
}
writer
=
new
StringWriter
();
writer
=
new
StringWriter
();
mobileTemplate
.
process
(
null
,
writer
);
pageNo
++;
tag
=
new
TagParser
(
writer
.
toString
(),
parserParams
);
}
// 将tag.getContent()写入路径
}
FileUtil
.
writeString
(
tag
.
rendering
(),
mobilePath
,
Const
.
UTF8
);
}
writer
=
new
StringWriter
();
pageNo
++;
}
}
catch
(
TemplateException
e
)
{
}
catch
(
TemplateException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
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