<?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.mcwl.communityCenter.mapper.PublishCommentMapper">
    <update id="deleteByIdAndTenantIdAndCommunityIdAndOperatorId">
        update cc_publish_comment set del_flag = '2'
        where tenant_id = #{tenantId}
          and community_id = #{communityId}
          and publish_id = #{operatorId}
          and type = 0
    </update>

    <select id="selectByTenantIdAndCommunityIdAndOperatorId"
            resultType="com.mcwl.communityCenter.domain.PublishComment">
        select id,
               tenant_id,
               community_id,
               publish_id,
               user_id,
               content,
               parent_id,
               type,
               like_num,
               create_time
        from cc_publish_comment
        where tenant_id = #{tenantId}
          and community_id = #{communityId}
          and publish_id = #{operatorId}
          and type = 0
          and del_flag = '0'
        order by create_time
    </select>
    <select id="selectByIdAndTenantIdAndCommunityIdAndOperatorId"
            resultType="com.mcwl.communityCenter.domain.PublishComment">
        select id,
               tenant_id,
               community_id,
               publish_id,
               user_id,
               content,
               parent_id,
               type,
               like_num,
               create_time
        from cc_publish_comment
        where tenant_id = #{tenantId}
          and community_id = #{communityId}
          and publish_id = #{operatorId}
          and type = 0
          and del_flag = '0'
    </select>
</mapper>