Commit 6201a48d authored by 信 赵's avatar 信 赵
Browse files

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
#	src/main/java/net/mingsoft/cms/biz/IArticleBiz.java
#	src/main/java/net/mingsoft/cms/biz/impl/ArticleBizImpl.java
#	src/main/java/net/mingsoft/cms/dao/IArticleDao.java
#	src/main/java/net/mingsoft/cms/dao/IArticleDao.xml
#	src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties
parents dfad56af 2d19a084
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.biz.impl;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.mdiy.entity.ModelEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.dao.IContentDao;
/**
* 文章管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service("cmscontentBizImpl")
public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
@Autowired
private IContentDao contentDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return contentDao;
}
@Override
public List<ContentBean> queryIdsByCategoryIdForParser(String categoryId, String beginTime, String endTime) {
return this.contentDao.queryIdsByCategoryIdForParser(categoryId,BasicUtil.getAppId(), beginTime, endTime,null,null);
}
@Override
public List<ContentBean> queryIdsByCategoryIdForParser(String categoryId, String beginTime, String endTime, String orderBy, String order) {
return this.contentDao.queryIdsByCategoryIdForParser(categoryId, BasicUtil.getAppId(), beginTime, endTime,orderBy,order);
}
@Override
public int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds) {
if (contentModel!=null) {
return contentDao.getSearchCount(contentModel.getModelTableName(),diyList,whereMap, appId,categoryIds);
}
return contentDao.getSearchCount(null,null,whereMap, appId,categoryIds);
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.biz.impl;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.cms.dao.ICmsHistoryLogDao;
/**
* 文章浏览记录管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
@Service("cmshistoryLogBizImpl")
public class HistoryLogBizImpl extends BaseBizImpl implements IHistoryLogBiz {
@Autowired
private ICmsHistoryLogDao historyLogDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return historyLogDao;
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.constant;
import net.mingsoft.base.constant.e.BaseEnum;
public enum ModelCode implements BaseEnum{
/**
* 内容:栏目模块编号
*/
CMS_COLUMN("02990000"),
/**
* 内容:文章模块编号
*/
CMS_ARTICLE("02980100"),
/**
* 内容:文章列表
*/
CMS_ARTICLE_BASIC("02980000"),
/**
* 内容:自定义搜索
*/
CMS_SEARCH("02050000"),
/**
* 内容:自定义模型
*/
CMS_CONTENT_MODEL("02060000"),
/**
* 内容:一键更新
*/
CMS_GENERATE_ALL("02070100"),
/**
* 内容:更新主页
*/
CMS_GENERATE_INDEX("02070200"),
/**
* 内容:更新文档
*/
CMS_GENERATE_ARTICLE("02070300"),
/**
* 内容: 更新栏目
*/
CMS_GENERATE_COLUMN("02070400"),
/**
* 内容:模版
*/
CMS_TEMPLETSKIN("02080000"),
/**
* 内容:织梦数据导入
*/
COM_DEDE_DATA_IMPORT("02090100"),
/**
* 内容:栏目属性管理模块
*/
CMS_COLUMN_TYPE("02090200");
/**
* 设置modelCode的常量
* @param code 常量
*/
ModelCode(String code) {
this.code = code;
}
private String code;
/**
* 返回该modelCode常量的字符串表示
* @return 字符串
*/
@Override
public String toString() {
// TODO Auto-generated method stub
return code;
}
/**
* 返回该modelCode常量的整型表示
* @return 整型
*/
public int toInt() {
// TODO Auto-generated method stub
return Integer.parseInt(code);
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.constant.e;
import net.mingsoft.base.constant.e.BaseEnum;
/**
*
* @ClassName: ColumnTypeEnum
* @Description:TODO(文章栏目分类类型)
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:55:18
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
public enum ColumnTypeEnum implements BaseEnum {
/**
* 列表
*/
COLUMN_TYPE_LIST(1),
/**
* 单页
*/
COLUMN_TYPE_COVER(2),
/**
* 跳转地址
*/
COLUMN_TYPE_URL(3);
ColumnTypeEnum(Object code) {
this.code = code;
}
private Object code;
@Override
public int toInt() {
// TODO Auto-generated method stub
return Integer.valueOf(code+"");
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.entity.ArticleEntity;
import net.mingsoft.base.dao.IBaseDao;
/**
*
* @ClassName: IArticleDao
* @Description:TODO(文章管理持久化层 || 继承IBaseDao持久化层)
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:55:33
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
public interface IArticleDao extends IBaseDao {
/**
* @para webId 网站编号
* @param basicCategoryIds
* 栏目编号集合
* @param flag
* 文章属性
* @param noFlag
* 文章不存在的属性
* @param article
* 文章实体,便于扩展查询
* @return 文章总数
*/
@Deprecated
int count(@Param("webId") int webId, @Param("basicCategoryIds") int[] basicCategoryIds, @Param("flag") String flag,
@Param("noFlag") String noFlag, @Param("article") ArticleEntity article);
/**
* 通过分类id获取文章内容
*
* @param categoryId
* 分类编号
* @return 文章集合
*/
@Deprecated
List getByCategoryId(@Param("categoryId") int categoryId);
/**
* 通过视图表来查询文章总数
*
* @param basicId
* 文章编号
* @param contentModelTableName
* 对应模块表名称
*/
List getById(@Param("basicId") int basicId, @Param("contentModelTableName") String contentModelTableName);
/**
* 查找basicId上一篇文章
*
* @param appId
* 应用编号
* @param basicId
* 文章编号
* @param flag
* true:上一条 false:下一条
* @return
*/
ArticleEntity getNextOrPrevious(@Param("appId") int appId, @Param("basicId") int basicId,
@Param("flag") boolean flag, @Param("categoryId") Integer categoryId);
/**
* 根据查询文章实体总数
*
* @param tableName
* :自定义生成的表名
* @param map
* key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段 list[1]:是否为整形
* list[2]:是否是等值查询 list[3]:字段的值
* @return 文章实体总数
*/
int getSearchCount(@Param("tableName") String tableName, @Param("map") Map<String, List> map,
@Param("websiteId") int websiteId, @Param("ids") String ids);
/**
* 文章查询
*
* @para webId 网站编号
* @param basicCategoryIds
* 栏目编号集合
* @param flag
* 文章属性
* @param noFlag
* 文章不存在的属性
* @param orderBy
* 排序字段
* @param order
* true 升序 false 降序 排序方式
* @param article
* 文章实体,便于扩展查询
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 文章集合
*/
List<ArticleEntity> query(@Param("webId") int webId, @Param("basicCategoryIds") int[] basicCategoryIds,
@Param("flag") String flag, @Param("noFlag") String noFlag, @Param("orderBy") String orderBy,
@Param("order") boolean order, @Param("beginTime") String beginTime,@Param("endTime") String endTime,
@Param("article") ArticleEntity article);
/**
* 根据页面栏目的id获取与其绑定的文章实体
*
* @param basicCategoryId
* @return 文章实体
*/
@Deprecated
List<ArticleEntity> queryListByColumnId(@Param("basicCategoryId") int basicCategoryId);
/**
* 根据查询文章实体
*
* @param tableName
* :自定义生成的表名
* @param map
* 获取查询条件的Map key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段
* list[1]:是否为整形 list[2]:是否是等值查询 list[3]:字段的值
* @return 文章实体
*/
@Deprecated
List<ArticleEntity> queryListForSearch(@Param("tableName") String tableName, @Param("map") Map<String, List> map,
@Param("websiteId") int websiteId, @Param("ids") List ids,
@Param("sortMap") Map sortMap);
/**
* 查询文章编号集合
* @param categoryId 栏目编号
* @param appId 站点编号
* @param beginTime 开始时间
* @param endTime 结束时间
* @return
*/
public List<ColumnArticleIdBean> queryIdsByCategoryIdForParser(@Param("categoryId")int categoryId,@Param("appId")int appId , @Param("beginTime") String beginTime,@Param("endTime") String endTime,@Param("orderBy")String orderBy,@Param("order")String order);
}
\ No newline at end of file
<?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.IArticleDao">
<!-- 表栏目名 开始 -->
<sql id="column_list">
a.ARTICLE_BASICID,a.ARTICLE_CONTENT,a.ARTICLE_AUTHOR,a.ARTICLE_TYPE,a.ARTICLE_SOURCE,a.ARTICLE_URL,a.ARTICLE_KEYWORD,a.ARTICLE_FREEORDER,a.ARTICLE_WEBID,
b.BASIC_ID,b.BASIC_TITLE,b.BASIC_DESCRIPTION,b.BASIC_THUMBNAILS,b.BASIC_HIT,b.BASIC_DISPLAY,b.BASIC_DATETIME,b.BASIC_UPDATETIME,b.BASIC_PEOPLEID,b.BASIC_CATEGORYID,b.BASIC_SORT
</sql>
<!-- 表栏目名 结束 -->
<!-- 获取表字段 开始 -->
<resultMap type="net.mingsoft.cms.entity.ArticleEntity" id="resultMap">
<id column="ARTICLE_BASICID" property="articleID" /> <!-- 与cms_article表绑定id -->
<result column="ARTICLE_CONTENT" property="articleContent" /> <!-- 文章内容 -->
<result column="ARTICLE_AUTHOR" property="articleAuthor" /> <!-- 文章作者 -->
<result column="ARTICLE_TYPE" property="articleType" /> <!-- 文章属性 -->
<result column="ARTICLE_SOURCE" property="articleSource" /> <!-- 文章来源 -->
<result column="ARTICLE_URL" property="articleUrl" /> <!-- 文章跳转链接地址 -->
<result column="ARTICLE_KEYWORD" property="articleKeyword" /> <!-- 文章关键字 -->
<result column="ARTICLE_FREEORDER" property="articleFreeOrder" /><!--
文章自定义显示顺序 -->
<result column="ARTICLE_WEBID" property="articleWebId" /> <!-- 站点id -->
<result column="BASIC_ID" property="basicId" /> <!-- 与表basic绑定 自增长ID -->
<result column="BASIC_TITLE" property="basicTitle" /> <!-- 文章标题 -->
<result column="BASIC_DESCRIPTION" property="basicDescription" /><!--
文章描述 -->
<result column="BASIC_THUMBNAILS" property="basicThumbnails" /> <!-- 文章缩略图 -->
<result column="BASIC_HIT" property="basicHit" /> <!-- 文章点击次数 -->
<result column="BASIC_DATETIME" property="basicDateTime" /> <!-- 文章发布时间 -->
<result column="BASIC_UPDATETIME" property="basicUpdateTime" /> <!-- 文章更新时间 -->
<result column="BASIC_PEOPLEID" property="basicPeopleId" /> <!-- 文章发布者id -->
<result column="BASIC_CATEGORYID" property="basicCategoryId" /> <!-- 文章所属主栏目id -->
<result column="BASIC_SORT" property="basicSort" />
<result column="BASIC_DISPLAY" property="basicDisplay" />
<!-- 一对一关联栏目 -->
<association property="column" column="COLUMN_CATEGORY_ID"
javaType="net.mingsoft.basic.entity.ColumnEntity">
<result property="columnPath" column="column_path" />
<result property="categoryTitle" column="category_title" />
<result property="categoryId" column="category_id" />
<result property="columnContentModelId" column="COLUMN_CM_ID" />
<result property="columnType" column="COLUMN_TYPE" />
</association>
</resultMap>
<!-- 获取表字段 结束 -->
<!-- 通过视图查询返回结果集 开始 -->
<resultMap type="net.mingsoft.cms.bean.ColumnArticleIdBean" id="resultMapBean">
<result column="ARTICLE_BASICID" property="articleId" />
<result column="column_path" property="columnPath"/>
<result column="column_url" property="columnUrl" />
<result column="column_listurl" property="columnListUrl" />
<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>
<!-- 通过视图查询返回结果集 结束 -->
<!-- 通过视图查询返回结果集 开始 -->
<resultMap type="net.mingsoft.cms.entity.ArticleEntity" id="viewResultMap">
<id column="ARTICLE_BASICID" property="articleID" /> <!-- 与cms_article表绑定id -->
<result column="ARTICLE_CONTENT" property="articleContent" /> <!-- 文章内容 -->
<result column="ARTICLE_AUTHOR" property="articleAuthor" /> <!-- 文章作者 -->
<result column="ARTICLE_TYPE" property="articleType" /> <!-- 文章属性 -->
<result column="ARTICLE_SOURCE" property="articleSource" /> <!-- 文章来源 -->
<result column="ARTICLE_URL" property="articleUrl" /> <!-- 文章跳转链接地址 -->
<result column="ARTICLE_KEYWORD" property="articleKeyword" /> <!-- 文章关键字 -->
<result column="ARTICLE_FREEORDER" property="articleFreeOrder" /><!--
文章自定义显示顺序 -->
<result column="ARTICLE_WEBID" property="articleWebId" /> <!-- 站点id -->
<result column="BASIC_ID" property="basicId" /> <!-- 与表basic绑定 自增长ID -->
<result column="BASIC_TITLE" property="basicTitle" /> <!-- 文章标题 -->
<result column="BASIC_DESCRIPTION" property="basicDescription" /><!--
文章描述 -->
<result column="BASIC_THUMBNAILS" property="basicThumbnails" /> <!-- 文章缩略图 -->
<result column="BASIC_HIT" property="basicHit" /> <!-- 文章点击次数 -->
<result column="BASIC_DATETIME" property="basicDateTime" /> <!-- 文章发布时间 -->
<result column="BASIC_UPDATETIME" property="basicUpdateTime" /> <!-- 文章更新时间 -->
<result column="BASIC_CATEGORYID" property="basicCategoryId" /> <!-- 文章所属主栏目id -->
<result column="BASIC_SORT" property="basicSort" />
<result column="BASIC_DISPLAY" property="basicDisplay" />
<!-- 一对一关联栏目 -->
<association property="column"
javaType="net.mingsoft.basic.entity.ColumnEntity">
<result property="columnPath" column="column_path" />
<result property="categoryTitle" column="category_title" />
<result property="categoryId" column="category_id" />
<result property="columnContentModelId" column="COLUMN_CM_ID" />
<result property="columnType" column="COLUMN_TYPE" />
</association>
</resultMap>
<!-- 通过视图查询返回结果集 结束 -->
<!-- 文章bean返回数据列表 开始 -->
<sql id="bean_column_list">
BASIC_ID,ARTICLE_AUTHOR,ARTICLE_TYPE,ARTICLE_SOURCE,ARTICLE_URL,ARTICLE_KEYWORD,ARTICLE_FREEORDER,
BASIC_DISPLAY,BASIC_TITLE,BASIC_DESCRIPTION,BASIC_THUMBNAILS,BASIC_HIT,BASIC_DATETIME,BASIC_UPDATETIME,BASIC_PEOPLEID,BASIC_CATEGORYID,BASIC_SORT
</sql>
<!-- 表栏目名结束 -->
<!-- 文章基础数据返回数据列表 开始 -->
<sql id="basic_data_list">
BASIC_DISPLAY,BASIC_ID,BASIC_CATEGORYID,BASIC_TITLE,BASIC_DESCRIPTION,BASIC_THUMBNAILS,BASIC_HIT,BASIC_DATETIME,BASIC_UPDATETIME,BASIC_PEOPLEID,BASIC_SORT,
ARTICLE_BASICID,ARTICLE_AUTHOR,ARTICLE_CONTENT,ARTICLE_TYPE,ARTICLE_SOURCE,ARTICLE_URL,ARTICLE_KEYWORD,ARTICLE_FREEORDER,ARTICLE_WEBID,
COLUMN_KEYWORD,COLUMN_DESCRIP,COLUMN_TYPE,COLUMN_URL,COLUMN_LISTURL,COLUMN_PATH,COLUMN_CM_ID,COLUMN_CATEGORY_ID,
CATEGORY_TITLE,CATEGORY_APPID,CATEGORY_ID
</sql>
<!-- 文章基础数据返回数据列表结束 -->
<!-- 添加文章信息 开始 -->
<insert id="saveEntity" parameterType="net.mingsoft.base.entity.BaseEntity">
insert into cms_article
<!-- 添加表字段 -->
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="basicId != null">ARTICLE_BASICID,</if>
<if test="articleContent != null">ARTICLE_CONTENT,</if>
<if test="articleAuthor != null">ARTICLE_AUTHOR,</if>
<if test="articleType != null">ARTICLE_TYPE,</if>
<if test="articleSource != null">ARTICLE_SOURCE,</if>
<if test="articleUrl != null">ARTICLE_URL,</if>
<if test="articleKeyword != null">ARTICLE_KEYWORD,</if>
<if test="articleFreeOrder != null">ARTICLE_FREEORDER,</if>
<if test="articleWebId != null">ARTICLE_WEBID,</if>
</trim>
<!-- 注入控制层字段 -->
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="basicId != null">#{basicId},</if>
<if test="articleContent != null">#{articleContent},</if>
<if test="articleAuthor != null">#{articleAuthor},</if>
<if test="articleType != null">#{articleType},</if>
<if test="articleSource != null">#{articleSource},</if>
<if test="articleUrl != null">#{articleUrl},</if>
<if test="articleKeyword != null">#{articleKeyword},</if>
<if test="articleFreeOrder != null">#{articleFreeOrder},</if>
<if test="articleWebId != null">#{articleWebId},</if>
</trim>
</insert>
<!-- 添加文章信息 结束 -->
<!-- 删除文章管理的信息 开始 -->
<delete id="deleteEntity" parameterType="int">
DELETE b from basic b WHERE b.basic_id=#{basicId};
DELETE c from cms_article c WHERE c.article_basicid=#{basicId}
</delete>
<!-- 删除文章管理的信息 结束 -->
<!-- 更新文章管理的信息 开始 -->
<update id="updateEntity" parameterType="net.mingsoft.base.entity.BaseEntity">
update cms_article
<set>
<if test="articleContent != null">ARTICLE_CONTENT=#{articleContent},</if>
<if test="articleAuthor != null">ARTICLE_AUTHOR=#{articleAuthor},</if>
<if test="articleType != null">ARTICLE_TYPE=#{articleType},</if>
<if test="articleSource != null">ARTICLE_SOURCE=#{articleSource},</if>
<if test="articleUrl != null">ARTICLE_URL=#{articleUrl},</if>
<if test="articleKeyword != null">ARTICLE_KEYWORD=#{articleKeyword},</if>
<if test="articleFreeOrder != null">ARTICLE_FREEORDER=#{articleFreeOrder},</if>
<if test="articleWebId != null">ARTICLE_WEBID=#{articleWebId},</if>
</set>
where ARTICLE_BASICID = #{basicId}
</update>
<!-- 更新文章管理的信息 开始 -->
<!-- 查找文章管理的信息 开始 -->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select
<include refid="column_list" />
,c.CATEGORY_TITLE,cl.column_path,cl.column_type,c.CATEGORY_id,cl.COLUMN_CM_ID
FROM
basic b
LEFT JOIN
category c ON b.BASIC_CATEGORYID = c.CATEGORY_ID
LEFT JOIN basic_column
cl ON c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
LEFT
JOIN cms_article a ON
a.ARTICLE_BASICID = b.BASIC_ID
<!-- 查询与关联表id相同的信息 -->
where a.ARTICLE_BASICID=#{basicId}
</select>
<!-- 查找文章管理的信息 结束 -->
<!-- 标题字段query -->
<sql id="queryWhereBasicTitle" databaseId="mysql">
CONCAT('%',#{article.basicTitle},'%')
</sql>
<sql id="queryWhereBasicTitle" databaseId="oracle">
'%'||#{ article.basicTitle}||'%'
</sql>
<sql id="queryWhereBasicTitle" databaseId="sqlServer">
'%'+#{ article.basicTitle}+'%'
</sql>
<!-- flag字段 -->
<sql id="queryWhereFlag" databaseId="mysql">
CONCAT('%',#{flag},'%')
</sql>
<sql id="queryWhereFlag" databaseId="oracle">
'%'||#{ flag}||'%'
</sql>
<sql id="queryWhereFlag" databaseId="sqlServer">
'%'+#{ flag}+'%'
</sql>
<!-- noFlag字段 -->
<sql id="queryWhereNoFlag" databaseId="mysql">
CONCAT('%',#{noFlag},'%')
</sql>
<sql id="queryWhereNoFlag" databaseId="oracle">
'%'||#{ noFlag}||'%'
</sql>
<sql id="queryWhereNoFlag" databaseId="sqlServer">
'%'+#{ noFlag}+'%'
</sql>
<!-- 已过期 -->
<select id="count" resultType="int">
select count(basic_id) FROM basic b
LEFT JOIN category c ON
b.BASIC_CATEGORYID = c.CATEGORY_ID
LEFT JOIN basic_column cl ON
c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
LEFT JOIN cms_article a ON
a.ARTICLE_BASICID = b.BASIC_ID
<where>
a.ARTICLE_WEBID = #{webId}
<if test="article != null ">
<if test="article.basicTitle != null and article.basicTitle != ''">
and b.BASIC_TITLE like
<include refid="queryWhereBasicTitle"></include>
</if>
</if>
<if test="basicCategoryIds != null">
and b.BASIC_CATEGORYID in
<foreach collection="basicCategoryIds" index="index" item="categoryId"
open="(" separator="," close=")">
#{categoryId}
</foreach>
</if>
<if test="flag != null">
and a.ARTICLE_TYPE like <include refid="queryWhereFlag"></include>
</if>
<if test="noFlag != null">
and a.ARTICLE_TYPE not like <include refid="queryWhereNoFlag"></include>
</if>
</where>
</select>
<!-- 列表查询结束 -->
<!-- 列表查询开始 -->
<select id="query" resultMap="resultMap" >
select
<include refid="column_list" />
,c.CATEGORY_TITLE,c.CATEGORY_ID
,cl.COLUMN_PATH,cl.COLUMN_CM_ID,cl.COLUMN_TYPE,cl.COLUMN_CATEGORY_ID
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
where a.ARTICLE_WEBID = #{webId}
<if test="article != null ">
<if test="article.basicTitle != null and article.basicTitle != ''">
and b.BASIC_TITLE like
<include refid="queryWhereBasicTitle"></include>
</if>
</if>
<if test="basicCategoryIds != null">
and b.BASIC_CATEGORYID in
<foreach collection="basicCategoryIds" index="index" item="categoryId"
open="(" separator="," close=")">
#{categoryId}
</foreach>
</if>
<if test="flag != null">
and a.ARTICLE_TYPE like <include refid="queryWhereFlag"></include>
</if>
<if test="noFlag != null">
and a.ARTICLE_TYPE not like <include refid="queryWhereNoFlag"></include>
</if>
<if test="article !=null and article.basicDisplay &gt; -1">
and b.basic_display = #{article.basicDisplay}
</if>
<if test="beginTime!=null and beginTime!=''">
and basic_updatetime &gt;= #{beginTime}
</if>
<if test="endTime!=null and endTime!=''">
and basic_updatetime &gt;= #{endTime}
</if>
<if test="orderBy != null">
order by
<choose>
<when test='orderBy=="sort"'>basic_sort</when>
<when test='orderBy=="date"'>basic_datetime</when>
<when test='orderBy=="hit"'>basic_hit</when>
<when test='orderBy=="updatedate"'>basic_updatedate</when>
<when test='orderBy=="id"'>basic_id</when>
<otherwise>
${orderBy}
</otherwise>
</choose>
</if>
<if test="orderBy==null">
order by b.basic_id
</if>
<if test="order == true">desc</if>
<if test="order == false">asc</if>
</select>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${categoryId}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${categoryId}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${categoryId}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select id="queryIdsByCategoryIdForParser" resultMap="resultMapBean" >
select
ARTICLE_BASICID,cl.*,c.*
FROM cms_article a LEFT JOIN basic ON a.ARTICLE_BASICID = basic.BASIC_ID
LEFT JOIN basic_column cl ON basic.BASIC_CATEGORYID = cl.COLUMN_CATEGORY_ID
JOIN category c ON c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
where
<if test="appId &gt; 0">
a.ARTICLE_WEBID = #{appId}
</if>
<!-- 查询子栏目数据 -->
<if test="categoryId &gt; 0">
and (basic.basic_categoryid=#{categoryId} or basic.basic_categoryid in
(select category_id FROM category where <include refid="queryWhereCategoryId"></include>))
</if>
<if test="beginTime!=null and beginTime!=''">
and basic.basic_updatetime &gt;= #{beginTime}
</if>
<if test="endTime!=null and endTime!=''">
and basic.basic_updatetime &gt;= #{endTime}
</if>
<if test="orderBy!=null and order!=null and orderBy!='' and order!=''">
ORDER BY `${orderBy}` ${order}
</if>
</select>
<!--查询页面栏目的文章 开始 -->
<!-- 已过期 -->
<select id="queryListByColumnId" resultMap="resultMap">
select
<include refid="column_list" />
from cms_article a left join basic b on b.basic_id=a.ARTICLE_BASICID
where b.BASIC_CATEGORYID = #{basicCategoryId}
</select>
<!-- 查询页面栏目的文章 结束 -->
<!-- 根据字段条件查找文章实体开始 -->
<sql id="queryLike" databaseId="mysql">
like CONCAT("%",
<foreach item="val" index="index" collection="item[3]">
<if test="index==0">#{val}</if>
</foreach>
,"%")
</sql>
<sql id="queryLike" databaseId="oracle">
like '%'||
<foreach item="val" index="index" collection="item[3]">
<if test="index==0">#{val}</if>
</foreach>
||'%'
</sql>
<sql id="queryLike" databaseId="sqlServer">
like '%'+
<foreach item="val" index="index" collection="item[3]">
<if test="index==0">#{val}</if>
</foreach>
+'%'
</sql>
<!-- 已过期 -->
<select id="queryListForSearch" resultMap="resultMap">
select
<include refid="column_list" />
,c.CATEGORY_TITLE,cl.column_path,c.CATEGORY_id,cl.COLUMN_CM_ID,cl.column_type
from cms_article a
left join basic b
on b.basic_id=a.ARTICLE_BASICID
left join category c
ON b.BASIC_CATEGORYID = c.CATEGORY_ID
left join
basic_column cl
on c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
<if test="tableName!=null">left join ${tableName} d on d.basicId=a.ARTICLE_BASICID
</if>
where c.DEL=0 and a.ARTICLE_WEBID = #{websiteId}
<if test="ids!=null">
and
b.BASIC_CATEGORYID in
<foreach item="id" index="key" collection="ids" open="("
separator="," close=")">
#{id.categoryId}
</foreach>
</if>
<foreach item="item" index="key" collection="map" open=""
separator="" close="">
<if test=" item[0] == false">
and ${key}
</if>
<if test="item[0]== true">
and d.${key}
</if>
<!-- 数字类型的查找 item[1]:字段是否为数字类型false:数字 -->
<if test="item[1] == false">
<!--item[2]: 是采用等值还是区间查询。false:区间 itme[3][0]第一个值item[3][1]的二个值 -->
<if test="item[2] == true">
=
<foreach item="val" index="index" collection="item[3]">#{val}
</foreach>
</if>
<if test="item[2] == false">
between
<foreach item="val" index="index" collection="item[3]"
separator="and">
#{val}
</foreach>
</if>
</if>
<!-- 字符型数据的查找 item[1]:字段是否为数字类型true:字符串 -->
<if test="item[1] == true">
<!--item[2]: 是采用模糊查询。false:不采用模糊 -->
<if test="item[2] == true">
<include refid="queryLike"></include>
</if>
<if test="item[2] == false">
=
<foreach item="val" index="index" collection="item[3]">#{val}
</foreach>
</if>
</if>
</foreach>
<if test="sortMap!=null">
order by ${sortMap.order} ${sortMap.by}
</if>
</select>
<!-- 根据字段条件查找文章实体结束 -->
<!--已过期 根据字段条件查找文章实体总数开始 -->
<select id="getSearchCount" resultType="int">
select count(*) from
cms_article a
left join basic b
on
b.basic_id=a.ARTICLE_BASICID
left join category c
ON b.BASIC_CATEGORYID
= c.CATEGORY_ID
left join basic_column cl
on c.CATEGORY_ID =
cl.COLUMN_CATEGORY_ID
<if test="tableName!=null and tableName!=''">left join ${tableName} d on d.basicId=a.ARTICLE_BASICID
</if>
where a.ARTICLE_WEBID = #{websiteId}
<if test="ids!=null and ids!=''">
and FIND_IN_SET(category_categoryid,'${ids}')
</if>
<foreach item="item" index="key" collection="map" open=""
separator="" close="">
<if test=" item[0] == false">
and ${key}
</if>
<if test="item[0]== true">
and d.${key}
</if>
<!-- 数字类型的查找 item[1]:字段是否为数字类型false:数字 -->
<if test="item[1] == false">
<!--item[2]: 是采用等值还是区间查询。false:区间 itme[3][0]第一个值item[3][1]的二个值 -->
<if test="item[2] == true">
=
<foreach item="val" index="index" collection="item[3]">#{val}
</foreach>
</if>
<if test="item[2] == false">
between
<foreach item="val" index="index" collection="item[3]"
separator="and">
#{val}
</foreach>
</if>
</if>
<!-- 字符型数据的查找 item[1]:字段是否为数字类型true:字符串 -->
<if test="item[1] == true">
<!--item[2]: 是采用模糊查询。false:不采用模糊 -->
<if test="item[2] == true">
<include refid="queryLike"></include>
</if>
<if test="item[2] == false">
=
<foreach item="val" index="index" collection="item[3]">#{val}
</foreach>
</if>
</if>
</foreach>
</select>
<!-- 根据字段条件查找文章实体总数结束 -->
<select id="getById" resultMap="viewResultMap">
select
<include refid="basic_data_list" />
from
(((basic JOIN cms_article ON (BASIC_ID = ARTICLE_BASICID))
JOIN basic_column ON (BASIC_CATEGORYID = COLUMN_CATEGORY_ID))
JOIN category ON (COLUMN_CATEGORY_ID = CATEGORY_ID))
<if test="contentModelTableName!=null">
left join ${contentModelTableName} cmt on
cmt.basicid=basic_id
</if>
where basic_id=#{basicId}
</select>
<!-- 通过文章标题、应用ID、模块编号来查询文章集合开始 -->
<resultMap type="java.util.HashMap" id="resultTitleMap">
<result column="basic_id" property="basicId" />
<result column="basic_title" property="basicTitle" />
<result column="basic_hit" property="basicHit" />
<result column="basic_categoryid" property="basicCategoryId" />
<result column="model_id" property="modelId" />
</resultMap>
<!-- 已过期 -->
<!-- 查找上一篇下一篇 -->
<sql id="selectOne">
from
(((basic JOIN cms_article ON (BASIC_ID = ARTICLE_BASICID))
JOIN basic_column ON (BASIC_CATEGORYID = COLUMN_CATEGORY_ID))
JOIN category ON (COLUMN_CATEGORY_ID = CATEGORY_ID))
where category_appid=#{appId}
<if test="flag==false">
and basic_id &lt; ${basicId}
</if>
<if test="flag==true">
and basic_id &gt; ${basicId}
</if>
<if test="categoryId!=null">
and BASIC_CATEGORYID = #{categoryId}
</if>
</sql>
<!-- 已过期 -->
<select id="getNextOrPrevious" resultMap="resultMap" databaseId="mysql">
select
<include refid="basic_data_list" />
<include refid="selectOne"></include>
<if test="flag==false">
order by basic_id desc
</if>
<if test="flag==true">
order by basic_id asc
</if>
limit 0,1
</select>
<!-- 已过期 -->
<select id="getNextOrPrevious" resultMap="resultMap" databaseId="oracle">
select
<include refid="basic_data_list" />
<include refid="selectOne"></include>
and rownum=1
<if test="flag==false">
order by basic_id desc
</if>
<if test="flag==true">
order by basic_id asc
</if>
</select>
<!-- 已过期 -->
<select id="getNextOrPrevious" resultMap="resultMap" databaseId="sqlServer">
select top(1)
<include refid="basic_data_list" />
<include refid="selectOne"></include>
<if test="flag==false">
order by basic_id desc
</if>
<if test="flag==true">
order by basic_id asc
</if>
</select>
<sql id="queryTime" databaseId="oracle">
to_date(#{dateTime},'yyyy-MM-dd HH24:mi:ss')
</sql>
<sql id="queryTime" databaseId="mysql">
#{dateTime}
</sql>
<sql id="queryTime" databaseId="sqlServer">
#{dateTime}
</sql>
<!-- 已过期 -->
<select id="getByCategoryId" resultMap="resultMap">
select
<include refid="basic_data_list" />
from
(((basic JOIN cms_article ON (BASIC_ID = ARTICLE_BASICID))
JOIN basic_column ON (BASIC_CATEGORYID = COLUMN_CATEGORY_ID))
JOIN category ON (COLUMN_CATEGORY_ID = CATEGORY_ID))
where basic_categoryId=#{categoryId} order by basic_id desc
</select>
<!-- 根据basicID删除开始 -->
<delete id="delete">
delete from cms_article
<where>
ARTICLE_BASICID in
<foreach collection="ids" item="item" index="index" open="("
separator="," close=")">#{item}</foreach>
</where>
</delete>
</mapper>
\ No newline at end of file
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao {
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public List<net.mingsoft.cms.entity.CategoryEntity> queryChildren(CategoryEntity category);
}
\ No newline at end of file
<?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_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="category_manager_id" property="categoryManagerId" /><!--发布用户id -->
<result column="app_id" property="appId" /><!--应用编号 -->
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="category_parent_id" property="categoryParentId" /><!--父类型编号 -->
<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="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="categoryManagerId != null">category_manager_id,</if>
<if test="appId != null">app_id,</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="categoryParentId != null and categoryParentId != ''">category_parent_id,</if>
<if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 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="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="categoryManagerId != null">#{categoryManagerId},</if>
<if test="appId != null">#{appId},</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 &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 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>
category_id=#{categoryId},
category_parent_id=#{categoryParentId},
<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="categoryManagerId != null">category_manager_id=#{categoryManagerId},</if>
<if test="appId != null">app_id=#{appId},</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 &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 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="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="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
<if test="appId != null"> and app_id=#{appId} </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="categoryParentId != null and categoryParentId != ''">and category_parent_id=#{categoryParentId}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 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>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${id}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${id}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${id}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap">
select * from cms_category
<where>
<if test="appId &gt; 0">
and app_id=#{appId}
</if>
<if test="dictId &gt; 0">
and dict_id=#{dictId}
</if>
and
(
<if test="categoryParentId != null and categoryParentId!=''">
find_in_set(#{categoryParentId},CATEGORY_PARENT_ID)
</if>
<if test="categoryParentId == null or categoryParentId ==''">
<include refid="queryWhereCategoryId"></include>
</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="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="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
<if test="appId != null"> and app_id=#{appId} </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="categoryParentId != null and categoryParentId != ''"> and category_parent_id=#{categoryParentId}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 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>
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
<?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="hl_people_id" property="hlPeopleId" /><!--用户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="hlPeopleId != null and hlPeopleId != ''">hl_people_id,</if>
<if test="hlIsMobile != null">hl_is_mobile,</if>
<if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 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="hlPeopleId != null and hlPeopleId != ''">#{hlPeopleId},</if>
<if test="hlIsMobile != null">#{hlIsMobile},</if>
<if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 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="hlPeopleId != null and hlPeopleId != ''">hl_people_id=#{hlPeopleId},</if>
<if test="hlIsMobile != null">hl_is_mobile=#{hlIsMobile},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 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="hlPeopleId != null and hlPeopleId != ''">and hl_people_id=#{hlPeopleId}</if>
<if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 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="hlPeopleId != null and hlPeopleId != ''"> and hl_people_id=#{hlPeopleId}</if>
<if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 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
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.cms.bean.ContentBean;
import org.apache.ibatis.annotations.Param;
/**
* 文章持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface IContentDao extends IBaseDao {
/**
* 查询文章编号集合
* @param categoryId 栏目编号
* @param appId 站点编号
* @param beginTime 开始时间
* @param endTime 结束时间
* @return
*/
public List<ContentBean> 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);
/**
* 根据查询文章实体总数
*
* @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);
}
\ No newline at end of file
<?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="content_category_id" property="contentCategoryId" /><!--所属栏目 -->
<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="app_id" property="appId" /><!--文章管理的应用id -->
<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.ContentBean">
<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="category_manager_id" property="categoryManagerId" /><!--发布用户id -->
<result column="app_id" property="appId" /><!--应用编号 -->
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="category_parent_id" property="categoryParentId" /><!--父类型编号 -->
<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="contentCategoryId != null and contentCategoryId != ''">content_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="appId != null">app_id,</if>
<if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 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="contentCategoryId != null and contentCategoryId != ''">#{contentCategoryId},</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="appId != null">#{appId},</if>
<if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 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="contentCategoryId != null and contentCategoryId != ''">content_category_id=#{contentCategoryId},</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="appId != null">app_id=#{appId},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 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}
</select>
<!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.ContentEntity">
select * from cms_content
<where>
<if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT('%',#{contentTitle},'%')</if>
<if test="contentCategoryId != null and contentCategoryId != ''">and content_category_id=#{contentCategoryId}</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="appId != null"> and app_id=#{appId} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 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_content where id=#{id}
</delete>
<!--批量删除-->
<delete id="delete" >
delete from cms_content
<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 order by id desc
</select>
<!--条件查询-->
<select id="query" resultMap="resultMap">
select ct.* from cms_content ct join cms_category cc on ct.content_category_id=cc.id
<where>
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT('%',#{contentTitle},'%')</if>
<if test="contentCategoryId != null and contentCategoryId != ''"> and content_category_id=#{contentCategoryId}</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="appId != null"> and ct.app_id=#{appId} </if>
<if test="createBy &gt; 0"> and ct.create_by=#{createBy} </if>
<if test="createDate != null"> and ct.create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and ct.update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and ct.del=#{del} </if>
<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
</where>
order by id desc
</select>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${categoryId}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${categoryId}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${categoryId}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select id="queryIdsByCategoryIdForParser" resultMap="resultBean">
select
cms_content.id article_id,c.*
FROM cms_content
LEFT JOIN cms_category c ON content_category_id = c.id
where
<if test="appId &gt; 0">
cms_content.app_id = #{appId}
</if>
<!-- 查询子栏目数据 -->
<if test="categoryId &gt; 0">
and (content_category_id=#{categoryId} or content_category_id in
(select id FROM cms_category where <include refid="queryWhereCategoryId"></include>))
</if>
<if test="beginTime!=null and beginTime!=''">
and content_datetime &gt;= #{beginTime}
</if>
<if test="endTime!=null and endTime!=''">
and content_datetime &gt;= #{endTime}
</if>
<if test="orderBy!=null and order!=null and orderBy!='' and order!=''">
ORDER BY `${orderBy}` ${order}
</if>
</select>
<select id="getSearchCount" resultType="int">
select count(*) from
cms_content a
left join cms_category c
ON a.content_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.app_id = #{websiteId}
<if test="ids!=null and ids!=''">
and FIND_IN_SET(content_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 a.content_type like CONCAT("%",'${map.content_type}',"%")
</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="tableName!=null and tableName!='' and diyMap!=null">
<foreach item="item" index="index" collection="diyList" open=""
separator="" close="">
and d.${item.key} like CONCAT("%",'${item.value}',"%")
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.entity;
import java.io.File;
import java.util.Arrays;
import net.mingsoft.basic.entity.AppEntity;
import net.mingsoft.basic.entity.BasicEntity;
import net.mingsoft.basic.entity.ColumnEntity;
import org.apache.commons.lang3.StringUtils;
import cn.hutool.core.util.ArrayUtil;
import net.mingsoft.base.constant.Const;
import net.mingsoft.mdiy.util.ParserUtil;
/**
*
* @ClassName: ArticleEntity
* @Description:TODO(文章模块实体类 || 继承BasicEntity实体)
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:55:48
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
public class ArticleEntity extends BasicEntity{
/**
* 文章Id
*/
private int articleID;
/**
* 文章内容
*/
private String articleContent;
/**
* 文章作者
*/
private String articleAuthor;
/**
* 文章属性
*/
private String articleType ;
/**
* 文章的来源
*/
private String articleSource;
/**
* 文章跳转链接地址
*/
private String articleUrl;
/**
* 文章关键字
*/
private String articleKeyword;
/**
* 文章自定义显示顺序
*/
@Deprecated
private int articleFreeOrder;
/**
* 站点d
*/
private int articleWebId;
/**
* 文章url地址 主要是用户生成html使用
*/
private String articleLinkURL;
/**
* 文章分类url地址,主要是用户生成html使用
*/
private String articleTypeLinkURL;
/**
* 一对一管理栏目
*/
private ColumnEntity column;
/**
* 获取文章实体所属的栏目实体
* @return
*/
public ColumnEntity getColumn() {
return column;
}
/**
* 设置文章所属的栏目实体
* @param column
*/
public void setColumn(ColumnEntity column) {
this.column = column;
}
public String getArticleTypeLinkURL() {
return articleTypeLinkURL;
}
public void setArticleTypeLinkURL(String articleTypeLinkURL) {
this.articleTypeLinkURL = articleTypeLinkURL;
}
public String getArticleLinkURL() {
return articleLinkURL;
}
public void setArticleLinkURL(String articleLinkURL) {
this.articleLinkURL = articleLinkURL;
}
/**
* 获取文章作者
* @return 返回文章作者
*/
public String getArticleAuthor() {
return articleAuthor;
}
/**
* 获取文章内容
* @return 返回文章内容
*/
public String getArticleContent() {
return articleContent;
}
/**
* 获取自定义显示顺序
* @return
*/
public int getArticleFreeOrder() {
return articleFreeOrder;
}
/**
* 获取文章Id
* @return 返回文章Id
*/
public int getArticleID() {
return articleID;
}
/**
* 获取文章关键字
* @return 返回文章关键字
*/
public String getArticleKeyword() {
return articleKeyword;
}
/**
* 获取文章的来源
* @return 返回文章的来源
*/
public String getArticleSource() {
return articleSource;
}
/**
* 获取文章属性
* @return 返回文章属性
*/
public String getArticleType() {
return articleType;
}
/**
* 获取文章跳转链接
* @return 返回文章跳转链接
*/
public String getArticleUrl() {
return articleUrl;
}
/**
* 获取文章站点id
* @return
*/
public int getArticleWebId() {
return articleWebId;
}
/**
* 设置文章作者
* @param articleAuthor 传入文章作者
*/
public void setArticleAuthor(String articleAuthor) {
this.articleAuthor = articleAuthor;
}
/**
* 设置文章内容
* @param articleContent 传入文章内容
*/
public void setArticleContent(String articleContent) {
this.articleContent = articleContent;
}
/**
* 设置文章自定义显示循序排序
* @param articleFreeOrder
*/
public void setArticleFreeOrder(int articleFreeOrder) {
this.articleFreeOrder = articleFreeOrder;
}
/**
* 设置文章Id
* @param articleID 传入文章Id
*/
public void setArticleID(int articleID) {
this.articleID = articleID;
}
/**
* 设置文章关键字
* @param articleKeyword 传入文章关键字列表
*/
public void setArticleKeyword(String articleKeyword) {
this.articleKeyword = articleKeyword;
}
/**
* 设置文章的来源
* @param articleSource 传入文章的来源
*/
public void setArticleSource(String articleSource) {
this.articleSource = articleSource;
}
/**
* 设置文章属性
* @param articleType 传入文章属性
*/
public void setArticleType(String articleType) {
this.articleType = articleType;
}
/**
* 设置文章跳转链接
* @param articleUrl 传入文章跳转链接地址
*/
public void setArticleUrl(String articleUrl) {
this.articleUrl = articleUrl;
}
/**
* 设置文章站点id
* @param articleWebId
*/
public void setArticleWebId(int articleWebId) {
this.articleWebId = articleWebId;
}
public String getArticleUrl(AppEntity app) {
if (!StringUtils.isBlank(app.getAppMobileStyle())) {
return app.getAppHostUrl()+ParserUtil.HTML+Const.SEPARATOR+ParserUtil.MOBILE+Const.SEPARATOR+this.getArticleUrl();
}
return app.getAppHostUrl()+Const.SEPARATOR+ParserUtil.HTML+Const.SEPARATOR+this.getArticleUrl();
}
}
\ No newline at end of file
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-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public class CategoryEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152750L;
/**
* 栏目管理名称
*/
private String categoryTitle;
/**
* 所属栏目
*/
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 String 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;
/**
* 发布用户id
*/
private Integer categoryManagerId;
/**
* 应用编号
*/
private Integer appId;
/**
* 字典对应编号
*/
private Integer dictId;
/**
* 栏目属性
*/
private String categoryFlag;
/**
* 栏目路径
*/
private String categoryPath;
/**
* 父类型编号
*/
private String categoryParentId;
/**
* 设置栏目管理名称
*/
public void setCategoryTitle(String categoryTitle) {
this.categoryTitle = categoryTitle;
}
/**
* 获取栏目管理名称
*/
public String getCategoryTitle() {
return this.categoryTitle;
}
/**
* 设置所属栏目
*/
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
/**
* 获取所属栏目
*/
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;
}
/**
* 设置栏目管理的内容模型id
*/
public void setMdiyModelId(String mdiyModelId) {
this.mdiyModelId = mdiyModelId;
}
/**
* 获取栏目管理的内容模型id
*/
public String getMdiyModelId() {
return this.mdiyModelId;
}
/**
* 设置类别发布时间
*/
public void setCategoryDatetime(Date categoryDatetime) {
this.categoryDatetime = categoryDatetime;
}
/**
* 获取类别发布时间
*/
public Date getCategoryDatetime() {
return this.categoryDatetime;
}
/**
* 设置发布用户id
*/
public void setCategoryManagerId(Integer categoryManagerId) {
this.categoryManagerId = categoryManagerId;
}
/**
* 获取发布用户id
*/
public Integer getCategoryManagerId() {
return this.categoryManagerId;
}
/**
* 设置应用编号
*/
public void setAppId(Integer appId) {
this.appId = appId;
}
/**
* 获取应用编号
*/
public Integer getAppId() {
return this.appId;
}
/**
* 设置字典对应编号
*/
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 setCategoryParentId(String categoryParentId) {
this.categoryParentId = categoryParentId;
}
/**
* 获取父类型编号
*/
public String getCategoryParentId() {
return this.categoryParentId;
}
}
\ No newline at end of file
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-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public class ContentEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152617L;
/**
* 文章标题
*/
private String contentTitle;
/**
* 所属栏目
*/
private String contentCategoryId;
/**
* 文章类型
*/
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 appId;
/**
* 点击次数
*/
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 void setContentCategoryId(String contentCategoryId) {
this.contentCategoryId = contentCategoryId;
}
/**
* 获取所属栏目
*/
public String getContentCategoryId() {
return this.contentCategoryId;
}
/**
* 设置文章类型
*/
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;
}
/**
* 设置文章管理的应用id
*/
public void setAppId(Integer appId) {
this.appId = appId;
}
/**
* 获取文章管理的应用id
*/
public Integer getAppId() {
return this.appId;
}
}
\ No newline at end of file
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;
/**
* 用户id
*/
private String hlPeopleId;
/**
* 是否为移动端
*/
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;
}
/**
* 设置用户id
*/
public void setHlPeopleId(String hlPeopleId) {
this.hlPeopleId = hlPeopleId;
}
/**
* 获取用户id
*/
public String getHlPeopleId() {
return this.hlPeopleId;
}
/**
* 设置是否为移动端
*/
public void setHlIsMobile(Boolean hlIsMobile) {
this.hlIsMobile = hlIsMobile;
}
/**
* 获取是否为移动端
*/
public Boolean getHlIsMobile() {
return this.hlIsMobile;
}
}
\ No newline at end of file
#
#Thu Nov 28 15:12:32 CST 2019
category.img=\u7F29\u7565\u56FE
appid=\u6587\u7AE0\u7BA1\u7406\u7684\u5E94\u7528id
content.datetime=\u53D1\u5E03\u65F6\u95F4
category.manager.id=\u53D1\u5E03\u7528\u6237id
category.title=\u680F\u76EE\u7BA1\u7406\u540D\u79F0
category.keyword=\u680F\u76EE\u7BA1\u7406\u5173\u952E\u5B57
content.img=\u6587\u7AE0\u7F29\u7565\u56FE
category.path=\u680F\u76EE\u8DEF\u5F84
content.type=\u6587\u7AE0\u7C7B\u578B
category.url=\u5185\u5BB9\u6A21\u677F
dict.id=\u5B57\u5178\u5BF9\u5E94\u7F16\u53F7
content.author=\u6587\u7AE0\u4F5C\u8005
category.parent.id=\u7236\u7C7B\u578B\u7F16\u53F7
category.datetime=\u7C7B\u522B\u53D1\u5E03\u65F6\u95F4
category.flag=\u680F\u76EE\u5C5E\u6027
content.description=\u63CF\u8FF0
content.url=\u6587\u7AE0\u8DF3\u8F6C\u94FE\u63A5\u5730\u5740
category.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
content.title=\u6587\u7AE0\u6807\u9898
content.category.id=\u6240\u5C5E\u680F\u76EE
id=\u7F16\u53F7
app.id=\u5E94\u7528\u7F16\u53F7
category.list.url=\u5217\u8868\u6A21\u677F
mdiy.model.id=\u680F\u76EE\u7BA1\u7406\u7684\u5185\u5BB9\u6A21\u578Bid
content.source=\u6587\u7AE0\u6765\u6E90
content.display=\u662F\u5426\u663E\u793A
category.type=\u680F\u76EE\u7BA1\u7406\u5C5E\u6027
category.descrip=\u680F\u76EE\u7BA1\u7406\u63CF\u8FF0
content.details=\u6587\u7AE0\u5185\u5BB9
category.id=\u6240\u5C5E\u680F\u76EE
content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
content.keyword=\u5173\u952E\u5B57
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
#mcms\u7248\u672C
version=d3a98fefcb242db78da5fc31608ff247
templet.file=\u6A21\u677F\u6587\u4EF6\u4E0D\u5B58\u5728
id=\u6587\u7AE0\u7F16\u53F7
typeid=\u680F\u76EE\u7F16\u53F7
order=\u6392\u5E8F
#
#Thu Nov 28 15:12:32 CST 2019
category.img=\u7F29\u7565\u56FE
appid=\u6587\u7AE0\u7BA1\u7406\u7684\u5E94\u7528id
content.datetime=\u53D1\u5E03\u65F6\u95F4
category.manager.id=\u53D1\u5E03\u7528\u6237id
category.title=\u680F\u76EE\u7BA1\u7406\u540D\u79F0
category.keyword=\u680F\u76EE\u7BA1\u7406\u5173\u952E\u5B57
content.img=\u6587\u7AE0\u7F29\u7565\u56FE
category.path=\u680F\u76EE\u8DEF\u5F84
content.type=\u6587\u7AE0\u7C7B\u578B
category.url=\u5185\u5BB9\u6A21\u677F
dict.id=\u5B57\u5178\u5BF9\u5E94\u7F16\u53F7
content.author=\u6587\u7AE0\u4F5C\u8005
category.parent.id=\u7236\u7C7B\u578B\u7F16\u53F7
category.datetime=\u7C7B\u522B\u53D1\u5E03\u65F6\u95F4
category.flag=\u680F\u76EE\u5C5E\u6027
content.description=\u63CF\u8FF0
content.url=\u6587\u7AE0\u8DF3\u8F6C\u94FE\u63A5\u5730\u5740
category.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
content.title=\u6587\u7AE0\u6807\u9898
content.category.id=\u6240\u5C5E\u680F\u76EE
id=\u7F16\u53F7
app.id=\u5E94\u7528\u7F16\u53F7
category.list.url=\u5217\u8868\u6A21\u677F
mdiy.model.id=\u680F\u76EE\u7BA1\u7406\u7684\u5185\u5BB9\u6A21\u578Bid
content.source=\u6587\u7AE0\u6765\u6E90
content.display=\u662F\u5426\u663E\u793A
category.type=\u680F\u76EE\u7BA1\u7406\u5C5E\u6027
category.descrip=\u680F\u76EE\u7BA1\u7406\u63CF\u8FF0
content.details=\u6587\u7AE0\u5185\u5BB9
category.id=\u6240\u5C5E\u680F\u76EE
content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
content.keyword=\u5173\u952E\u5B57
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
package net.mingsoft.cms.util;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.PageUtil;
import freemarker.cache.FileTemplateLoader;
......@@ -17,19 +9,33 @@ import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateNotFoundException;
import net.mingsoft.base.constant.Const;
import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.constant.e.ColumnTypeEnum;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.biz.IContentModelBiz;
import net.mingsoft.mdiy.entity.ContentModelEntity;
import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.biz.impl.ModelBizImpl;
import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.parser.TagParser;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CmsParserUtil extends ParserUtil {
/**
* 封面
*/
private static int COLUMN_TYPE_COVER = 2;
/**
* 指定模板,指定路径进行生成静态页面,会自定识别pc与移动端
*
......@@ -42,9 +48,8 @@ public class CmsParserUtil extends ParserUtil {
public static void generate(String templatePath, String targetPath) throws IOException {
Map<String, Object> map = new HashMap<String, Object>();
map.put(IS_DO, false);
ColumnEntity column = new ColumnEntity();
CategoryEntity column = new CategoryEntity();
//内容管理栏目编码
column.setCategoryModelId(BasicUtil.getModelCodeId("02990000"));
map.put(COLUMN, column);
String content = CmsParserUtil.generate(templatePath, map, false);
FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8);
......@@ -67,7 +72,7 @@ public class CmsParserUtil extends ParserUtil {
* @throws ParseException
* @throws IOException
*/
public static void generateList(ColumnEntity column, int articleIdTotal)
public static void generateList(CategoryEntity column, int articleIdTotal)
throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
// 只初始化一次cfg
if (ftl == null) {
......@@ -75,13 +80,13 @@ public class CmsParserUtil extends ParserUtil {
cfg.setTemplateLoader(ftl);
}
// 移动端模板
try{
Template mobileTemplate = cfg.getTemplate(
BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getColumnListUrl(), Const.UTF8);
BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getCategoryListUrl(), Const.UTF8);
// pc端模板
Template template = cfg.getTemplate(File.separator + column.getColumnListUrl(), Const.UTF8);
Template template = cfg.getTemplate(File.separator + column.getCategoryListUrl(), Const.UTF8);
// 文章的栏目模型编号
int columnContentModelId = column.getColumnContentModelId();
String columnContentModelId = column.getMdiyModelId();
StringWriter writer = new StringWriter();
try {
// 为了分页添加column,判断栏目是否为父栏目
......@@ -94,11 +99,11 @@ public class CmsParserUtil extends ParserUtil {
String columnListPath;
String mobilePath;
ContentModelEntity contentModel = null;
ModelEntity contentModel = null;
// 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) {
if (StringUtils.isNotBlank(columnContentModelId)) {
// 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class).getEntity(columnContentModelId);
contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId));
}
int pageNo = 1;
PageBean page = new PageBean();
......@@ -112,7 +117,7 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(APP_ID, BasicUtil.getAppId());
if (contentModel!=null) {
// 将自定义模型编号设置为key值
parserParams.put(TABLE_NAME, contentModel.getCmTableName());
parserParams.put(TABLE_NAME, contentModel.getModelTableName());
}
//如果单站点,就废弃站点地址
if(ParserUtil.IS_SINGLE) {
......@@ -123,15 +128,15 @@ public class CmsParserUtil extends ParserUtil {
if (totalPageSize <= 0) {
// 数据库中第一页是从开始0*size
// 首页路径index.html
mobilePath = ParserUtil.buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX);
columnListPath = ParserUtil.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX);
mobilePath = ParserUtil.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
// 设置分页的起始位置
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())) {
if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) {
writer = new StringWriter();
mobileTemplate.process(null, writer);
tag = new TagParser(writer.toString(), parserParams);
......@@ -146,15 +151,15 @@ public class CmsParserUtil extends ParserUtil {
// 数据库中第一页是从开始0*size
// 首页路径index.html
mobilePath = ParserUtil
.buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX);
.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
columnListPath = ParserUtil
.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX);
.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
} else {
// 其他路径list-2.html
mobilePath = ParserUtil.buildMobileHtmlPath(
column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
columnListPath = ParserUtil
.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo);
}
// 设置分页的起始位置
page.setPageNo(pageNo);
......@@ -162,7 +167,7 @@ public class CmsParserUtil extends ParserUtil {
TagParser tag = new TagParser(content,parserParams);
FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8);
// 判断是手机端生成还是pc端,防止重复生成
if (ParserUtil.hasMobileFile(column.getColumnListUrl())) {
if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) {
writer = new StringWriter();
mobileTemplate.process(null, writer);
tag = new TagParser(writer.toString(),parserParams);
......@@ -176,6 +181,9 @@ public class CmsParserUtil extends ParserUtil {
} catch (TemplateException e) {
e.printStackTrace();
}
}catch (TemplateNotFoundException e){
e.printStackTrace();
}
}
/**
......@@ -189,11 +197,11 @@ public class CmsParserUtil extends ParserUtil {
* @throws MalformedTemplateNameException
* @throws TemplateNotFoundException
*/
public static void generateBasic(List<ColumnArticleIdBean> articleIdList)
public static void generateBasic(List<ContentBean> articleIdList)
throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
ContentModelEntity contentModel = null;
ModelEntity contentModel = null;
String writePath = null;
// 记录已经生成了文章编号
List<Integer> generateIds = new ArrayList<>();
......@@ -204,11 +212,14 @@ public class CmsParserUtil extends ParserUtil {
// 文章编号
int articleId = articleIdList.get(artId).getArticleId();
// 文章的栏目路径
String articleColumnPath = articleIdList.get(artId).getColumnPath();
String articleColumnPath = articleIdList.get(artId).getCategoryPath();
// 文章的模板路径
String columnUrl = articleIdList.get(artId).getColumnUrl();
String columnUrl = articleIdList.get(artId).getCategoryUrl();
// 文章的栏目模型编号
int columnContentModelId = articleIdList.get(artId).getColumnContentModelId();
String columnContentModelId = "";
if(StringUtils.isNotBlank(articleIdList.get(artId).getMdiyModelId()) && Integer.parseInt(articleIdList.get(artId).getMdiyModelId())>0){
columnContentModelId = articleIdList.get(artId).getMdiyModelId();
}
// 文章是否已经生成了,生成了就跳过
if (generateIds.contains(articleId)) {
artId++;
......@@ -216,7 +227,7 @@ public class CmsParserUtil extends ParserUtil {
}
// 判断文件是否存在,若不存在弹出返回信息
if (!FileUtil.exist(ParserUtil.buildTempletPath(columnUrl))) {
if (!FileUtil.exist(ParserUtil.buildTempletPath(columnUrl))||StringUtils.isBlank(articleIdList.get(artId).getCategoryId())||articleIdList.get(artId).getCategoryType()==null) {
artId++;
continue;
}
......@@ -225,38 +236,38 @@ public class CmsParserUtil extends ParserUtil {
// 组合文章路径如:html/站点id/栏目id/文章id.html
writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + articleId);
//如果是封面就生成index.html
if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {
if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == COLUMN_TYPE_COVER) {
writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX);
}
Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) {
if (StringUtils.isNotBlank(columnContentModelId)) {
// 通过当前栏目的模型编号获取,自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(TABLE_NAME, contentModel.getCmTableName());
parserParams.put(TABLE_NAME, contentModel.getModelTableName());
} else {
// 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class)
.getEntity(columnContentModelId);
contentModel = (ModelEntity) SpringUtil.getBean(IModelBiz.class)
.getEntity(Integer.parseInt(columnContentModelId));
// 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getCmTableName());
parserParams.put(TABLE_NAME, contentModel.getCmTableName());
contentModelMap.put(columnContentModelId, contentModel.getModelTableName());
parserParams.put(TABLE_NAME, contentModel.getModelTableName());
}
}
parserParams.put(ID, articleId);
// 第一篇文章没有上一篇
if (artId > 0) {
ColumnArticleIdBean preCaBean = articleIdList.get(artId - 1);
ContentBean preCaBean = articleIdList.get(artId - 1);
//判断当前文档是否与上一页文章在同一栏目下,并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if(articleColumnPath.contains(preCaBean.getCategoryId()+"")){
if( articleColumnPath.contains(preCaBean.getCategoryId()+"")){
page.setPreId(preCaBean.getArticleId());
}
}
// 最后一篇文章没有下一篇
if (artId + 1 < articleIdList.size()) {
ColumnArticleIdBean nextCaBean = articleIdList.get(artId + 1);
ContentBean nextCaBean = articleIdList.get(artId + 1);
//判断当前文档是否与下一页文章在同一栏目下并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if(articleColumnPath.contains(nextCaBean.getCategoryId()+"")){
page.setNextId(nextCaBean.getArticleId());
......@@ -265,13 +276,13 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(IS_DO, false);
parserParams.put(ParserUtil.PAGE, page);
String content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, false);
String content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, false);
FileUtil.writeString(content, writePath, Const.UTF8);
// 手机端
if (ParserUtil.hasMobileFile(columnUrl)) {
writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId);
//如果是封面就生成index.html
if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {
if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == COLUMN_TYPE_COVER) {
writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX);
}
// 判断文件是否存在,若不存在弹出返回信息
......@@ -280,7 +291,7 @@ public class CmsParserUtil extends ParserUtil {
continue;
}
parserParams.put(MOBILE, BasicUtil.getApp().getAppMobileStyle());
content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, true);
content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, true);
FileUtil.writeString(content, writePath, Const.UTF8);
}
artId++;
......
package net.mingsoft.config;
import com.alibaba.druid.support.http.WebStatFilter;
import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;
import org.springframework.aop.Advisor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.JdkRegexpMethodPointcut;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author by 铭飞开源团队
* @Description TODO
* @date 2020/1/10 11:21
*/
@Configuration
@ConditionalOnProperty(prefix="spring",name = "datasource.druid.stat-view-servlet.enabled", havingValue = "true")
public class DruidConfig {
/**
* druid监控 配置URI拦截策略
*/
@Bean
public FilterRegistrationBean druidStatFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
// 添加过滤规则.
filterRegistrationBean.addUrlPatterns("/*");
// 添加不需要忽略的格式信息.
filterRegistrationBean.addInitParameter("exclusions",
"/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid,/druid/*");
// 用于session监控页面的用户名显示 需要登录后主动将username注入到session里
filterRegistrationBean.addInitParameter("principalSessionName", "username");
return filterRegistrationBean;
}
/**
* druid数据库连接池监控
*/
@Bean
public DruidStatInterceptor druidStatInterceptor() {
return new DruidStatInterceptor();
}
@Bean
public JdkRegexpMethodPointcut druidStatPointcut() {
JdkRegexpMethodPointcut druidStatPointcut = new JdkRegexpMethodPointcut();
String patterns = "net.mingsoft.*.biz.*";
// 可以set多个
druidStatPointcut.setPatterns(patterns);
return druidStatPointcut;
}
/**
* druid 为druidStatPointcut添加拦截
*
* @return
*/
@Bean
public Advisor druidStatAdvisor() {
return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment