All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.mingsoft.cms.dao.IContentDao.xml Maven / Gradle / Ivy

There is a newer version: 5.4.2
Show newest version
<?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_short_title" property="contentShortTitle" /><!--文章副标题 -->
				<result column="category_id" property="categoryId" /><!--所属栏目 -->
				<result column="content_type" property="contentType" /><!--文章类型 -->
				<result column="content_display" property="contentDisplay" /><!--是否显示 -->
				<result column="content_author" property="contentAuthor" /><!--文章作者 -->
				<result column="content_source" property="contentSource" /><!--文章来源 -->
				<result column="content_datetime" property="contentDatetime" /><!--发布时间 -->
				<result column="content_tags" property="contentTags" /><!--文章标签 -->
				<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_out_link" property="contentOutLink" /><!--文章跳转链接地址 -->
				<result column="content_hit" property="contentHit" /><!--点击次数 -->
				<result column="create_by" property="createBy" /><!--创建人 -->
				<result column="create_date" property="createDate" /><!--创建时间 -->
				<result column="update_by" property="updateBy" /><!--修改人 -->
				<result column="update_date" property="updateDate" /><!--修改时间 -->
				<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBean">
		<id column="id" property="id" /><!--编号 -->
		<result column="content_title" property="contentTitle" /><!--文章标题 -->
		<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
		<result column="category_id" property="categoryId" /><!--所属栏目 -->
		<result column="content_type" property="contentType" /><!--文章类型 -->
		<result column="content_display" property="contentDisplay" /><!--是否显示 -->
		<result column="content_author" property="contentAuthor" /><!--文章作者 -->
		<result column="content_source" property="contentSource" /><!--文章来源 -->
		<result column="content_datetime" property="contentDatetime" /><!--发布时间 -->
		<result column="content_tags" property="contentTags" /><!--文章标签 -->
		<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_out_link" property="contentOutLink" /><!--文章跳转链接地址 -->
