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
cd989763
Commit
cd989763
authored
Sep 01, 2020
by
luoxj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页
parent
daf498dc
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
197 additions
and
42 deletions
+197
-42
GeneraterAction.java
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
+72
-5
MCmsAction.java
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
+22
-13
ContentBean.java
src/main/java/net/mingsoft/cms/bean/ContentBean.java
+56
-0
IContentBiz.java
src/main/java/net/mingsoft/cms/biz/IContentBiz.java
+8
-3
ContentBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
+4
-6
IContentDao.java
src/main/java/net/mingsoft/cms/dao/IContentDao.java
+3
-5
IContentDao.xml
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
+17
-8
CmsParserUtil.java
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
+15
-2
No files found.
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
cd989763
...
...
@@ -28,10 +28,13 @@ import net.mingsoft.basic.biz.IModelBiz;
import
net.mingsoft.basic.entity.AppEntity
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.cms.util.CmsParserUtil
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.util.ParserUtil
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.slf4j.Logger
;
...
...
@@ -50,7 +53,9 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
*
...
...
@@ -173,7 +178,23 @@ public class GeneraterAction extends BaseAction {
LOG
.
error
(
"模板不存在:{}"
,
column
.
getCategoryUrl
());
continue
;
}
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
column
.
getId
(),
null
,
null
);
//获取模板中列表标签中的条件
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getAppId
());
PageBean
page
=
new
PageBean
();
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setContentCategoryId
(
column
.
getId
());
AttributeBean
attributeBean
=
new
AttributeBean
();
// 获取文章列表模板标签属性
ParserUtil
.
read
(
column
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 判断列表类型
switch
(
column
.
getCategoryType
())
{
//TODO 暂时先用字符串代替
...
...
@@ -209,16 +230,62 @@ public class GeneraterAction extends BaseAction {
@RequestMapping
(
"/{columnId}/generateArticle"
)
@RequiresPermissions
(
"cms:generate:article"
)
@ResponseBody
public
void
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
{
public
void
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
throws
IOException
{
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
// 查出所有文章(根据选择栏目)包括子栏目
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
columnId
,
dateTime
,
null
);
// 有符合条件的新闻就更新
List
<
CategoryEntity
>
categoryList
=
null
;
AttributeBean
attributeBean
=
new
AttributeBean
();
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setBeginTime
(
dateTime
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getAppId
());
PageBean
page
=
new
PageBean
();
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
if
(
Integer
.
parseInt
(
columnId
)
==
0
){
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryList
=
categoryBiz
.
query
(
categoryEntity
);
for
(
CategoryEntity
category
:
categoryList
){
contentBean
.
setContentCategoryId
(
category
.
getId
());
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
continue
;
}
// 获取文章列表表属性
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
else
{
CategoryEntity
category
=
(
CategoryEntity
)
categoryBiz
.
getEntity
(
Integer
.
parseInt
(
columnId
));
// 获取文章列表表属性
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
return
;
}
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
contentBean
.
setContentCategoryId
(
columnId
);
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
this
.
outJson
(
response
,
true
);
}
...
...
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
View file @
cd989763
...
...
@@ -30,11 +30,13 @@ import net.mingsoft.base.constant.Const;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.StringUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.util.CmsParserUtil
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.biz.IModelBiz
;
import
net.mingsoft.mdiy.biz.IPageBiz
;
...
...
@@ -141,9 +143,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
//获取栏目编号
int
typeId
=
BasicUtil
.
getInt
(
ParserUtil
.
TYPE_ID
,
0
);
int
size
=
BasicUtil
.
getInt
(
ParserUtil
.
SIZE
,
10
);
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setContentCategoryId
(
String
.
valueOf
(
typeId
));
//获取文章总数
List
<
CategoryBean
>
columnArticles
=
contentBiz
.
queryIdsByCategoryIdForParser
(
String
.
valueOf
(
typeId
),
null
,
null
);
List
<
CategoryBean
>
columnArticles
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
//判断栏目下是否有文章
if
(
columnArticles
.
size
()==
0
){
this
.
outJson
(
resp
,
false
);
...
...
@@ -204,8 +207,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
orderby
=
orderby
.
replaceAll
(
"('|\"|\\\\)"
,
"\\$1"
);
PageBean
page
=
new
PageBean
();
//用于详情上下页获取当前文章列表对应的分类,根据文章查询只能获取自身分类
String
typeId
=
BasicUtil
.
getString
(
ParserUtil
.
TYPE_ID
,
article
.
getContentCategoryId
());
//根据文章编号查询栏目详情模版
CategoryEntity
column
=
(
CategoryEntity
)
categoryBiz
.
getEntity
(
Integer
.
parseInt
(
article
.
getContentCategoryId
()
));
CategoryEntity
column
=
(
CategoryEntity
)
categoryBiz
.
getEntity
(
Integer
.
parseInt
(
typeId
));
//解析后的内容
String
content
=
""
;
Map
map
=
BasicUtil
.
assemblyRequestMap
();
...
...
@@ -215,12 +220,18 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
});
//动态解析
map
.
put
(
ParserUtil
.
IS_DO
,
true
);
//设置栏目编号
map
.
put
(
ParserUtil
.
TYPE_ID
,
typeId
);
//设置动态请求的模块路径
map
.
put
(
ParserUtil
.
MODEL_NAME
,
"mcms"
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
map
.
put
(
ParserUtil
.
ID
,
article
.
getId
());
List
<
CategoryBean
>
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
column
.
getCategoryId
(),
null
,
null
,
orderby
,
order
);
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setContentCategoryId
(
String
.
valueOf
(
typeId
));
contentBean
.
setOrderBy
(
orderby
);
contentBean
.
setOrder
(
order
);
List
<
CategoryBean
>
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
Map
<
Object
,
Object
>
contentModelMap
=
new
HashMap
<
Object
,
Object
>();
ModelEntity
contentModel
=
null
;
for
(
int
artId
=
0
;
artId
<
articleIdList
.
size
();)
{
...
...
@@ -230,13 +241,16 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
continue
;
}
// 文章的栏目路径
String
articleColumnPath
=
articleIdList
.
get
(
artId
).
getCategoryPath
();
String
categoryParentId
=
articleIdList
.
get
(
artId
).
getId
()
;
if
(
StringUtils
.
isNotBlank
(
articleIdList
.
get
(
artId
).
getCategoryParentId
())){
categoryParentId
+=
','
+
articleIdList
.
get
(
artId
).
getCategoryParentId
();
}
// 文章的栏目模型编号
String
columnContentModelId
=
articleIdList
.
get
(
artId
).
getMdiyModelId
();
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
parserParams
.
put
(
ParserUtil
.
COLUMN
,
articleIdList
.
get
(
artId
));
// 判断当前栏目是否有自定义模型
if
(
StringUtils
.
isNotBlank
(
columnContentModelId
))
{
if
(
StringUtils
.
isNotBlank
(
columnContentModelId
)
&&
Integer
.
parseInt
(
columnContentModelId
)>
0
)
{
// 通过当前栏目的模型编号获取,自定义模型表名
if
(
contentModelMap
.
containsKey
(
columnContentModelId
))
{
parserParams
.
put
(
ParserUtil
.
TABLE_NAME
,
contentModel
.
getModelTableName
());
...
...
@@ -251,19 +265,13 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
// 第一篇文章没有上一篇
if
(
artId
>
0
)
{
CategoryBean
preCaBean
=
articleIdList
.
get
(
artId
-
1
);
//判断当前文档是否与上一页文章在同一栏目下,并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if
(
articleColumnPath
.
contains
(
preCaBean
.
getCategoryId
()+
""
)){
page
.
setPreId
(
preCaBean
.
getArticleId
());
}
}
// 最后一篇文章没有下一篇
if
(
artId
+
1
<
articleIdList
.
size
())
{
CategoryBean
nextCaBean
=
articleIdList
.
get
(
artId
+
1
);
//判断当前文档是否与下一页文章在同一栏目下并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if
(
articleColumnPath
.
contains
(
nextCaBean
.
getCategoryId
()+
""
)){
page
.
setNextId
(
nextCaBean
.
getArticleId
());
}
}
break
;
}
try
{
...
...
@@ -387,7 +395,8 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
//设置动态请求的模块路径
map
.
put
(
ParserUtil
.
MODEL_NAME
,
"mcms"
);
searchMap
.
put
(
ParserUtil
.
PAGE_NO
,
0
);
ParserUtil
.
read
(
SEARCH
+
ParserUtil
.
HTM_SUFFIX
,
map
,
page
);
AttributeBean
attributeBean
=
new
AttributeBean
();
ParserUtil
.
read
(
SEARCH
+
ParserUtil
.
HTM_SUFFIX
,
map
,
page
,
attributeBean
);
int
total
=
PageUtil
.
totalPage
(
count
,
page
.
getSize
());
int
pageNo
=
BasicUtil
.
getInt
(
ParserUtil
.
PAGE_NO
,
1
);
if
(
pageNo
>=
total
&&
total
!=
0
)
{
...
...
src/main/java/net/mingsoft/cms/bean/ContentBean.java
View file @
cd989763
package
net
.
mingsoft
.
cms
.
bean
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 文章实体bean
...
...
@@ -12,6 +17,25 @@ public class ContentBean extends ContentEntity {
*/
private
String
staticUrl
;
/**
* 开始时间
*/
private
String
beginTime
;
/**
* 结束时间
*/
private
String
endTime
;
/**
* 属性标记
*/
private
String
flag
;
/**
* 不包含属性标记
*/
private
String
noflag
;
public
String
getStaticUrl
()
{
return
staticUrl
;
...
...
@@ -20,4 +44,36 @@ public class ContentBean extends ContentEntity {
public
void
setStaticUrl
(
String
staticUrl
)
{
this
.
staticUrl
=
staticUrl
;
}
public
String
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
String
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
String
getNoflag
()
{
return
noflag
;
}
public
void
setNoflag
(
String
noflag
)
{
this
.
noflag
=
noflag
;
}
}
src/main/java/net/mingsoft/cms/biz/IContentBiz.java
View file @
cd989763
...
...
@@ -2,6 +2,7 @@ package net.mingsoft.cms.biz;
import
net.mingsoft.base.biz.IBaseBiz
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.mdiy.entity.ModelEntity
;
import
java.util.List
;
...
...
@@ -16,9 +17,12 @@ import java.util.Map;
*/
public
interface
IContentBiz
extends
IBaseBiz
{
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
String
categoryId
,
String
beginTime
,
String
endTime
);
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
String
categoryId
,
String
beginTime
,
String
endTime
,
String
orderBy
,
String
order
);
/**
* 根据文章属性查询
* @param contentBean
* @return
*/
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
contentBean
);
int
getSearchCount
(
ModelEntity
contentModel
,
List
diyList
,
Map
whereMap
,
int
appId
,
String
categoryIds
);
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
View file @
cd989763
...
...
@@ -23,6 +23,7 @@ package net.mingsoft.cms.biz.impl;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.mdiy.entity.ModelEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -54,12 +55,9 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
}
@Override
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
String
categoryId
,
String
beginTime
,
String
endTime
)
{
return
this
.
contentDao
.
queryIdsByCategoryIdForParser
(
categoryId
,
BasicUtil
.
getAppId
(),
beginTime
,
endTime
,
null
,
null
);
}
@Override
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
String
categoryId
,
String
beginTime
,
String
endTime
,
String
orderBy
,
String
order
)
{
return
this
.
contentDao
.
queryIdsByCategoryIdForParser
(
categoryId
,
BasicUtil
.
getAppId
(),
beginTime
,
endTime
,
orderBy
,
order
);
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
contentBean
)
{
contentBean
.
setAppId
(
BasicUtil
.
getAppId
());
return
this
.
contentDao
.
queryIdsByCategoryIdForParser
(
contentBean
);
}
@Override
...
...
src/main/java/net/mingsoft/cms/dao/IContentDao.java
View file @
cd989763
...
...
@@ -4,6 +4,7 @@ import net.mingsoft.base.dao.IBaseDao;
import
java.util.*
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
org.apache.ibatis.annotations.Param
;
/**
...
...
@@ -16,13 +17,10 @@ public interface IContentDao extends IBaseDao {
/**
* 查询文章编号集合
* @param categoryId 栏目编号
* @param appId 站点编号
* @param beginTime 开始时间
* @param endTime 结束时间
* @contentBean
* @return
*/
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"appId"
)
int
appId
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"orderBy"
)
String
orderBy
,
@Param
(
"order"
)
String
order
);
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
contentBean
);
/**
* 根据查询文章实体总数
...
...
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
View file @
cd989763
...
...
@@ -239,17 +239,17 @@
</select>
<sql
id=
"queryWhereCategoryId"
databaseId=
"mysql"
>
find_in_set('${categoryId}',CATEGORY_PARENT_ID)
find_in_set('${c
ontentC
ategoryId}',CATEGORY_PARENT_ID)
</sql>
<sql
id=
"queryWhereCategoryId"
databaseId=
"oracle"
>
instr(','||'${categoryId}'||',', ','||CATEGORY_PARENT_ID||',')>0
instr(','||'${c
ontentC
ategoryId}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql
id=
"queryWhereCategoryId"
databaseId=
"sqlServer"
>
CHARINDEX(','+'${categoryId}'+',' , ','+CATEGORY_PARENT_ID +',')>0
CHARINDEX(','+'${c
ontentC
ategoryId}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select
id=
"queryIdsByCategoryIdForParser"
resultMap=
"resultBean"
>
<select
id=
"queryIdsByCategoryIdForParser"
resultMap=
"resultBean"
>
select
cms_content.id article_id,c.*
FROM cms_content
...
...
@@ -259,8 +259,8 @@
cms_content.app_id = #{appId}
</if>
<!-- 查询子栏目数据 -->
<if
test=
"categoryId > 0"
>
and (content_category_id=#{categoryId} or content_category_id in
<if
test=
"c
ontentC
ategoryId > 0"
>
and (content_category_id=#{c
ontentC
ategoryId} or content_category_id in
(select id FROM cms_category where
<include
refid=
"queryWhereCategoryId"
></include>
))
</if>
<if
test=
"beginTime!=null and beginTime!=''"
>
...
...
@@ -269,8 +269,17 @@
<if
test=
"endTime!=null and endTime!=''"
>
and content_datetime
>
= #{endTime}
</if>
<if
test=
"orderBy!=null and order!=null and orderBy!='' and order!=''"
>
ORDER BY `${orderBy}` ${order}
<if
test=
"flag!=null and flag!=''"
>
and cms_content.content_type in ( #{flag})
</if>
<if
test=
"noflag!=null and noflag!=''"
>
and (cms_content.content_type not in ( #{noflag} ) or cms_content.content_type is null)
</if>
<if
test=
"orderBy!=null and orderBy!='' "
>
ORDER BY ${orderBy}
<if
test=
"order!=null and order!=''"
>
${order}
</if>
</if>
</select>
...
...
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
cd989763
...
...
@@ -11,6 +11,7 @@ import net.mingsoft.basic.util.BasicUtil;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.biz.IModelBiz
;
import
net.mingsoft.mdiy.biz.impl.ModelBizImpl
;
...
...
@@ -101,7 +102,8 @@ public class CmsParserUtil extends ParserUtil {
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
}
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
ParserUtil
.
read
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
,
page
);
AttributeBean
attributeBean
=
new
AttributeBean
();
ParserUtil
.
read
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
,
page
,
attributeBean
);
int
totalPageSize
=
PageUtil
.
totalPage
(
articleIdTotal
,
page
.
getSize
());
page
.
setTotal
(
totalPageSize
);
//文章列表页没有写文章列表标签,总数为0
...
...
@@ -156,7 +158,7 @@ public class CmsParserUtil extends ParserUtil {
// 记录已经生成了文章编号
List
<
Integer
>
generateIds
=
new
ArrayList
<>();
ExecutorService
pool
=
SpringUtil
.
getBean
(
ExecutorService
.
class
);
// 生成文
档
// 生成文
章
for
(
int
artId
=
0
;
artId
<
articleIdList
.
size
();)
{
String
writePath
=
null
;
//设置分页类
...
...
@@ -165,6 +167,11 @@ public class CmsParserUtil extends ParserUtil {
int
articleId
=
articleIdList
.
get
(
artId
).
getArticleId
();
// 文章的栏目路径
String
articleColumnPath
=
articleIdList
.
get
(
artId
).
getCategoryPath
();
// 该文章相关分类
String
categoryParentId
=
articleIdList
.
get
(
artId
).
getId
()
;
if
(
StringUtils
.
isNotBlank
(
articleIdList
.
get
(
artId
).
getCategoryParentId
())){
categoryParentId
+=
','
+
articleIdList
.
get
(
artId
).
getCategoryParentId
();
}
// 文章的模板路径
String
columnUrl
=
articleIdList
.
get
(
artId
).
getCategoryUrl
();
// 文章的栏目模型编号
...
...
@@ -213,12 +220,18 @@ public class CmsParserUtil extends ParserUtil {
// 第一篇文章没有上一篇
if
(
artId
>
0
)
{
CategoryBean
preCaBean
=
articleIdList
.
get
(
artId
-
1
);
//判断当前文档是否与上一页文章在同一栏目下,并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
// if( categoryParentId.contains(preCaBean.getCategoryId()+"")){
page
.
setPreId
(
preCaBean
.
getArticleId
());
// }
}
// 最后一篇文章没有下一篇
if
(
artId
+
1
<
articleIdList
.
size
())
{
CategoryBean
nextCaBean
=
articleIdList
.
get
(
artId
+
1
);
//判断当前文档是否与下一页文章在同一栏目下并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
// if(categoryParentId.contains(nextCaBean.getCategoryId()+"")){
page
.
setNextId
(
nextCaBean
.
getArticleId
());
// }
}
parserParams
.
put
(
IS_DO
,
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