<?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.PublishMapper">
    <select id="selectByTenantIdAndCommunityIdPage" resultType="com.mcwl.communityCenter.domain.Publish">
        select id,
               tenant_id,
               community_id,
               user_id,
               content,
               image_url,
               file_url,
               publish_time,
               like_num,
               comment_num,
               status,
               create_by,
               create_time
        from cc_publish
        where tenant_id = #{tenantId}
          and community_id = #{communityId}
          and del_flag = '0'
    </select>
    <select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Publish">
        select id,
               tenant_id,
               community_id,
               user_id,
               content,
               image_url,
               file_url,
               publish_time,
               like_num,
               comment_num,
               status,
               create_by,
               create_time
        from cc_publish
        where id = #{id}
          and tenant_id = #{tenantId}
          and community_id = #{communityId}
          and del_flag = '0'
    </select>
    <select id="selectByTenantIdAndCommunityIdAndNotNullImagePage"
            resultType="com.mcwl.communityCenter.domain.Publish">
        select id,
               tenant_id,
               community_id,
               user_id,
               content,
               image_url,
               file_url,
               publish_time,
               like_num,
               comment_num,
               status,
               create_by,
               create_time
        from cc_publish
        where tenant_id = #{tenantId}
                  and community_id = #{communityId}
                  and del_flag = '0'
                  and image_url is not null
    </select>
    <select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
            resultType="com.mcwl.communityCenter.domain.Publish">
        select id,
               tenant_id,
               community_id,
               user_id,
               content,
               image_url,
               file_url,
               publish_time,
               like_num,
               comment_num,
               status,
               create_by,
               create_time
        from cc_publish
        where tenant_id = #{tenantId}
          and community_id = #{communityId}
          and del_flag = '0'
          and file_url is not null
    </select>
</mapper>