<?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="cn.com.tenlion.configcontent.dao.contentcommentlike.IContentCommentLikeDao">

    <resultMap id="contentCommentLikeDTO" type="cn.com.tenlion.configcontent.pojo.dtos.contentcommentlike.ContentCommentLikeDTO">
        <result column="content_comment_like_id" property="contentCommentLikeId"/>
        <result column="content_comment_like_user_name" property="contentCommentLikeUserName"/>
        <result column="content_comment_like_user_icon" property="contentCommentLikeUserIcon"/>
        <result column="content_comment_id" property="contentCommentId"/>
        <result column="creator" property="creator"/>
        <result column="gmt_create" property="gmtCreate"/>
        <result column="modifier" property="modifier"/>
        <result column="gmt_modified" property="gmtModified"/>
        <result column="is_delete" property="isDelete"/>
    </resultMap>

    <resultMap id="contentCommentLikeBO" type="cn.com.tenlion.configcontent.pojo.bos.contentcommentlike.ContentCommentLikeBO">
        <result column="content_comment_like_id" property="contentCommentLikeId"/>
        <result column="content_comment_like_user_name" property="contentCommentLikeUserName"/>
        <result column="content_comment_like_user_icon" property="contentCommentLikeUserIcon"/>
        <result column="content_comment_id" property="contentCommentId"/>
        <result column="creator" property="creator"/>
        <result column="gmt_create" property="gmtCreate"/>
        <result column="modifier" property="modifier"/>
        <result column="gmt_modified" property="gmtModified"/>
        <result column="is_delete" property="isDelete"/>
    </resultMap>

    <resultMap id="contentCommentLikePO" type="cn.com.tenlion.configcontent.pojo.pos.contentcommentlike.ContentCommentLikePO">
        <result column="content_comment_like_id" property="contentCommentLikeId"/>
        <result column="content_comment_like_user_name" property="contentCommentLikeUserName"/>
        <result column="content_comment_like_user_icon" property="contentCommentLikeUserIcon"/>
        <result column="content_comment_id" property="contentCommentId"/>
        <result column="creator" property="creator"/>
        <result column="gmt_create" property="gmtCreate"/>
        <result column="modifier" property="modifier"/>
        <result column="gmt_modified" property="gmtModified"/>
        <result column="is_delete" property="isDelete"/>
    </resultMap>

    <!-- 新增CBC内容管理评论点赞记录表 -->
    <insert id="save" parameterType="map">
        INSERT INTO m_content_comment_like(
            content_comment_like_id,
            content_comment_like_user_name,
            content_comment_like_user_icon,
            content_comment_id,
            creator,
            gmt_create,
            modifier,
            gmt_modified,
            is_delete
        ) VALUES(
            #{contentCommentLikeId},
            #{contentCommentLikeUserName},
            #{contentCommentLikeUserIcon},
            #{contentCommentId},
            #{creator},
            #{gmtCreate},
            #{modifier},
            #{gmtModified},
            #{isDelete}
        )
    </insert>

    <!-- 删除CBC内容管理评论点赞记录表 -->
    <update id="remove" parameterType="map">
        UPDATE
            m_content_comment_like
        SET
            gmt_modified = #{gmtModified},
            modifier = #{modifier},
            is_delete = 1
        WHERE
            <!-- 添加条件 -->
    </update>

    <!-- 删除CBC内容管理评论点赞记录表（物理） -->
    <update id="delete" parameterType="java.lang.String">
        DELETE FROM
            m_content_comment_like
        WHERE
            content_comment_like_id = #{contentCommentLikeId}
    </update>

    <!-- 修改CBC内容管理评论点赞记录表 -->
    <update id="update" parameterType="map">
        UPDATE
            m_content_comment_like
        SET
        <if test="contentCommentLikeId != null and contentCommentLikeId != ''">
            content_comment_like_id = #{contentCommentLikeId},
        </if>
        <if test="contentCommentLikeUserName != null and contentCommentLikeUserName != ''">
            content_comment_like_user_name = #{contentCommentLikeUserName},
        </if>
        <if test="contentCommentLikeUserIcon != null and contentCommentLikeUserIcon != ''">
            content_comment_like_user_icon = #{contentCommentLikeUserIcon},
        </if>
        <if test="contentCommentId != null and contentCommentId != ''">
            content_comment_id = #{contentCommentId},
        </if>
            gmt_modified = #{gmtModified},
            modifier = #{modifier},
            <!-- 填充条件 -->
        WHERE
            <!-- 添加条件 -->
    </update>

    <!-- CBC内容管理评论点赞记录表详情 -->
    <select id="get" parameterType="map" resultMap="contentCommentLikeDTO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            1
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
    </select>

    <!-- CBC内容管理评论点赞记录表详情 -->
    <select id="getBO" parameterType="map" resultMap="contentCommentLikeBO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            t1.creator,
            t1.gmt_create,
            t1.modifier,
            t1.gmt_modified,
            t1.is_delete
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
            <!-- 添加条件 -->
    </select>

    <!-- CBC内容管理评论点赞记录表详情 -->
    <select id="getPO" parameterType="map" resultMap="contentCommentLikePO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            t1.creator,
            t1.gmt_create,
            t1.modifier,
            t1.gmt_modified,
            t1.is_delete
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
            <!-- 添加条件 -->
    </select>

    <!-- CBC内容管理评论点赞记录表列表 -->
    <select id="list" parameterType="map" resultMap="contentCommentLikeDTO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            t1.creator,
            t1.gmt_create,
            t1.modifier,
            t1.gmt_modified,
            t1.is_delete,
            1
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
        <if test="creator != null and creator != ''">
            AND t1.creator = #{creator}
        </if>        <!-- 添加条件 -->
        <if test="creator != null and creator != ''">
            AND t1.creator = #{creator}
        </if>
        <if test="contentCommentId != null and contentCommentId != ''">
            AND t1.content_comment_id = #{contentCommentId}
        </if>
        <if test="keywords != null and keywords != ''">
        AND (
            <!-- 这里添加其他条件 -->
            t1.id LIKE CONCAT('%', #{keywords}, '%')
        )
        </if>
        <if test="startTime != null and startTime != ''">
        AND
            LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
            AND
            LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
        </if>
    </select>

    <!-- CBC内容管理评论点赞记录表列表 -->
    <select id="listBO" parameterType="map" resultMap="contentCommentLikeBO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            t1.creator,
            t1.gmt_create,
            t1.modifier,
            t1.gmt_modified,
            t1.is_delete
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
        <if test="keywords != null and keywords != ''">
        AND (
            <!-- 这里添加其他条件 -->
            t1.id LIKE CONCAT('%', #{keywords}, '%')
        )
        </if>
        <if test="startTime != null and startTime != ''">
        AND
            LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
        AND
            LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
        </if>
    </select>

    <!-- CBC内容管理评论点赞记录表列表 -->
    <select id="listPO" parameterType="map" resultMap="contentCommentLikePO">
        SELECT
            t1.content_comment_like_id,
            t1.content_comment_like_user_name,
            t1.content_comment_like_user_icon,
            t1.content_comment_id,
            t1.creator,
            t1.gmt_create,
            t1.modifier,
            t1.gmt_modified,
            t1.is_delete
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
        <if test="keywords != null and keywords != ''">
        AND (
            <!-- 这里添加其他条件 -->
            t1.id LIKE CONCAT('%', #{keywords}, '%')
        )
        </if>
        <if test="startTime != null and startTime != ''">
        AND
            LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
        AND
            LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
        </if>
    </select>

    <!-- CBC内容管理评论点赞记录表统计  -->
    <select id="count" parameterType="map" resultType="Integer">
        SELECT
            COUNT(*)
        FROM
            m_content_comment_like t1
        WHERE
            t1.is_delete = 0
        <if test="creator != null and creator != ''">
            AND t1.creator = #{creator}
        </if>
        <if test="contentCommentId != null and contentCommentId != ''">
            AND t1.content_comment_id = #{contentCommentId}
        </if>
    </select>

</mapper>