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
MCMS
Commits
c7ab2ac3
Commit
c7ab2ac3
authored
Mar 13, 2019
by
他是超人他会飞
Committed by
铭飞
Mar 13, 2019
Browse files
!154 搜索修改
Merge pull request !154 from 他是超人他会飞/4.7.0
parents
0f4dcbda
6a09791e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/web/SearchAction.java
View file @
c7ab2ac3
...
...
@@ -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
);
...
...
src/main/java/net/mingsoft/cms/dao/IArticleDao.xml
View file @
c7ab2ac3
...
...
@@ -53,6 +53,8 @@
<result
column=
"category_title"
property=
"categoryTitle"
/>
<result
column=
"category_id"
property=
"categoryId"
/>
<result
column=
"COLUMN_CM_ID"
property=
"columnContentModelId"
/>
<result
column=
"category_categoryid"
property=
"categoryCategoryId"
/>
<!--关联表category的父类别ID category_categoryid字段 -->
<result
column=
"category_modelId"
property=
"categoryModelId"
/>
<!--关联表category的所属模块ID category_modelid字段 -->
<result
column=
"COLUMN_TYPE"
property=
"columnType"
/>
<result
column=
"category_parent_id"
property=
"categoryParentId"
/>
<!--关联表category的字典对应编号 -->
</resultMap>
...
...
@@ -318,7 +320,7 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select
id=
"queryIdsByCategoryIdForParser"
resultMap=
"resultMapBean"
>
select
ARTICLE_BASICID,cl.*,c.
category_parent_id
ARTICLE_BASICID,cl.*,c.
*
FROM cms_article a LEFT JOIN basic b ON a.ARTICLE_BASICID = b.BASIC_ID
LEFT JOIN basic_column cl ON b.BASIC_CATEGORYID = cl.COLUMN_CATEGORY_ID
JOIN category c ON c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
...
...
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