<!--		<result column="static_url" property="staticUrl" />&lt;!&ndash;静态地址 &ndash;&gt;-->
		<result column="content_hit" property="contentHit" /><!--点击次数 -->
		<result column="create_by" property="createBy" /><!--创建人 -->
		<result column="create_date" property="createDate" /><!--创建时间 -->
		<result column="update_by" property="updateBy" /><!--修改人 -->
		<result column="update_date" property="updateDate" /><!--修改时间 -->
		<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<resultMap id="resultBean" type="net.mingsoft.cms.bean.CategoryBean">
		<id column="id" property="id" /><!--编号 -->
		<id column="article_Id" property="articleId" /><!--编号 -->
		<result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间-->
		<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
		<result column="category_short_title" property="categoryShortTitle" /><!--栏目副标题 -->
		<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="dict_id" property="dictId" /><!--字典对应编号 -->
		<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
		<result column="category_path" property="categoryPath" /><!--栏目路径 -->
		<result column="category_parent_ids" property="categoryParentIds" /><!--父类型编号 -->
		<result column="create_by" property="createBy" /><!--创建人 -->
		<result column="create_date" property="createDate" /><!--创建时间 -->
		<result column="update_by" property="updateBy" /><!--修改人 -->
		<result column="update_date" property="updateDate" /><!--修改时间 -->
		<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<!--保存-->
	<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
			parameterType="net.mingsoft.cms.entity.ContentEntity" >
		insert into cms_content
		<trim prefix="(" suffix=")" suffixOverrides=",">
				<if test="contentTitle != null and contentTitle != ''">content_title,</if>
				<if test="contentShortTitle != null and contentShortTitle != ''">content_short_title,</if>
				<if test="categoryId != null and categoryId != ''">category_id,</if>
				<if test="contentType != null ">content_type,</if>
				<if test="contentDisplay != null and contentDisplay != ''">content_display,</if>
				<if test="contentAuthor != null and contentAuthor != ''">content_author,</if>
				<if test="contentSource != null and contentSource != ''">content_source,</if>
				<if test="contentDatetime != null">content_datetime,</if>
				<if test="contentSort != null">content_sort,</if>
				<if test="contentTags != null and contentTags != ''">content_tags,</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="contentOutLink != null and contentOutLink != ''">content_out_link,</if>
				<if test="contentHit != null">content_hit,</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="contentShortTitle != null and contentShortTitle != ''">#{contentShortTitle},</if>
				<if test="categoryId != null and categoryId != ''">#{categoryId},</if>
				<if test="contentType != null ">#{contentType},</if>
				<if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if>
				<if test="contentAuthor != null and contentAuthor != ''">#{contentAuthor},</if>
				<if test="contentSource != null and contentSource != ''">#{contentSource},</if>
				<if test="contentDatetime != null">#{contentDatetime},</if>
				<if test="contentSort != null">#{contentSort},</if>
				<if test="contentTags != null and contentTags != ''">#{contentTags},</if>
				<if test="contentImg != null and contentImg != ''">#{contentImg},</if>
				<if test="contentDescription != null and contentDescription != ''">#{contentDescription},</if>
				<if test="contentKeyword != null and contentKeyword != ''">#{contentKeyword},</if>
				<if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
				<if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
				<if test="contentHit != null">#{contentHit},</if>
				<if test="createBy &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="contentShortTitle != null and contentShortTitle != ''">content_short_title=#{contentShortTitle},</if>
				<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if>
				<if test="contentType != null ">content_type=#{contentType},</if>
				<if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if>
				<if test="contentAuthor != null ">content_author=#{contentAuthor},</if>
				<if test="contentSource != null ">content_source=#{contentSource},</if>
				<if test="contentDatetime != null">content_datetime=#{contentDatetime},</if>
				<if test="contentSort != null">content_sort=#{contentSort},</if>
				<if test="contentTags != null and contentTags != ''">content_tags=#{contentTags},</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="contentOutLink != null and contentOutLink != ''">content_out_link=#{contentOutLink},</if>
				<if test="contentHit != null">content_hit=#{contentHit},</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} and del=0
		</select>

		<!--根据实体获取-->
		<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.ContentEntity">
			select * from cms_content
			<where>
				del=0
				<if test="contentTitle != null and contentTitle != ''">and  content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
				<if test="contentShortTitle != null and contentShortTitle != ''">and  content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
				<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
				<if test="contentType != null and contentType != ''">and content_type=#{contentType}</if>
				<if test="contentDisplay != null and contentDisplay != ''">and content_display=#{contentDisplay}</if>
				<if test="contentAuthor != null and contentAuthor != ''">and content_author=#{contentAuthor}</if>
				<if test="contentSource != null and contentSource != ''">and content_source=#{contentSource}</if>
				<if test="contentDatetime != null"> and content_datetime=#{contentDatetime} </if>
				<if test="contentSort != null"> and content_sort=#{contentSort} </if>
				<if test="contentTags != null and contentTags != ''">and content_tags=#{contentTags}</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="contentOutLink != null and contentOutLink != ''">and content_out_link=#{contentOutLink}</if>
				<if test="contentHit != null">and content_hit=#{contentHit}</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>
			</where>
		</select>


		<!--删除 防止脏数据-->
		<delete id="deleteEntity" parameterType="int">
			delete from cms_content where id=#{id}
		</delete>

		<!--删除 防止脏数据-->
		<delete id="deleteEntityByCategoryIds" >
			delete from cms_content
			<where>
				category_id in <foreach collection="ids" item="item" index="index"
							open="(" separator="," close=")">#{item}</foreach>
			</where>
		</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 where del=0 order by id desc
		</select>


	<!--  查询文章,不包括单篇	-->
	<select id="queryContent" resultMap="resultContentMap">
		<!--,CONCAT('/html/',ct.app_id,category_path,'/',ct.id,'.html') AS static_url-->
		select ct.* from (
		select ct.*,cc.category_path from cms_content ct
		join cms_category cc on ct.category_id=cc.id
		<where>
			ct.del=0
			<if test="contentTitle != null and contentTitle != ''"> and  content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
			<if test="contentShortTitle != null and contentShortTitle != ''"> and  content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
			<if test="categoryId != null and categoryId != ''"> 	and (ct.category_id=#{categoryId} or ct.category_id in
				(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0 and cms_category.category_type != 2))</if>
			<if test="contentType != null and contentType != ''">
				and
				<foreach item="item" index="index" collection="contentType.split(',')" open="(" separator="or"
						 close=")">
					FIND_IN_SET(#{item},ct.content_type)>0
				</foreach>
			</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="contentTags != null and contentTags != ''">and content_tags=#{contentTags}</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="contentOutLink != null and contentOutLink != ''">and content_out_link=#{contentOutLink}</if>
			<if test="contentHit != null"> and content_hit=#{contentHit}</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>
			<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
		</where>
		)ct ORDER BY ct.content_datetime desc,content_sort desc
	</select>
	<!--条件查询-->
	<select id="query" resultMap="resultContentMap">
		<!--,CONCAT('/html/',ct.app_id,category_path,'/',ct.id,'.html') AS static_url-->
		select ct.* from (
		select ct.*,cc.category_path from cms_content ct
		join cms_category cc on ct.category_id=cc.id
		<where>
			ct.del=0
			<if test="contentTitle != null and contentTitle != ''"> and  content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
			<if test="contentShortTitle != null and contentShortTitle != ''"> and  content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
			<if test="categoryId != null and categoryId != ''"> 	and (ct.category_id=#{categoryId} or ct.category_id in
				(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0))</if>
			<if test="contentType != null and contentType != ''">
				and
				<foreach item="item" index="index" collection="contentType.split(',')" open="(" separator="or"
						 close=")">
					FIND_IN_SET(#{item},ct.content_type)>0
				</foreach>
			</if>
			<if test="flag != null and flag != ''">
				and
				<foreach item="item" index="index" collection="flag.split(',')" open="(" separator="or"
						 close=")">
					FIND_IN_SET(#{item},ct.content_type)>0
				</foreach>
			</if>
			<if test="noflag != null and noflag != ''">
				and
				<foreach item="item" index="index" collection="noflag.split(',')" open="(" separator="and"
						 close=" or ct.content_type is null)">
					FIND_IN_SET(#{item},ct.content_type)=0
				</foreach>
			</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="contentOutLink != null and contentOutLink != ''">and content_out_link=#{contentOutLink}</if>
			<if test="contentHit != null"> and content_hit=#{contentHit}</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>
			<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
		</where>
		)ct ORDER BY ct.content_datetime desc,content_sort desc
	</select>

	<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
	<select id="queryIdsByCategoryIdForParser" resultMap="resultBean" >
			select
			ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date
			FROM cms_content ct
			LEFT JOIN cms_category c ON ct.category_id = c.id
			where ct.del=0 and ct.content_display=0 and c.category_display='enable'

			<!-- 查询子栏目数据 -->
			<if test="categoryId!=null and  categoryId!='' and categoryType==1">
				and (ct.category_id=#{categoryId} or ct.category_id in
				(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0))
			</if>
			<if test="categoryId!=null and  categoryId!='' and categoryType==2">
				and ct.category_id=#{categoryId}
			</if>

			<if test="endTime!=null and endTime!=''">
				<if test="_databaseId == 'mysql'">
					and ct.UPDATE_DATE &gt;= #{endTime}
				</if>
				<if test="_databaseId == 'oracle'">
					and ct.UPDATE_DATE &gt;= to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
				</if>
			</if>
			<if test="flag!=null and flag!=''">
			and ct.content_type in ( #{flag})
			</if>
			<if  test="noflag!=null and noflag!=''">
			and (ct.content_type not in ( #{noflag}  ) or ct.content_type is null)
			</if>
			<if test="orderBy!=null  and orderBy!='' ">
				<if test="orderBy=='date'">ORDER BY content_datetime</if>
				<if test="orderBy=='hit'">ORDER BY content_hit</if>
				<if test="orderBy=='sort'">ORDER BY content_sort</if>
				<if  test="orderBy!='date' and orderBy!='hit' and orderBy!='sort'">
					ORDER BY ct.content_datetime
				</if>
				<choose>
					<when test="order!=null and order!=''">
						${order}
					</when>
					<otherwise>
						desc
					</otherwise>
				</choose>
			</if>

	</select>


	<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合,不包括单篇 -->
	<select id="queryIdsByCategoryIdForParserAndNotCover" resultMap="resultBean" >
		select
		ct.id article_id,ct.content_img  litpic,c.*
		FROM cms_content ct
		LEFT JOIN cms_category c ON ct.category_id = c.id
		where ct.del=0 and ct.content_display=0 and c.category_display='enable'

		<!-- 查询子栏目数据 -->
		<if test="categoryId!=null and  categoryId!='' and categoryType==1">
			and (ct.category_id=#{categoryId} or ct.category_id in
			(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0 and category_type!=2))
		</if>
		<if test="categoryId!=null and  categoryId!='' and categoryType==2">
			and ct.category_id=#{categoryId}
		</if>
		<if test="beginTime!=null and beginTime!=''">
			<if test="_databaseId == 'mysql'">
				AND ct.UPDATE_DATE &gt;=  #{beginTime}
			</if>
			<if test="_databaseId == 'oracle'">
				and ct.UPDATE_DATE &gt;= to_date(#{beginTime}, 'yyyy-mm-dd hh24:mi:ss')
			</if>
		</if>
		<if test="endTime!=null and endTime!=''">
			<if test="_databaseId == 'mysql'">
				and ct.UPDATE_DATE &gt;= #{endTime}
			</if>
			<if test="_databaseId == 'oracle'">
				and ct.UPDATE_DATE &gt;= to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
			</if>
		</if>
		<if test="flag!=null and flag!=''">
			and ct.content_type in ( #{flag})
		</if>
		<if  test="noflag!=null and noflag!=''">
			and (ct.content_type not in ( #{noflag}  ) or ct.content_type is null)
		</if>
		<if test="orderBy!=null  and orderBy!='' ">
			<if test="orderBy=='date'">ORDER BY content_datetime</if>
			<if test="orderBy=='hit'">ORDER BY content_hit</if>
			<if test="orderBy=='sort'">ORDER BY content_sort</if>
			<if  test="orderBy!='date' and orderBy!='hit' and orderBy!='sort'">
				ORDER BY ct.content_datetime
			</if>
			<choose>
				<when test="order!=null and order!=''">
					${order}
				</when>
				<otherwise>
					desc
				</otherwise>
			</choose>
		</if>

	</select>

	<select id="getSearchCount" resultType="int">
		select count(*) from
		cms_content a
		left join cms_category c
		ON a.category_id
		= c.id
		<if test="tableName!=null and tableName!='' and diyList!=null">left join ${tableName} d on d.link_id=a.id
		</if>
		<where>
			a.del=0
			and a.content_display=0
			and c.category_display='enable'
			and c.category_is_search='enable'
			<if test="categoryIds!=null and categoryIds!=''">
				and
				<foreach item="item" index="index" collection="categoryIds.split(',')" open="(" separator="or"
						 close=")">
					a.category_id=${item}
					or a.category_id in (select id FROM cms_category where cms_category.del=0
					and FIND_IN_SET(${item},CATEGORY_PARENT_IDS) > 0)
				</foreach>
			</if>

			<if test="map.content_title!=null">
			and a.content_title like CONCAT(CONCAT('%',#{map.content_title}),'%')
			</if>
			<if test="map.content_author!=null">
			and a.content_author like CONCAT(CONCAT('%',#{map.content_author}),'%')
			</if>
			<if test="map.content_source!=null">
			and a.content_source like CONCAT(CONCAT('%',#{map.content_source}),'%')
			</if>
			<if test="map.content_type!=null">
				and <foreach item="item" index="index" collection="map.content_type.split(',')"  open="(" separator="or" close=")">
					FIND_IN_SET(#{item},a.content_type)>0
				</foreach>
			</if>
			<if test="map.content_description!=null">
			and a.content_description like CONCAT(CONCAT('%',#{map.content_description}),'%')
			</if>
			<if test="map.content_tag!=null">
				and a.content_tags like CONCAT(CONCAT('%',#{map.content_tag}),'%')
			</if>
			<if test="map.content_keyword!=null">
			and a.content_keyword like CONCAT(CONCAT('%',#{map.content_keyword}),'%')
			</if>
			<if test="map.content_details!=null">
			and a.content_details like CONCAT(CONCAT('%',#{map.content_details}),'%')
			</if>
			<if test="map.content_datetime_start!=null and map.content_datetime_end!=null">
				<if test="_databaseId == 'mysql'">
					and a.content_datetime between #{map.content_datetime_start} and #{map.content_datetime_end}
				</if>
				<if test="_databaseId == 'oracle'">
					and a.content_datetime &gt; to_date(#{map.content_datetime_start}, 'yyyy-mm-dd hh24:mi:ss')
					and a.content_datetime &lt; to_date(#{map.content_datetime_end}, 'yyyy-mm-dd hh24:mi:ss')
				</if>
			</if>
			<if test="tableName!=null and tableName!='' and diyList!=null">
				<foreach item="item" index="index" collection="diyList" open=""
						 separator="" close="">
					and d.${item.key} like CONCAT(CONCAT('%',#{item.value}),'%')
				</foreach>
			</if>
		</where>

	</select>


</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy