230 lines
7.9 KiB
XML
230 lines
7.9 KiB
XML
<?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="com.cool.store.mapper.HyContentInfoMapper">
|
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyContentInfoDO">
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="content_title" jdbcType="VARCHAR" property="contentTitle" />
|
|
<result column="subject" jdbcType="VARCHAR" property="subject" />
|
|
<result column="content_type" jdbcType="VARCHAR" property="contentType" />
|
|
<result column="cover" jdbcType="VARCHAR" property="cover" />
|
|
<result column="status" jdbcType="TINYINT" property="status" />
|
|
<result column="deleted" jdbcType="TINYINT" property="deleted" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
|
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
|
|
</resultMap>
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.HyContentInfoDO">
|
|
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
|
</resultMap>
|
|
|
|
<resultMap id="HyContentInfoVOList" type="com.cool.store.vo.HyContentInfoVO">
|
|
<association property="updateUserName" column="update_user_id" select="getUpdateUserName"></association>
|
|
<association property="updateUserPhone" column="update_user_id" select="getUpdateUserPhone"></association>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id, content_title, `subject`, content_type, cover, content, `status`, deleted, create_time, update_time,
|
|
create_user_id, update_user_id
|
|
</sql>
|
|
<sql id="Blob_Column_List">
|
|
content
|
|
</sql>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
|
insert into xfsg_content_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="record.contentTitle != null">
|
|
content_title,
|
|
</if>
|
|
<if test="record.subject != null">
|
|
subject,
|
|
</if>
|
|
<if test="record.contentType != null">
|
|
content_type,
|
|
</if>
|
|
<if test="record.cover != null">
|
|
cover,
|
|
</if>
|
|
<if test="record.status != null">
|
|
status,
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="record.createUserId != null">
|
|
create_user_id,
|
|
</if>
|
|
<if test="record.updateUserId != null">
|
|
update_user_id,
|
|
</if>
|
|
<if test="record.content != null">
|
|
content,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="record.contentTitle != null">
|
|
#{record.contentTitle},
|
|
</if>
|
|
<if test="record.subject != null">
|
|
#{record.subject},
|
|
</if>
|
|
<if test="record.contentType != null">
|
|
#{record.contentType},
|
|
</if>
|
|
<if test="record.cover != null">
|
|
#{record.cover},
|
|
</if>
|
|
<if test="record.status != null">
|
|
#{record.status},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
#{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
#{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
#{record.updateTime},
|
|
</if>
|
|
<if test="record.createUserId != null">
|
|
#{record.createUserId},
|
|
</if>
|
|
<if test="record.updateUserId != null">
|
|
#{record.updateUserId},
|
|
</if>
|
|
<if test="record.content != null">
|
|
#{record.content},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective">
|
|
update xfsg_content_info
|
|
<set>
|
|
<if test="record.contentTitle != null and record.contentTitle != ''">
|
|
content_title = #{record.contentTitle},
|
|
</if>
|
|
<if test="record.subject != null">
|
|
subject = #{record.subject},
|
|
</if>
|
|
<if test="record.contentType != null">
|
|
content_type = #{record.contentType},
|
|
</if>
|
|
<if test="record.cover != null and record.cover != ''">
|
|
cover = #{record.cover},
|
|
</if>
|
|
<if test="record.status != null and record.status != null">
|
|
status = #{record.status},
|
|
</if>
|
|
<if test="record.deleted != null and record.deleted != ''">
|
|
deleted = #{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null and record.createTime != ''">
|
|
create_time = #{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null and record.updateTime != ''">
|
|
update_time = #{record.updateTime},
|
|
</if>
|
|
<if test="record.createUserId != null and record.createUserId != ''">
|
|
create_user_id = #{record.createUserId},
|
|
</if>
|
|
<if test="record.updateUserId != null and record.updateUserId != ''">
|
|
update_user_id = #{record.updateUserId},
|
|
</if>
|
|
<if test="record.content != null and record.content != ''">
|
|
content = #{record.content},
|
|
</if>
|
|
</set>
|
|
where id = #{record.id}
|
|
</update>
|
|
<update id="deleteSelective">
|
|
update xfsg_content_info
|
|
<set>
|
|
deleted = 1
|
|
</set>
|
|
where id = #{contentId}
|
|
</update>
|
|
<select id="queryContentList" resultMap="HyContentInfoVOList">
|
|
select <include refid="Base_Column_List"></include>, update_user_id updateUserId
|
|
from xfsg_content_info
|
|
where deleted = 0
|
|
<if test="contentTitle != null and contentTitle != ''">
|
|
and content_title like concat('%', #{contentTitle}, '%')
|
|
</if>
|
|
<if test="subject != null">
|
|
and subject = #{subject}
|
|
</if>
|
|
<if test="contentType != null">
|
|
and content_type = #{contentType}
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
and update_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
and update_time <= #{endTime}
|
|
</if>
|
|
order by update_time desc
|
|
</select>
|
|
<select id="getUpdateUserName" resultType="string">
|
|
select name
|
|
from enterprise_user_${enterpriseId}
|
|
where active = 1
|
|
and user_id = #{updateUserId}
|
|
</select>
|
|
<select id="getUpdateUserPhone" resultType="string">
|
|
select mobile
|
|
from enterprise_user_${enterpriseId}
|
|
where active = 1
|
|
and user_id = #{updateUserId}
|
|
</select>
|
|
|
|
<!-- C 端使用的动态查询 -->
|
|
<select id="queryContentListForC" resultType="com.cool.store.vo.HyContentInfoVO">
|
|
select <include refid="Base_Column_List"></include>
|
|
from xfsg_content_info
|
|
where deleted = 0
|
|
and status = 0
|
|
<if test="contentTitle != null and contentTitle != ''">
|
|
and content_title like concat('%', #{contentTitle}, '%')
|
|
</if>
|
|
<if test="subject != null">
|
|
and subject = #{subject}
|
|
</if>
|
|
<if test="contentType != null">
|
|
and content_type = #{contentType}
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
and update_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
and update_time <= #{endTime}
|
|
</if>
|
|
and subject != 'MINI_PRE_FRIED'
|
|
order by update_time desc
|
|
</select>
|
|
|
|
<!-- 查询动态详情 -->
|
|
<select id="queryContentInfo" resultType="com.cool.store.entity.HyContentInfoDO">
|
|
select <include refid="Base_Column_List"></include>
|
|
from xfsg_content_info
|
|
where deleted = 0
|
|
and id = #{contentId}
|
|
</select>
|
|
|
|
<!-- 标题是否重复 -->
|
|
<select id="whetherTitleDuplicated" resultType="java.lang.Boolean">
|
|
SELECT COUNT(*)
|
|
FROM xfsg_content_info
|
|
WHERE deleted = 0
|
|
AND content_title = #{contentTitle}
|
|
</select>
|
|
|
|
<!-- 获取所有标题 -->
|
|
<select id="queryTitles" resultType="java.lang.String">
|
|
SELECT content_title
|
|
FROM xfsg_content_info
|
|
WHERE deleted = 0
|
|
</select>
|
|
</mapper> |