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
0542acde
"jetbrains:/idea/checkout/git" did not exist on "3095f3730e76e52b371e235202cf322e792802bd"
Commit
0542acde
authored
Dec 12, 2020
by
guwd
Browse files
5.2.0
parent
d91c0e4a
Changes
32
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml
deleted
100755 → 0
View file @
d91c0e4a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"net.mingsoft.cms.dao.ICategoryDao"
>
<resultMap
id=
"resultMap"
type=
"net.mingsoft.cms.entity.CategoryEntity"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<result
column=
"category_title"
property=
"categoryTitle"
/>
<!--栏目管理名称 -->
<result
column=
"category_pinyin"
property=
"categoryPinyin"
/>
<!--栏目管理名称 -->
<result
column=
"category_id"
property=
"categoryId"
/>
<!--所属栏目 -->
<result
column=
"category_type"
property=
"categoryType"
/>
<!--栏目管理属性 -->
<result
column=
"category_sort"
property=
"categorySort"
/>
<!--自定义顺序 -->
<result
column=
"category_list_url"
property=
"categoryListUrl"
/>
<!--列表模板 -->
<result
column=
"category_url"
property=
"categoryUrl"
/>
<!--内容模板 -->
<result
column=
"category_keyword"
property=
"categoryKeyword"
/>
<!--栏目管理关键字 -->
<result
column=
"category_descrip"
property=
"categoryDescrip"
/>
<!--栏目管理描述 -->
<result
column=
"category_img"
property=
"categoryImg"
/>
<!--缩略图 -->
<result
column=
"category_diy_url"
property=
"categoryDiyUrl"
/>
<!--自定义链接 -->
<result
column=
"mdiy_model_id"
property=
"mdiyModelId"
/>
<!--栏目管理的内容模型id -->
<result
column=
"category_datetime"
property=
"categoryDatetime"
/>
<!--类别发布时间 -->
<result
column=
"dict_id"
property=
"dictId"
/>
<!--字典对应编号 -->
<result
column=
"category_flag"
property=
"categoryFlag"
/>
<!--栏目属性 -->
<result
column=
"category_path"
property=
"categoryPath"
/>
<!--栏目路径 -->
<result
column=
"category_parent_ids"
property=
"categoryParentIds"
/>
<!--父类型编号 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
<result
column=
"update_by"
property=
"updateBy"
/>
<!--修改人 -->
<result
column=
"update_date"
property=
"updateDate"
/>
<!--修改时间 -->
<result
column=
"del"
property=
"del"
/>
<!--删除标记 -->
</resultMap>
<!--保存-->
<insert
id=
"saveEntity"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"net.mingsoft.cms.entity.CategoryEntity"
>
insert into cms_category
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"categoryTitle != null and categoryTitle != ''"
>
category_title,
</if>
<if
test=
"categoryPinyin != null and categoryPinyin != ''"
>
category_pinyin,
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
category_id,
</if>
<if
test=
"categoryType != null and categoryType != ''"
>
category_type,
</if>
<if
test=
"categorySort != null"
>
category_sort,
</if>
<if
test=
"categoryListUrl != null and categoryListUrl != ''"
>
category_list_url,
</if>
<if
test=
"categoryUrl != null and categoryUrl != ''"
>
category_url,
</if>
<if
test=
"categoryKeyword != null and categoryKeyword != ''"
>
category_keyword,
</if>
<if
test=
"categoryDescrip != null and categoryDescrip != ''"
>
category_descrip,
</if>
<if
test=
"categoryImg != null and categoryImg != ''"
>
category_img,
</if>
<if
test=
"categoryDiyUrl != null and categoryDiyUrl != ''"
>
category_diy_url,
</if>
<if
test=
"mdiyModelId != null and mdiyModelId != ''"
>
mdiy_model_id,
</if>
<if
test=
"categoryDatetime != null"
>
category_datetime,
</if>
<if
test=
"dictId != null"
>
dict_id,
</if>
<if
test=
"categoryFlag != null"
>
category_flag,
</if>
<if
test=
"categoryPath != null and categoryPath != ''"
>
category_path,
</if>
<if
test=
"categoryParentIds != null and categoryParentIds != ''"
>
category_parent_ids,
</if>
<if
test=
"createBy > 0"
>
create_by,
</if>
<if
test=
"createDate != null"
>
create_date,
</if>
<if
test=
"updateBy > 0"
>
update_by,
</if>
<if
test=
"updateDate != null"
>
update_date,
</if>
<if
test=
"del != null"
>
del,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"categoryTitle != null and categoryTitle != ''"
>
#{categoryTitle},
</if>
<if
test=
"categoryPinyin != null and categoryPinyin != ''"
>
#{categoryPinyin},
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
#{categoryId},
</if>
<if
test=
"categoryType != null and categoryType != ''"
>
#{categoryType},
</if>
<if
test=
"categorySort != null"
>
#{categorySort},
</if>
<if
test=
"categoryListUrl != null and categoryListUrl != ''"
>
#{categoryListUrl},
</if>
<if
test=
"categoryUrl != null and categoryUrl != ''"
>
#{categoryUrl},
</if>
<if
test=
"categoryKeyword != null and categoryKeyword != ''"
>
#{categoryKeyword},
</if>
<if
test=
"categoryDescrip != null and categoryDescrip != ''"
>
#{categoryDescrip},
</if>
<if
test=
"categoryImg != null and categoryImg != ''"
>
#{categoryImg},
</if>
<if
test=
"categoryDiyUrl != null and categoryDiyUrl != ''"
>
#{categoryDiyUrl},
</if>
<if
test=
"mdiyModelId != null and mdiyModelId != ''"
>
#{mdiyModelId},
</if>
<if
test=
"categoryDatetime != null"
>
#{categoryDatetime},
</if>
<if
test=
"dictId != null"
>
#{dictId},
</if>
<if
test=
"categoryFlag != null "
>
#{categoryFlag},
</if>
<if
test=
"categoryPath != null and categoryPath != ''"
>
#{categoryPath},
</if>
<if
test=
"categoryParentId != null and categoryParentId != ''"
>
#{categoryParentId},
</if>
<if
test=
"createBy > 0"
>
#{createBy},
</if>
<if
test=
"createDate != null"
>
#{createDate},
</if>
<if
test=
"updateBy > 0"
>
#{updateBy},
</if>
<if
test=
"updateDate != null"
>
#{updateDate},
</if>
<if
test=
"del != null"
>
#{del},
</if>
</trim>
</insert>
<!--更新-->
<update
id=
"updateEntity"
parameterType=
"net.mingsoft.cms.entity.CategoryEntity"
>
update cms_category
<set>
<if
test=
"categoryTitle != null and categoryTitle != ''"
>
category_title=#{categoryTitle},
</if>
<if
test=
"categoryPinyin != null and categoryPinyin != ''"
>
category_pinyin=#{categoryPinyin},
</if>
category_id=#{categoryId},
category_parent_ids=#{categoryParentIds},
<if
test=
"categoryType != null and categoryType != ''"
>
category_type=#{categoryType},
</if>
<if
test=
"categorySort != null"
>
category_sort=#{categorySort},
</if>
<if
test=
"categoryListUrl != null and categoryListUrl != ''"
>
category_list_url=#{categoryListUrl},
</if>
<if
test=
"categoryUrl != null and categoryUrl != ''"
>
category_url=#{categoryUrl},
</if>
<if
test=
"categoryKeyword != null "
>
category_keyword=#{categoryKeyword},
</if>
<if
test=
"categoryDescrip != null "
>
category_descrip=#{categoryDescrip},
</if>
<if
test=
"categoryImg != null and categoryImg != ''"
>
category_img=#{categoryImg},
</if>
<if
test=
"categoryDiyUrl != null"
>
category_diy_url=#{categoryDiyUrl},
</if>
<if
test=
"mdiyModelId != null and mdiyModelId != ''"
>
mdiy_model_id=#{mdiyModelId},
</if>
<if
test=
"categoryDatetime != null"
>
category_datetime=#{categoryDatetime},
</if>
<if
test=
"dictId != null"
>
dict_id=#{dictId},
</if>
<if
test=
"categoryFlag != null "
>
category_flag=#{categoryFlag},
</if>
<if
test=
"categoryPath != null and categoryPath != ''"
>
category_path=#{categoryPath},
</if>
<if
test=
"createBy > 0"
>
create_by=#{createBy},
</if>
<if
test=
"createDate != null"
>
create_date=#{createDate},
</if>
<if
test=
"updateBy > 0"
>
update_by=#{updateBy},
</if>
<if
test=
"updateDate != null"
>
update_date=#{updateDate},
</if>
<if
test=
"del != null"
>
del=#{del},
</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select
id=
"getEntity"
resultMap=
"resultMap"
parameterType=
"int"
>
select * from cms_category where id=#{id}
</select>
<!--根据实体获取-->
<select
id=
"getByEntity"
resultMap=
"resultMap"
parameterType=
"net.mingsoft.cms.entity.CategoryEntity"
>
select * from cms_category
<where>
<if
test=
"categoryTitle != null and categoryTitle != ''"
>
and category_title=#{categoryTitle}
</if>
<if
test=
"categoryPinyin != null and categoryPinyin != ''"
>
and category_pinyin=#{categoryPinyin}
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
and category_id=#{categoryId}
</if>
<if
test=
"categoryType != null and categoryType != ''"
>
and category_type=#{categoryType}
</if>
<if
test=
"categorySort != null"
>
and category_sort=#{categorySort}
</if>
<if
test=
"categoryListUrl != null and categoryListUrl != ''"
>
and category_list_url=#{categoryListUrl}
</if>
<if
test=
"categoryUrl != null and categoryUrl != ''"
>
and category_url=#{categoryUrl}
</if>
<if
test=
"categoryKeyword != null and categoryKeyword != ''"
>
and category_keyword=#{categoryKeyword}
</if>
<if
test=
"categoryDescrip != null and categoryDescrip != ''"
>
and category_descrip=#{categoryDescrip}
</if>
<if
test=
"categoryImg != null and categoryImg != ''"
>
and category_img=#{categoryImg}
</if>
<if
test=
"categoryDiyUrl != null and categoryDiyUrl != ''"
>
and category_diy_url=#{categoryDiyUrl}
</if>
<if
test=
"mdiyModelId != null and mdiyModelId != ''"
>
and mdiy_model_id=#{mdiyModelId}
</if>
<if
test=
"categoryDatetime != null"
>
and category_datetime=#{categoryDatetime}
</if>
<if
test=
"dictId != null"
>
and dict_id=#{dictId}
</if>
<if
test=
"categoryFlag != null and categoryFlag != ''"
>
and category_flag=#{categoryFlag}
</if>
<if
test=
"categoryPath != null and categoryPath != ''"
>
and category_path=#{categoryPath}
</if>
<if
test=
"categoryParentIds != null and categoryParentIds != ''"
>
and category_parent_ids=#{categoryParentIds}
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and del=#{del}
</if>
</where>
limit 0,1
</select>
<!-- 模糊查询开始 -->
<select
id=
"queryChildren"
resultMap=
"resultMap"
>
select * from cms_category
<where>
<if
test=
"dictId > 0"
>
and dict_id=#{dictId}
</if>
and
(
<if
test=
"categoryParentIds != null and categoryParentIds!=''"
>
find_in_set(#{categoryParentIds},CATEGORY_PARENT_IDS)
</if>
<if
test=
"categoryParentIds == null or categoryParentIds ==''"
>
find_in_set('${id}',CATEGORY_PARENT_IDS)
</if>
<if
test=
"id != null"
>
or id=#{id}
</if>
)
and del=0
</where>
</select>
<!--删除-->
<delete
id=
"deleteEntity"
parameterType=
"int"
>
delete from cms_category where id=#{id}
</delete>
<!--批量删除-->
<delete
id=
"delete"
>
delete from cms_category
<where>
id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</delete>
<!--查询全部-->
<select
id=
"queryAll"
resultMap=
"resultMap"
>
select * from cms_category order by id desc
</select>
<!--条件查询-->
<select
id=
"query"
resultMap=
"resultMap"
>
select * from cms_category
<where>
<if
test=
"categoryTitle != null and categoryTitle != ''"
>
and category_title=#{categoryTitle}
</if>
<if
test=
"categoryPinyin != null and categoryPinyin != ''"
>
and category_pinyin=#{categoryPinyin}
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
and category_id=#{categoryId}
</if>
<if
test=
"categoryType != null and categoryType != ''"
>
and category_type=#{categoryType}
</if>
<if
test=
"categorySort != null"
>
and category_sort=#{categorySort}
</if>
<if
test=
"categoryListUrl != null and categoryListUrl != ''"
>
and category_list_url=#{categoryListUrl}
</if>
<if
test=
"categoryUrl != null and categoryUrl != ''"
>
and category_url=#{categoryUrl}
</if>
<if
test=
"categoryKeyword != null and categoryKeyword != ''"
>
and category_keyword=#{categoryKeyword}
</if>
<if
test=
"categoryDescrip != null and categoryDescrip != ''"
>
and category_descrip=#{categoryDescrip}
</if>
<if
test=
"categoryImg != null and categoryImg != ''"
>
and category_img=#{categoryImg}
</if>
<if
test=
"categoryDiyUrl != null and categoryDiyUrl != ''"
>
and category_diy_url=#{categoryDiyUrl}
</if>
<if
test=
"mdiyModelId != null and mdiyModelId != ''"
>
and mdiy_model_id=#{mdiyModelId}
</if>
<if
test=
"categoryDatetime != null"
>
and category_datetime=#{categoryDatetime}
</if>
<if
test=
"dictId != null"
>
and dict_id=#{dictId}
</if>
<if
test=
"categoryFlag != null and categoryFlag != ''"
>
and category_flag=#{categoryFlag}
</if>
<if
test=
"categoryPath != null and categoryPath != ''"
>
and category_path=#{categoryPath}
</if>
<if
test=
"categoryParentIds != null and categoryParentIds != ''"
>
and find_in_set(#{categoryParentIds},category_parent_ids)
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and del=#{del}
</if>
<include
refid=
"net.mingsoft.base.dao.IBaseDao.sqlWhere"
></include>
</where>
</select>
</mapper>
src/main/java/net/mingsoft/cms/dao/ICmsHistoryLogDao.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.dao
;
import
net.mingsoft.base.dao.IBaseDao
;
/**
* 文章浏览记录持久层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
interface
ICmsHistoryLogDao
extends
IBaseDao
{
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/ICmsHistoryLogDao.xml
deleted
100755 → 0
View file @
d91c0e4a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"net.mingsoft.cms.dao.ICmsHistoryLogDao"
>
<resultMap
id=
"resultMap"
type=
"net.mingsoft.cms.entity.HistoryLogEntity"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<result
column=
"content_id"
property=
"contentId"
/>
<!--文章编号 -->
<result
column=
"hl_ip"
property=
"hlIp"
/>
<!--浏览ip -->
<result
column=
"people_id"
property=
"peopleId"
/>
<!--用户id -->
<result
column=
"hl_is_mobile"
property=
"hlIsMobile"
/>
<!--是否为移动端 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
<result
column=
"update_by"
property=
"updateBy"
/>
<!--修改人 -->
<result
column=
"update_date"
property=
"updateDate"
/>
<!--修改时间 -->
<result
column=
"del"
property=
"del"
/>
<!--删除标记 -->
</resultMap>
<!--保存-->
<insert
id=
"saveEntity"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"net.mingsoft.cms.entity.HistoryLogEntity"
>
insert into cms_history_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"contentId != null and contentId != ''"
>
content_id,
</if>
<if
test=
"hlIp != null and hlIp != ''"
>
hl_ip,
</if>
<if
test=
"peopleId != null and peopleId != ''"
>
people_id,
</if>
<if
test=
"hlIsMobile != null"
>
hl_is_mobile,
</if>
<if
test=
"createBy > 0"
>
create_by,
</if>
<if
test=
"createDate != null"
>
create_date,
</if>
<if
test=
"updateBy > 0"
>
update_by,
</if>
<if
test=
"updateDate != null"
>
update_date,
</if>
<if
test=
"del != null"
>
del,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"contentId != null and contentId != ''"
>
#{contentId},
</if>
<if
test=
"hlIp != null and hlIp != ''"
>
#{hlIp},
</if>
<if
test=
"peopleId != null and peopleId != ''"
>
#{peopleId},
</if>
<if
test=
"hlIsMobile != null"
>
#{hlIsMobile},
</if>
<if
test=
"createBy > 0"
>
#{createBy},
</if>
<if
test=
"createDate != null"
>
#{createDate},
</if>
<if
test=
"updateBy > 0"
>
#{updateBy},
</if>
<if
test=
"updateDate != null"
>
#{updateDate},
</if>
<if
test=
"del != null"
>
#{del},
</if>
</trim>
</insert>
<!--更新-->
<update
id=
"updateEntity"
parameterType=
"net.mingsoft.cms.entity.HistoryLogEntity"
>
update cms_history_log
<set>
<if
test=
"contentId != null and contentId != ''"
>
content_id=#{contentId},
</if>
<if
test=
"hlIp != null and hlIp != ''"
>
hl_ip=#{hlIp},
</if>
<if
test=
"peopleId != null and peopleId != ''"
>
people_id=#{peopleId},
</if>
<if
test=
"hlIsMobile != null"
>
hl_is_mobile=#{hlIsMobile},
</if>
<if
test=
"createBy > 0"
>
create_by=#{createBy},
</if>
<if
test=
"createDate != null"
>
create_date=#{createDate},
</if>
<if
test=
"updateBy > 0"
>
update_by=#{updateBy},
</if>
<if
test=
"updateDate != null"
>
update_date=#{updateDate},
</if>
<if
test=
"del != null"
>
del=#{del},
</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select
id=
"getEntity"
resultMap=
"resultMap"
parameterType=
"int"
>
select * from cms_history_log where id=#{id}
</select>
<!--根据实体获取-->
<select
id=
"getByEntity"
resultMap=
"resultMap"
parameterType=
"net.mingsoft.cms.entity.HistoryLogEntity"
>
select * from cms_history_log
<where>
<if
test=
"contentId != null and contentId != ''"
>
and content_id=#{contentId}
</if>
<if
test=
"hlIp != null and hlIp != ''"
>
and hl_ip=#{hlIp}
</if>
<if
test=
"peopleId != null and peopleId != ''"
>
and people_id=#{peopleId}
</if>
<if
test=
"hlIsMobile != null"
>
and hl_is_mobile=#{hlIsMobile}
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and del=#{del}
</if>
</where>
limit 0,1
</select>
<!--删除-->
<delete
id=
"deleteEntity"
parameterType=
"int"
>
delete from cms_history_log where id=#{id}
</delete>
<!--批量删除-->
<delete
id=
"delete"
>
delete from cms_history_log
<where>
id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</delete>
<!--查询全部-->
<select
id=
"queryAll"
resultMap=
"resultMap"
>
select * from cms_history_log order by id desc
</select>
<!--条件查询-->
<select
id=
"query"
resultMap=
"resultMap"
>
select * from cms_history_log
<where>
<if
test=
"contentId != null and contentId != ''"
>
and content_id=#{contentId}
</if>
<if
test=
"hlIp != null and hlIp != ''"
>
and hl_ip=#{hlIp}
</if>
<if
test=
"peopleId != null and peopleId != ''"
>
and people_id=#{peopleId}
</if>
<if
test=
"hlIsMobile != null"
>
and hl_is_mobile=#{hlIsMobile}
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and del=#{del}
</if>
<include
refid=
"net.mingsoft.base.dao.IBaseDao.sqlWhere"
></include>
</where>
order by id desc
</select>
</mapper>
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/IContentDao.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.dao
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 文章持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public
interface
IContentDao
extends
IBaseDao
<
ContentEntity
>
{
/**
* 查询文章编号集合
* @contentBean
* @return
*/
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
contentBean
);
/**
* 根据查询文章实体总数
*
* @param tableName
* :自定义生成的表名
* @param map
* key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段 list[1]:是否为整形
* list[2]:是否是等值查询 list[3]:字段的值
* @return 文章实体总数
*/
int
getSearchCount
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"diyList"
)
List
diyList
,
@Param
(
"map"
)
Map
<
String
,
Object
>
map
,
@Param
(
"websiteId"
)
int
websiteId
,
@Param
(
"ids"
)
String
ids
);
/**
* 分类编号删除文章
* @param ids
*/
void
deleteEntityByCategoryIds
(
@Param
(
"ids"
)
String
[]
ids
);
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
deleted
100755 → 0
View file @
d91c0e4a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"net.mingsoft.cms.dao.IContentDao"
>
<resultMap
id=
"resultMap"
type=
"net.mingsoft.cms.entity.ContentEntity"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<result
column=
"content_title"
property=
"contentTitle"
/>
<!--文章标题 -->
<result
column=
"category_id"
property=
"categoryId"
/>
<!--所属栏目 -->
<result
column=
"content_type"
property=
"contentType"
/>
<!--文章类型 -->
<result
column=
"content_display"
property=
"contentDisplay"
/>
<!--是否显示 -->
<result
column=
"content_author"
property=
"contentAuthor"
/>
<!--文章作者 -->
<result
column=
"content_source"
property=
"contentSource"
/>
<!--文章来源 -->
<result
column=
"content_datetime"
property=
"contentDatetime"
/>
<!--发布时间 -->
<result
column=
"content_sort"
property=
"contentSort"
/>
<!--自定义顺序 -->
<result
column=
"content_img"
property=
"contentImg"
/>
<!--文章缩略图 -->
<result
column=
"content_description"
property=
"contentDescription"
/>
<!--描述 -->
<result
column=
"content_keyword"
property=
"contentKeyword"
/>
<!--关键字 -->
<result
column=
"content_details"
property=
"contentDetails"
/>
<!--文章内容 -->
<result
column=
"content_url"
property=
"contentUrl"
/>
<!--文章跳转链接地址 -->
<result
column=
"content_hit"
property=
"contentHit"
/>
<!--点击次数 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
<result
column=
"update_by"
property=
"updateBy"
/>
<!--修改人 -->
<result
column=
"update_date"
property=
"updateDate"
/>
<!--修改时间 -->
<result
column=
"del"
property=
"del"
/>
<!--删除标记 -->
</resultMap>
<resultMap
id=
"resultContentMap"
type=
"net.mingsoft.cms.bean.ContentBean"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<result
column=
"content_title"
property=
"contentTitle"
/>
<!--文章标题 -->
<result
column=
"category_id"
property=
"categoryId"
/>
<!--所属栏目 -->
<result
column=
"content_type"
property=
"contentType"
/>
<!--文章类型 -->
<result
column=
"content_display"
property=
"contentDisplay"
/>
<!--是否显示 -->
<result
column=
"content_author"
property=
"contentAuthor"
/>
<!--文章作者 -->
<result
column=
"content_source"
property=
"contentSource"
/>
<!--文章来源 -->
<result
column=
"content_datetime"
property=
"contentDatetime"
/>
<!--发布时间 -->
<result
column=
"content_sort"
property=
"contentSort"
/>
<!--自定义顺序 -->
<result
column=
"content_img"
property=
"contentImg"
/>
<!--文章缩略图 -->
<result
column=
"content_description"
property=
"contentDescription"
/>
<!--描述 -->
<result
column=
"content_keyword"
property=
"contentKeyword"
/>
<!--关键字 -->
<result
column=
"content_details"
property=
"contentDetails"
/>
<!--文章内容 -->
<result
column=
"content_url"
property=
"contentUrl"
/>
<!--文章跳转链接地址 -->
<!-- <result column="static_url" property="staticUrl" /><!–静态地址 –>-->
<result
column=
"content_hit"
property=
"contentHit"
/>
<!--点击次数 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
<result
column=
"update_by"
property=
"updateBy"
/>
<!--修改人 -->
<result
column=
"update_date"
property=
"updateDate"
/>
<!--修改时间 -->
<result
column=
"del"
property=
"del"
/>
<!--删除标记 -->
</resultMap>
<resultMap
id=
"resultBean"
type=
"net.mingsoft.cms.bean.CategoryBean"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<id
column=
"article_Id"
property=
"articleId"
/>
<!--编号 -->
<result
column=
"category_title"
property=
"categoryTitle"
/>
<!--栏目管理名称 -->
<result
column=
"category_id"
property=
"categoryId"
/>
<!--所属栏目 -->
<result
column=
"category_type"
property=
"categoryType"
/>
<!--栏目管理属性 -->
<result
column=
"category_sort"
property=
"categorySort"
/>
<!--自定义顺序 -->
<result
column=
"category_list_url"
property=
"categoryListUrl"
/>
<!--列表模板 -->
<result
column=
"category_url"
property=
"categoryUrl"
/>
<!--内容模板 -->
<result
column=
"category_keyword"
property=
"categoryKeyword"
/>
<!--栏目管理关键字 -->
<result
column=
"category_descrip"
property=
"categoryDescrip"
/>
<!--栏目管理描述 -->
<result
column=
"category_img"
property=
"categoryImg"
/>
<!--缩略图 -->
<result
column=
"category_diy_url"
property=
"categoryDiyUrl"
/>
<!--自定义链接 -->
<result
column=
"mdiy_model_id"
property=
"mdiyModelId"
/>
<!--栏目管理的内容模型id -->
<result
column=
"category_datetime"
property=
"categoryDatetime"
/>
<!--类别发布时间 -->
<result
column=
"dict_id"
property=
"dictId"
/>
<!--字典对应编号 -->
<result
column=
"category_flag"
property=
"categoryFlag"
/>
<!--栏目属性 -->
<result
column=
"category_path"
property=
"categoryPath"
/>
<!--栏目路径 -->
<result
column=
"category_parent_ids"
property=
"categoryParentIds"
/>
<!--父类型编号 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
<result
column=
"update_by"
property=
"updateBy"
/>
<!--修改人 -->
<result
column=
"update_date"
property=
"updateDate"
/>
<!--修改时间 -->
<result
column=
"del"
property=
"del"
/>
<!--删除标记 -->
</resultMap>
<!--保存-->
<insert
id=
"saveEntity"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"net.mingsoft.cms.entity.ContentEntity"
>
insert into cms_content
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"contentTitle != null and contentTitle != ''"
>
content_title,
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
category_id,
</if>
<if
test=
"contentType != null "
>
content_type,
</if>
<if
test=
"contentDisplay != null and contentDisplay != ''"
>
content_display,
</if>
<if
test=
"contentAuthor != null and contentAuthor != ''"
>
content_author,
</if>
<if
test=
"contentSource != null and contentSource != ''"
>
content_source,
</if>
<if
test=
"contentDatetime != null"
>
content_datetime,
</if>
<if
test=
"contentSort != null"
>
content_sort,
</if>
<if
test=
"contentImg != null and contentImg != ''"
>
content_img,
</if>
<if
test=
"contentDescription != null and contentDescription != ''"
>
content_description,
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
content_keyword,
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
content_details,
</if>
<if
test=
"contentUrl != null and contentUrl != ''"
>
content_url,
</if>
<if
test=
"contentHit != null"
>
content_hit,
</if>
<if
test=
"createBy > 0"
>
create_by,
</if>
<if
test=
"createDate != null"
>
create_date,
</if>
<if
test=
"updateBy > 0"
>
update_by,
</if>
<if
test=
"updateDate != null"
>
update_date,
</if>
<if
test=
"del != null"
>
del,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"contentTitle != null and contentTitle != ''"
>
#{contentTitle},
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
#{categoryId},
</if>
<if
test=
"contentType != null "
>
#{contentType},
</if>
<if
test=
"contentDisplay != null and contentDisplay != ''"
>
#{contentDisplay},
</if>
<if
test=
"contentAuthor != null and contentAuthor != ''"
>
#{contentAuthor},
</if>
<if
test=
"contentSource != null and contentSource != ''"
>
#{contentSource},
</if>
<if
test=
"contentDatetime != null"
>
#{contentDatetime},
</if>
<if
test=
"contentSort != null"
>
#{contentSort},
</if>
<if
test=
"contentImg != null and contentImg != ''"
>
#{contentImg},
</if>
<if
test=
"contentDescription != null and contentDescription != ''"
>
#{contentDescription},
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
#{contentKeyword},
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
#{contentDetails},
</if>
<if
test=
"contentUrl != null and contentUrl != ''"
>
#{contentUrl},
</if>
<if
test=
"contentHit != null"
>
#{contentHit},
</if>
<if
test=
"createBy > 0"
>
#{createBy},
</if>
<if
test=
"createDate != null"
>
#{createDate},
</if>
<if
test=
"updateBy > 0"
>
#{updateBy},
</if>
<if
test=
"updateDate != null"
>
#{updateDate},
</if>
<if
test=
"del != null"
>
#{del},
</if>
</trim>
</insert>
<!--更新-->
<update
id=
"updateEntity"
parameterType=
"net.mingsoft.cms.entity.ContentEntity"
>
update cms_content
<set>
<if
test=
"contentTitle != null and contentTitle != ''"
>
content_title=#{contentTitle},
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
category_id=#{categoryId},
</if>
<if
test=
"contentType != null "
>
content_type=#{contentType},
</if>
<if
test=
"contentDisplay != null and contentDisplay != ''"
>
content_display=#{contentDisplay},
</if>
<if
test=
"contentAuthor != null "
>
content_author=#{contentAuthor},
</if>
<if
test=
"contentSource != null "
>
content_source=#{contentSource},
</if>
<if
test=
"contentDatetime != null"
>
content_datetime=#{contentDatetime},
</if>
<if
test=
"contentSort != null"
>
content_sort=#{contentSort},
</if>
<if
test=
"contentImg != null and contentImg != ''"
>
content_img=#{contentImg},
</if>
<if
test=
"contentDescription != null "
>
content_description=#{contentDescription},
</if>
<if
test=
"contentKeyword != null "
>
content_keyword=#{contentKeyword},
</if>
<if
test=
"contentDetails != null "
>
content_details=#{contentDetails},
</if>
<if
test=
"contentUrl != null and contentUrl != ''"
>
content_url=#{contentUrl},
</if>
<if
test=
"contentHit != null"
>
content_hit=#{contentHit},
</if>
<if
test=
"createBy > 0"
>
create_by=#{createBy},
</if>
<if
test=
"createDate != null"
>
create_date=#{createDate},
</if>
<if
test=
"updateBy > 0"
>
update_by=#{updateBy},
</if>
<if
test=
"updateDate != null"
>
update_date=#{updateDate},
</if>
<if
test=
"del != null"
>
del=#{del},
</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select
id=
"getEntity"
resultMap=
"resultMap"
parameterType=
"int"
>
select * from cms_content where id=#{id} and del=0
</select>
<!--根据实体获取-->
<select
id=
"getByEntity"
resultMap=
"resultMap"
parameterType=
"net.mingsoft.cms.entity.ContentEntity"
>
select * from cms_content
<where>
del=0
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
and category_id=#{categoryId}
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type=#{contentType}
</if>
<if
test=
"contentDisplay != null and contentDisplay != ''"
>
and content_display=#{contentDisplay}
</if>
<if
test=
"contentAuthor != null and contentAuthor != ''"
>
and content_author=#{contentAuthor}
</if>
<if
test=
"contentSource != null and contentSource != ''"
>
and content_source=#{contentSource}
</if>
<if
test=
"contentDatetime != null"
>
and content_datetime=#{contentDatetime}
</if>
<if
test=
"contentSort != null"
>
and content_sort=#{contentSort}
</if>
<if
test=
"contentImg != null and contentImg != ''"
>
and content_img=#{contentImg}
</if>
<if
test=
"contentDescription != null and contentDescription != ''"
>
and content_description=#{contentDescription}
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
and content_keyword=#{contentKeyword}
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
and content_details=#{contentDetails}
</if>
<if
test=
"contentUrl != null and contentUrl != ''"
>
and content_url=#{contentUrl}
</if>
<if
test=
"contentHit != null"
>
and content_hit=#{contentHit}
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
</where>
limit 0,1
</select>
<!--删除-->
<delete
id=
"deleteEntity"
parameterType=
"int"
>
update cms_content set del=1 where id=#{id}
</delete>
<!--删除-->
<delete
id=
"deleteEntityByCategoryIds"
>
update cms_content set del=1
<where>
category_id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</delete>
<!--批量删除-->
<delete
id=
"delete"
>
update cms_content set del=1
<where>
id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</delete>
<!--查询全部-->
<select
id=
"queryAll"
resultMap=
"resultMap"
>
select * from cms_content where del=0 order by id desc
</select>
<!--条件查询-->
<select
id=
"query"
resultMap=
"resultContentMap"
>
<!--,CONCAT('/html/',ct.app_id,category_path,'/',ct.id,'.html') AS static_url-->
select ct.* from (
select ct.*,cc.category_path from cms_content ct
join cms_category cc on ct.category_id=cc.id
<where>
ct.del=0
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"categoryId != null and categoryId != ''"
>
and (ct.category_id=#{categoryId} or ct.category_id in
(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)))
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type LIKE CONCAT('%',#{contentType},'%')
</if>
<if
test=
"contentDisplay != null and contentDisplay != ''"
>
and content_display=#{contentDisplay}
</if>
<if
test=
"contentAuthor != null and contentAuthor != ''"
>
and content_author=#{contentAuthor}
</if>
<if
test=
"contentSource != null and contentSource != ''"
>
and content_source=#{contentSource}
</if>
<if
test=
"contentDatetime != null"
>
and content_datetime=#{contentDatetime}
</if>
<if
test=
"contentSort != null"
>
and content_sort=#{contentSort}
</if>
<if
test=
"contentImg != null and contentImg != ''"
>
and content_img=#{contentImg}
</if>
<if
test=
"contentDescription != null and contentDescription != ''"
>
and content_description=#{contentDescription}
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
and content_keyword=#{contentKeyword}
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
and content_details=#{contentDetails}
</if>
<if
test=
"contentUrl != null and contentUrl != ''"
>
and content_url=#{contentUrl}
</if>
<if
test=
"contentHit != null"
>
and content_hit=#{contentHit}
</if>
<if
test=
"createBy > 0"
>
and ct.create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and ct.create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and ct.update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
</where>
)ct ORDER BY ct.content_datetime desc,content_sort desc
</select>
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select
id=
"queryIdsByCategoryIdForParser"
resultMap=
"resultBean"
>
select
ct.id article_id,c.*
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0
<!-- 查询子栏目数据 -->
<if
test=
"categoryId > 0"
>
and (ct.category_id=#{categoryId} or ct.category_id in
(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)))
</if>
<if
test=
"beginTime!=null and beginTime!=''"
>
and content_datetime
>
= #{beginTime}
</if>
<if
test=
"endTime!=null and endTime!=''"
>
and content_datetime
>
= #{endTime}
</if>
<if
test=
"flag!=null and flag!=''"
>
and ct.content_type in ( #{flag})
</if>
<if
test=
"noflag!=null and noflag!=''"
>
and (ct.content_type not in ( #{noflag} ) or ct.content_type is null)
</if>
<if
test=
"orderBy!=null and orderBy!='' "
>
<if
test=
"orderBy=='date'"
>
ORDER BY content_datetime
</if>
<if
test=
"orderBy=='hit'"
>
ORDER BY content_hit
</if>
<if
test=
"orderBy=='sort'"
>
ORDER BY content_sort
</if>
<if
test=
"orderBy!='date' and orderBy!='hit' and orderBy!='sort'"
>
ORDER BY ct.id
</if>
<choose>
<when
test=
"order!=null and order!=''"
>
${order}
</when>
<otherwise>
desc
</otherwise>
</choose>
</if>
</select>
<select
id=
"getSearchCount"
resultType=
"int"
>
select count(*) from
cms_content a
left join cms_category c
ON a.category_id
= c.id
<if
test=
"tableName!=null and tableName!='' and diyMap!=null"
>
left join ${tableName} d on d.link_id=a.id
</if>
<where>
a.del=0
<if
test=
"ids!=null and ids!=''"
>
and FIND_IN_SET(a.category_id,#{ids})
</if>
<if
test=
"map.content_title!=null"
>
and a.content_title like CONCAT("%",#{map.content_title},"%")
</if>
<if
test=
"map.content_author!=null"
>
and a.content_author like CONCAT("%",#{map.content_author},"%")
</if>
<if
test=
"map.content_source!=null"
>
and a.content_source like CONCAT("%",#{map.content_source},"%")
</if>
<if
test=
"map.content_type!=null"
>
and
<foreach
item=
"item"
index=
"index"
collection=
"map.content_type.split(',')"
open=
"("
separator=
"or"
close=
")"
>
FIND_IN_SET('${item}',a.content_type)
</foreach>
</if>
<if
test=
"map.content_description!=null"
>
and a.content_description like CONCAT("%",#{map.content_description},"%")
</if>
<if
test=
"map.content_keyword!=null"
>
and a.content_keyword like CONCAT("%",#{map.content_keyword},"%")
</if>
<if
test=
"map.content_details!=null"
>
and a.content_details like CONCAT("%",#{map.content_details},"%")
</if>
<if
test=
"map.content_datetime_start!=null and map.content_datetime_end!=null"
>
and a.content_datetime between #{map.content_datetime_start} and #{map.content_datetime_end}
</if>
<if
test=
"tableName!=null and tableName!='' and diyMap!=null"
>
<foreach
item=
"item"
index=
"index"
collection=
"diyList"
open=
""
separator=
""
close=
""
>
and d.${field.key} like CONCAT("%",#{item.value},"%")
</foreach>
</if>
</where>
</select>
</mapper>
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.entity
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.FieldStrategy
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 分类实体
*
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@TableName
(
"cms_category"
)
public
class
CategoryEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1574925152750L
;
/**
* 栏目管理名称
*/
private
String
categoryTitle
;
/**
* 栏目别名
*/
private
String
categoryPinyin
;
/**
* 所属栏目
*/
@TableField
(
insertStrategy
=
FieldStrategy
.
NOT_EMPTY
,
updateStrategy
=
FieldStrategy
.
NOT_EMPTY
,
whereStrategy
=
FieldStrategy
.
NOT_EMPTY
)
private
String
categoryId
;
/**
* 栏目管理属性
*/
private
String
categoryType
;
/**
* 自定义顺序
*/
private
Integer
categorySort
;
/**
* 列表模板
*/
private
String
categoryListUrl
;
/**
* 内容模板
*/
private
String
categoryUrl
;
/**
* 栏目管理关键字
*/
private
String
categoryKeyword
;
/**
* 栏目管理描述
*/
private
String
categoryDescrip
;
/**
* 缩略图
*/
private
String
categoryImg
;
/**
* 自定义链接
*/
private
String
categoryDiyUrl
;
/**
* 栏目管理的内容模型id
*/
private
Integer
mdiyModelId
;
/**
* 类别发布时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
categoryDatetime
;
/**
* 字典对应编号
*/
private
Integer
dictId
;
/**
* 栏目属性
*/
private
String
categoryFlag
;
/**
* 栏目路径
*/
private
String
categoryPath
;
/**
* 父类型编号
*/
private
String
categoryParentIds
;
/**
* 叶子节点
*/
private
Boolean
leaf
;
/**
* 顶级id
*/
private
String
topId
;
public
Boolean
getLeaf
()
{
return
leaf
;
}
public
void
setLeaf
(
Boolean
leaf
)
{
this
.
leaf
=
leaf
;
}
public
String
getTopId
()
{
return
topId
;
}
public
void
setTopId
(
String
topId
)
{
this
.
topId
=
topId
;
}
/**
* 设置栏目管理名称
*/
public
void
setCategoryTitle
(
String
categoryTitle
)
{
this
.
categoryTitle
=
categoryTitle
;
}
/**
* 获取栏目管理名称
*/
public
String
getCategoryTitle
()
{
return
this
.
categoryTitle
;
}
/**
* 设置所属栏目
*/
public
void
setCategoryId
(
String
categoryId
)
{
this
.
categoryId
=
categoryId
;
}
public
String
getCategoryPinyin
()
{
return
categoryPinyin
;
}
public
void
setCategoryPinyin
(
String
categoryPinyin
)
{
this
.
categoryPinyin
=
categoryPinyin
;
}
/**
* 获取所属栏目
*/
public
String
getCategoryId
()
{
return
this
.
categoryId
;
}
/**
* 设置栏目管理属性
*/
public
void
setCategoryType
(
String
categoryType
)
{
this
.
categoryType
=
categoryType
;
}
/**
* 获取栏目管理属性
*/
public
String
getCategoryType
()
{
return
this
.
categoryType
;
}
/**
* 设置自定义顺序
*/
public
void
setCategorySort
(
Integer
categorySort
)
{
this
.
categorySort
=
categorySort
;
}
/**
* 获取自定义顺序
*/
public
Integer
getCategorySort
()
{
return
this
.
categorySort
;
}
/**
* 设置列表模板
*/
public
void
setCategoryListUrl
(
String
categoryListUrl
)
{
this
.
categoryListUrl
=
categoryListUrl
;
}
/**
* 获取列表模板
*/
public
String
getCategoryListUrl
()
{
return
this
.
categoryListUrl
;
}
/**
* 设置内容模板
*/
public
void
setCategoryUrl
(
String
categoryUrl
)
{
this
.
categoryUrl
=
categoryUrl
;
}
/**
* 获取内容模板
*/
public
String
getCategoryUrl
()
{
return
this
.
categoryUrl
;
}
/**
* 设置栏目管理关键字
*/
public
void
setCategoryKeyword
(
String
categoryKeyword
)
{
this
.
categoryKeyword
=
categoryKeyword
;
}
/**
* 获取栏目管理关键字
*/
public
String
getCategoryKeyword
()
{
return
this
.
categoryKeyword
;
}
/**
* 设置栏目管理描述
*/
public
void
setCategoryDescrip
(
String
categoryDescrip
)
{
this
.
categoryDescrip
=
categoryDescrip
;
}
/**
* 获取栏目管理描述
*/
public
String
getCategoryDescrip
()
{
return
this
.
categoryDescrip
;
}
/**
* 设置缩略图
*/
public
void
setCategoryImg
(
String
categoryImg
)
{
this
.
categoryImg
=
categoryImg
;
}
/**
* 获取缩略图
*/
public
String
getCategoryImg
()
{
return
this
.
categoryImg
;
}
/**
* 设置自定义链接
*/
public
void
setCategoryDiyUrl
(
String
categoryDiyUrl
)
{
this
.
categoryDiyUrl
=
categoryDiyUrl
;
}
/**
* 获取自定义链接
*/
public
String
getCategoryDiyUrl
()
{
return
this
.
categoryDiyUrl
;
}
public
Integer
getMdiyModelId
()
{
return
mdiyModelId
;
}
public
void
setMdiyModelId
(
Integer
mdiyModelId
)
{
this
.
mdiyModelId
=
mdiyModelId
;
}
/**
* 设置类别发布时间
*/
public
void
setCategoryDatetime
(
Date
categoryDatetime
)
{
this
.
categoryDatetime
=
categoryDatetime
;
}
/**
* 获取类别发布时间
*/
public
Date
getCategoryDatetime
()
{
return
this
.
categoryDatetime
;
}
/**
* 设置字典对应编号
*/
public
void
setDictId
(
Integer
dictId
)
{
this
.
dictId
=
dictId
;
}
/**
* 获取字典对应编号
*/
public
Integer
getDictId
()
{
return
this
.
dictId
;
}
/**
* 设置栏目属性
*/
public
void
setCategoryFlag
(
String
categoryFlag
)
{
this
.
categoryFlag
=
categoryFlag
;
}
/**
* 获取栏目属性
*/
public
String
getCategoryFlag
()
{
return
this
.
categoryFlag
;
}
/**
* 设置栏目路径
*/
public
void
setCategoryPath
(
String
categoryPath
)
{
this
.
categoryPath
=
categoryPath
;
}
/**
* 获取栏目路径
*/
public
String
getCategoryPath
()
{
return
this
.
categoryPath
;
}
/**
* 设置父类型编号
*/
public
void
setCategoryParentIds
(
String
categoryParentIds
)
{
this
.
categoryParentIds
=
categoryParentIds
;
}
/**
* 获取父类型编号
*/
public
String
getCategoryParentIds
()
{
return
this
.
categoryParentIds
;
}
/**
* 获取栏目标题 (标签使用)
*/
public
String
getTypetitle
()
{
return
this
.
categoryTitle
;
}
/**
* 获取栏目链接 (标签使用,动态链接不考虑)
*/
public
String
getTypelink
()
{
return
"3"
.
equals
(
this
.
categoryType
)
?
this
.
categoryDiyUrl
:
this
.
categoryPath
+
"/index.html"
;
}
/**
* 获取栏目关键字 (标签使用)
*/
public
String
getTypekeyword
()
{
return
this
.
categoryKeyword
;
}
/**
* 获取栏目url (标签使用)
*/
public
String
getTypeurl
()
{
return
this
.
categoryDiyUrl
;
}
/**
* 获取栏目属性 (标签使用)
*/
public
String
getFlag
()
{
return
this
.
categoryFlag
;
}
/**
* 获取栏目父级Id (标签使用)
*/
public
String
getParentids
()
{
return
this
.
categoryParentIds
;
}
/**
* 获取栏目描述(标签使用)
*/
public
String
getTypedescrip
()
{
return
this
.
categoryDescrip
;
}
/**
* 获取栏目Id(标签使用)
*/
public
String
getTypeid
()
{
return
this
.
id
;
}
/**
* 获取栏目图片 (标签使用)
*/
public
String
getTypelitpic
()
{
return
categoryImg
;
}
}
src/main/java/net/mingsoft/cms/entity/ContentEntity.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@TableName
(
"cms_content"
)
public
class
ContentEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1574925152617L
;
/**
* 文章标题
*/
private
String
contentTitle
;
/**
* 所属栏目
*/
private
String
categoryId
;
/**
* 文章类型
*/
private
String
contentType
;
/**
* 是否显示
*/
private
String
contentDisplay
;
/**
* 文章作者
*/
private
String
contentAuthor
;
/**
* 文章来源
*/
private
String
contentSource
;
/**
* 发布时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
contentDatetime
;
/**
* 自定义顺序
*/
private
Integer
contentSort
;
/**
* 文章缩略图
*/
private
String
contentImg
;
/**
* 描述
*/
private
String
contentDescription
;
/**
* 关键字
*/
private
String
contentKeyword
;
/**
* 文章内容
*/
private
String
contentDetails
;
/**
* 文章跳转链接地址
*/
private
String
contentUrl
;
/**
* 文章管理的应用id
*/
/**
* 点击次数
*/
private
Integer
contentHit
;
public
Integer
getContentHit
()
{
return
contentHit
;
}
public
void
setContentHit
(
Integer
contentHit
)
{
this
.
contentHit
=
contentHit
;
}
/**
* 设置文章标题
*/
public
void
setContentTitle
(
String
contentTitle
)
{
this
.
contentTitle
=
contentTitle
;
}
/**
* 获取文章标题
*/
public
String
getContentTitle
()
{
return
this
.
contentTitle
;
}
public
String
getCategoryId
()
{
return
categoryId
;
}
public
void
setCategoryId
(
String
categoryId
)
{
this
.
categoryId
=
categoryId
;
}
/**
* 设置文章类型
*/
public
void
setContentType
(
String
contentType
)
{
this
.
contentType
=
contentType
;
}
/**
* 获取文章类型
*/
public
String
getContentType
()
{
return
this
.
contentType
;
}
/**
* 设置是否显示
*/
public
void
setContentDisplay
(
String
contentDisplay
)
{
this
.
contentDisplay
=
contentDisplay
;
}
/**
* 获取是否显示
*/
public
String
getContentDisplay
()
{
return
this
.
contentDisplay
;
}
/**
* 设置文章作者
*/
public
void
setContentAuthor
(
String
contentAuthor
)
{
this
.
contentAuthor
=
contentAuthor
;
}
/**
* 获取文章作者
*/
public
String
getContentAuthor
()
{
return
this
.
contentAuthor
;
}
/**
* 设置文章来源
*/
public
void
setContentSource
(
String
contentSource
)
{
this
.
contentSource
=
contentSource
;
}
/**
* 获取文章来源
*/
public
String
getContentSource
()
{
return
this
.
contentSource
;
}
/**
* 设置发布时间
*/
public
void
setContentDatetime
(
Date
contentDatetime
)
{
this
.
contentDatetime
=
contentDatetime
;
}
/**
* 获取发布时间
*/
public
Date
getContentDatetime
()
{
return
this
.
contentDatetime
;
}
/**
* 设置自定义顺序
*/
public
void
setContentSort
(
Integer
contentSort
)
{
this
.
contentSort
=
contentSort
;
}
/**
* 获取自定义顺序
*/
public
Integer
getContentSort
()
{
return
this
.
contentSort
;
}
/**
* 设置文章缩略图
*/
public
void
setContentImg
(
String
contentImg
)
{
this
.
contentImg
=
contentImg
;
}
/**
* 获取文章缩略图
*/
public
String
getContentImg
()
{
return
this
.
contentImg
;
}
/**
* 设置描述
*/
public
void
setContentDescription
(
String
contentDescription
)
{
this
.
contentDescription
=
contentDescription
;
}
/**
* 获取描述
*/
public
String
getContentDescription
()
{
return
this
.
contentDescription
;
}
/**
* 设置关键字
*/
public
void
setContentKeyword
(
String
contentKeyword
)
{
this
.
contentKeyword
=
contentKeyword
;
}
/**
* 获取关键字
*/
public
String
getContentKeyword
()
{
return
this
.
contentKeyword
;
}
/**
* 设置文章内容
*/
public
void
setContentDetails
(
String
contentDetails
)
{
this
.
contentDetails
=
contentDetails
;
}
/**
* 获取文章内容
*/
public
String
getContentDetails
()
{
return
this
.
contentDetails
;
}
/**
* 设置文章跳转链接地址
*/
public
void
setContentUrl
(
String
contentUrl
)
{
this
.
contentUrl
=
contentUrl
;
}
/**
* 获取文章跳转链接地址
*/
public
String
getContentUrl
()
{
return
this
.
contentUrl
;
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/entity/HistoryLogEntity.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
java.util.Date
;
/**
* 文章浏览记录实体
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
class
HistoryLogEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1577064243576L
;
/**
* 文章编号
*/
private
String
contentId
;
/**
* 浏览ip
*/
private
String
hlIp
;
/**
* 用户idp
*/
private
String
peopleId
;
/**
* 是否为移动端
*/
private
Boolean
hlIsMobile
;
/**
* 设置文章编号
*/
public
void
setContentId
(
String
contentId
)
{
this
.
contentId
=
contentId
;
}
/**
* 获取文章编号
*/
public
String
getContentId
()
{
return
this
.
contentId
;
}
/**
* 设置浏览ip
*/
public
void
setHlIp
(
String
hlIp
)
{
this
.
hlIp
=
hlIp
;
}
/**
* 获取浏览ip
*/
public
String
getHlIp
()
{
return
this
.
hlIp
;
}
public
String
getPeopleId
()
{
return
peopleId
;
}
public
void
setPeopleId
(
String
peopleId
)
{
this
.
peopleId
=
peopleId
;
}
/**
* 设置是否为移动端
*/
public
void
setHlIsMobile
(
Boolean
hlIsMobile
)
{
this
.
hlIsMobile
=
hlIsMobile
;
}
/**
* 获取是否为移动端
*/
public
Boolean
getHlIsMobile
()
{
return
this
.
hlIsMobile
;
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/resources/resources_en_US.properties
deleted
100755 → 0
View file @
d91c0e4a
#
#Thu Nov 28 15:12:32 CST 2019
category.img
=
Thumbnail
appid
=
The application id of article management
content.datetime
=
Publishing time
category.manager.id
=
Posting user id
category.title
=
Column management name
category.keyword
=
Column management keyword
content.img
=
Article thumbnail
category.path
=
Column path
content.type
=
Article type
category.url
=
Content template
dict.id
=
Dictionary corresponding number
content.author
=
Article author
category.parent.id
=
Parent type number
category.datetime
=
Category publication time
category.flag
=
Column attribute
content.description
=
Description
content.url
=
Article jump link address
category.sort
=
Custom order
content.title
=
Article title
content.category.id
=
belongingcolumn
id
=
number
app.id
=
application number
category.list.url
=
List template
mdiy.model.id
=
Content model id for column management
content.source
=
The source of the article
content.display
=
Whether to display
category.type
=
Column management attribute
category.descrip
=
Column management description
content.details
=
Article content
category.id
=
belonging to the column
content.sort
=
custom order
category.diy.url
=
custom link
content.keyword
=
keyword
templet.file
=
template file not found
category.pinyin
=
pinyin
src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties
deleted
100755 → 0
View file @
d91c0e4a
#
#Thu Nov 28 15:12:32 CST 2019
category.img
=
\u
7F29
\u7565\u
56FE
appid
=
\u6587\u
7AE0
\u
7BA1
\u7406\u7684\u
5E94
\u7528
id
content.datetime
=
\u
53D1
\u
5E03
\u
65F6
\u
95F4
category.manager.id
=
\u
53D1
\u
5E03
\u7528\u6237
id
category.title
=
\u
680F
\u
76EE
\u
7BA1
\u7406\u
540D
\u
79F0
category.keyword
=
\u
680F
\u
76EE
\u
7BA1
\u7406\u5173\u
952E
\u
5B57
content.img
=
\u6587\u
7AE0
\u
7F29
\u7565\u
56FE
category.path
=
\u
680F
\u
76EE
\u
8DEF
\u
5F84
content.type
=
\u6587\u
7AE0
\u
7C7B
\u
578B
category.url
=
\u5185\u
5BB9
\u
6A21
\u
677F
dict.id
=
\u
5B57
\u5178\u
5BF9
\u
5E94
\u
7F16
\u
53F7
content.author
=
\u6587\u
7AE0
\u
4F5C
\u8005
category.parent.id
=
\u7236\u
7C7B
\u
578B
\u
7F16
\u
53F7
category.datetime
=
\u
7C7B
\u
522B
\u
53D1
\u
5E03
\u
65F6
\u
95F4
category.flag
=
\u
680F
\u
76EE
\u
5C5E
\u6027
content.description
=
\u
63CF
\u
8FF0
content.url
=
\u6587\u
7AE0
\u
8DF3
\u
8F6C
\u
94FE
\u
63A5
\u5730\u5740
category.sort
=
\u
81EA
\u
5B9A
\u
4E49
\u
987A
\u
5E8F
content.title
=
\u6587\u
7AE0
\u6807\u9898
content.category.id
=
\u6240\u
5C5E
\u
680F
\u
76EE
id
=
\u
7F16
\u
53F7
app.id
=
\u
5E94
\u7528\u
7F16
\u
53F7
category.list.url
=
\u5217\u8868\u
6A21
\u
677F
mdiy.model.id
=
\u
680F
\u
76EE
\u
7BA1
\u7406\u7684\u5185\u
5BB9
\u
6A21
\u
578Bid
content.source
=
\u6587\u
7AE0
\u6765\u
6E90
content.display
=
\u
662F
\u5426\u
663E
\u
793A
category.type
=
\u
680F
\u
76EE
\u
7BA1
\u7406\u
5C5E
\u6027
category.descrip
=
\u
680F
\u
76EE
\u
7BA1
\u7406\u
63CF
\u
8FF0
content.details
=
\u6587\u
7AE0
\u5185\u
5BB9
category.id
=
\u6240\u
5C5E
\u
680F
\u
76EE
content.sort
=
\u
81EA
\u
5B9A
\u
4E49
\u
987A
\u
5E8F
category.diy.url
=
\u
81EA
\u
5B9A
\u
4E49
\u
94FE
\u
63A5
content.keyword
=
\u5173\u
952E
\u
5B57
templet.file
=
\u
672A
\u
627E
\u5230\u
6A21
\u
677F
\u6587\u
4EF6
category.pinyin
=
\u
62FC
\u
97F3
src/main/java/net/mingsoft/cms/upgrade/Upgrade.java
deleted
100644 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.upgrade
;
import
cn.hutool.core.util.StrUtil
;
import
io.swagger.models.auth.In
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author by 铭飞开源团队
* @Description TODO
* @date 2020/6/19 15:58
*/
public
class
Upgrade
{
/**
* 更新栏目分类的顶级节点和叶子节点
*/
public
void
upgrade
(){
ICategoryBiz
categoryBiz
=
SpringUtil
.
getBean
(
ICategoryBiz
.
class
);
List
<
CategoryEntity
>
list
=
categoryBiz
.
queryAll
();
list
.
forEach
(
x
->{
//将parentId第一行设为顶级节点
String
topId
=
"0"
;
String
parentId
=
x
.
getParentids
();
if
(
parentId
!=
null
)
{
topId
=
parentId
.
split
(
","
)[
0
];
}
x
.
setTopId
(
topId
);
String
id
=
x
.
getId
();
boolean
leaf
=
true
;
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
String
pId
=
list
.
get
(
i
).
getParentids
();
if
(
pId
==
null
)
{
continue
;
}
leaf
=
!
pId
.
contains
(
id
);
//如果不是叶子就跳出循环,不需要再判断了
if
(!
leaf
)
{
break
;
}
}
x
.
setLeaf
(
leaf
);
//更新
Map
<
String
,
String
>
fields
=
new
HashMap
<>();
fields
.
put
(
"leaf"
,
x
.
getLeaf
()?
"1"
:
"0"
);
fields
.
put
(
"top_id"
,
x
.
getTopId
());
Map
<
String
,
String
>
where
=
new
HashMap
<>();
where
.
put
(
"id"
,
x
.
getId
());
categoryBiz
.
updateBySQL
(
"cms_category"
,
fields
,
where
);
});
}
}
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
deleted
100755 → 0
View file @
d91c0e4a
package
net.mingsoft.cms.util
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.PageUtil
;
import
freemarker.core.ParseException
;
import
freemarker.template.MalformedTemplateNameException
;
import
freemarker.template.TemplateNotFoundException
;
import
net.mingsoft.base.constant.Const
;
import
net.mingsoft.basic.holder.DataHolder
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.constant.e.CategoryTypeEnum
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.biz.IModelBiz
;
import
net.mingsoft.mdiy.biz.impl.ModelBizImpl
;
import
net.mingsoft.mdiy.entity.ModelEntity
;
import
net.mingsoft.mdiy.util.ParserUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
/**
* 文章解析工具类
*/
public
class
CmsParserUtil
{
private
final
static
String
FIELD
=
"field"
;
/**
* 指定模板,指定路径进行生成静态页面,会自定识别pc与移动端
*
* @param templatePath 模板路径
* @param targetPath 生成后的路径,默认生成的html文件,所以不能带.html后缀,
* @throws IOException
*/
public
static
void
generate
(
String
templatePath
,
String
targetPath
,
String
htmlDir
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
ParserUtil
.
IS_DO
,
false
);
CategoryEntity
column
=
new
CategoryEntity
();
//内容管理栏目编码
map
.
put
(
ParserUtil
.
COLUMN
,
column
);
map
.
put
(
ParserUtil
.
HTML
,
htmlDir
);
//站点编号
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
)
{
map
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getWebsiteApp
().
getAppDir
());
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getWebsiteApp
().
getAppHostUrl
());
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
else
{
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getApp
().
getAppDir
());
}
String
content
=
ParserUtil
.
rendering
(
templatePath
,
map
);
FileUtil
.
writeString
(
content
,
ParserUtil
.
buildHtmlPath
(
targetPath
,
htmlDir
,
map
.
get
(
ParserUtil
.
APP_DIR
).
toString
()),
Const
.
UTF8
);
}
/**
* 生成静态列表页
*
* @param column
* @param articleIdTotal
* @throws TemplateNotFoundException
* @throws MalformedTemplateNameException
* @throws ParseException
* @throws IOException
*/
public
static
void
generateList
(
CategoryEntity
column
,
int
articleIdTotal
,
String
htmlDir
)
throws
TemplateNotFoundException
,
MalformedTemplateNameException
,
ParseException
,
IOException
{
try
{
// 文章的栏目模型编号
PageBean
page
=
new
PageBean
();
//获取列表中的size
page
.
setSize
(
ParserUtil
.
getPageSize
(
column
.
getCategoryListUrl
(),
20
));
page
.
setRcount
(
articleIdTotal
);
int
totalPageSize
=
PageUtil
.
totalPage
(
articleIdTotal
,
page
.
getSize
());
page
.
setTotal
(
totalPageSize
);
//全局参数设置
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
parserParams
.
put
(
ParserUtil
.
IS_DO
,
false
);
parserParams
.
put
(
ParserUtil
.
HTML
,
htmlDir
);
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
//站点编号
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
)
{
parserParams
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getWebsiteApp
().
getAppDir
());
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getWebsiteApp
().
getAppHostUrl
());
parserParams
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
else
{
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
parserParams
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getApp
().
getAppDir
());
}
parserParams
.
put
(
ParserUtil
.
COLUMN
,
column
);
//标签中使用field获取当前栏目
parserParams
.
put
(
ParserUtil
.
FIELD
,
column
);
String
columnListPath
;
ModelEntity
contentModel
=
null
;
// 判断当前栏目是否有自定义模型
if
(
column
.
getMdiyModelId
()
!=
null
)
{
// 通过栏目模型编号获取自定义模型实体
contentModel
=
(
ModelEntity
)
SpringUtil
.
getBean
(
ModelBizImpl
.
class
).
getEntity
(
column
.
getMdiyModelId
());
}
if
(
contentModel
!=
null
)
{
// 将自定义模型编号设置为key值
parserParams
.
put
(
ParserUtil
.
TABLE_NAME
,
contentModel
.
getModelTableName
());
}
int
pageNo
=
1
;
//文章列表页没有写文章列表标签,总数为0
if
(
totalPageSize
<=
0
)
{
// 数据库中第一页是从开始0*size
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getCategoryPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
,
htmlDir
,
parserParams
.
get
(
ParserUtil
.
APP_DIR
).
toString
());
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
String
read
=
ParserUtil
.
rendering
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
FileUtil
.
writeString
(
read
,
columnListPath
,
Const
.
UTF8
);
}
else
{
// 遍历分页
for
(
int
i
=
0
;
i
<
totalPageSize
;
i
++)
{
if
(
i
==
0
)
{
// 数据库中第一页是从开始0*size
// 首页路径index.html
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getCategoryPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
,
htmlDir
,
parserParams
.
get
(
ParserUtil
.
APP_DIR
).
toString
());
}
else
{
// 其他路径list-2.html
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getCategoryPath
()
+
File
.
separator
+
ParserUtil
.
PAGE_LIST
+
pageNo
,
htmlDir
,
parserParams
.
get
(
ParserUtil
.
APP_DIR
).
toString
());
}
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
String
read
=
ParserUtil
.
rendering
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
FileUtil
.
writeString
(
read
,
columnListPath
,
Const
.
UTF8
);
pageNo
++;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 生成内容
*
* @param articleIdList 文章集合
* @return
* @throws IOException
* @throws ParseException
* @throws MalformedTemplateNameException
* @throws TemplateNotFoundException
*/
public
static
void
generateBasic
(
List
<
CategoryBean
>
articleIdList
,
String
htmlDir
)
{
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
parserParams
.
put
(
ParserUtil
.
IS_DO
,
false
);
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
)
{
parserParams
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getWebsiteApp
().
getAppDir
());
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getWebsiteApp
().
getAppHostUrl
());
parserParams
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
else
{
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
parserParams
.
put
(
ParserUtil
.
APP_DIR
,
BasicUtil
.
getApp
().
getAppDir
());
}
parserParams
.
put
(
ParserUtil
.
HTML
,
htmlDir
);
Map
<
Object
,
Object
>
contentModelMap
=
new
HashMap
<
Object
,
Object
>();
ModelEntity
contentModel
=
null
;
// 记录已经生成了文章编号
List
<
String
>
generateIds
=
new
ArrayList
<>();
// 生成文章
for
(
int
artId
=
0
;
artId
<
articleIdList
.
size
();
)
{
CategoryBean
categoryBean
=
articleIdList
.
get
(
artId
);
String
writePath
=
null
;
//设置分页类
PageBean
page
=
new
PageBean
();
// 文章编号
String
articleId
=
categoryBean
.
getArticleId
();
// 文章的栏目路径
String
articleColumnPath
=
categoryBean
.
getCategoryPath
();
// 该文章相关分类
String
categoryParentId
=
categoryBean
.
getId
();
if
(
StringUtils
.
isNotBlank
(
categoryBean
.
getCategoryParentIds
()))
{
categoryParentId
+=
','
+
categoryBean
.
getCategoryParentIds
();
}
// 文章的模板路径
String
columnUrl
=
categoryBean
.
getCategoryUrl
();
// 文章的栏目模型编号
Integer
columnContentModelId
=
null
;
if
(
articleIdList
.
get
(
artId
).
getMdiyModelId
()
!=
null
&&
categoryBean
.
getMdiyModelId
()
>
0
)
{
columnContentModelId
=
categoryBean
.
getMdiyModelId
();
}
// 文章是否已经生成了,生成了就跳过
if
(
generateIds
.
contains
(
articleId
))
{
artId
++;
continue
;
}
// 判断文件是否存在,若不存在弹出返回信息
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
columnUrl
))
||
categoryBean
.
getId
()
==
null
||
categoryBean
.
getCategoryType
()
==
null
)
{
artId
++;
continue
;
}
// 将
generateIds
.
add
(
articleId
);
//如果是封面就生成index.html
if
(
categoryBean
.
getCategoryType
().
equals
(
CategoryTypeEnum
.
COVER
.
toString
()))
{
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
ParserUtil
.
INDEX
,
htmlDir
,
parserParams
.
get
(
ParserUtil
.
APP_DIR
).
toString
());
}
else
{
// 组合文章路径如:html/站点id/栏目id/文章id.html
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
articleId
,
htmlDir
,
parserParams
.
get
(
ParserUtil
.
APP_DIR
).
toString
());
}
parserParams
.
put
(
ParserUtil
.
COLUMN
,
categoryBean
);
// 判断当前栏目是否有自定义模型
if
(
columnContentModelId
!=
null
)
{
// 通过当前栏目的模型编号获取,自定义模型表名
if
(
contentModelMap
.
containsKey
(
columnContentModelId
))
{
parserParams
.
put
(
ParserUtil
.
TABLE_NAME
,
contentModel
.
getModelTableName
());
}
else
{
// 通过栏目模型编号获取自定义模型实体
contentModel
=
(
ModelEntity
)
SpringUtil
.
getBean
(
IModelBiz
.
class
)
.
getEntity
(
columnContentModelId
);
// 将自定义模型编号设置为key值
contentModelMap
.
put
(
columnContentModelId
,
contentModel
.
getModelTableName
());
parserParams
.
put
(
ParserUtil
.
TABLE_NAME
,
contentModel
.
getModelTableName
());
}
}
parserParams
.
put
(
ParserUtil
.
ID
,
articleId
);
// 第一篇文章没有上一篇
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
(
ParserUtil
.
PAGE
,
page
);
String
finalWritePath
=
writePath
;
HashMap
<
Object
,
Object
>
cloneMap
=
CollUtil
.
newHashMap
();
cloneMap
.
putAll
(
parserParams
);
HttpServletRequest
request
=
SpringUtil
.
getRequest
();
String
content
=
null
;
try
{
content
=
ParserUtil
.
rendering
(
columnUrl
,
cloneMap
);
FileUtil
.
writeString
(
content
,
finalWritePath
,
Const
.
UTF8
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
artId
++;
}
}
}
Prev
1
2
Next
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