<?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.QuestionMapper">


    <select id="list" resultType="com.mcwl.communityCenter.domain.Question">
        select id,
               tenant_id,
               community_id,
               question_user_id,
               content,
               question_url,
               is_anonymous,
               amount,
               status,
               type
        from cc_question
        where del_flag = '0'
          and tenant_id = #{tenantId}
          and community_id = #{communityId}
        order by amount desc, create_time desc
    </select>
    <select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Question">
        select id,
               tenant_id,
               community_id,
               question_user_id,
               content,
               question_url,
               is_anonymous,
               amount,
               status,
               type
        from cc_question
        where id = #{id}
          and tenant_id = #{tenantId}
          and community_id = #{communityId}
          and del_flag = '0'
    </select>
    <select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
        select id,
               tenant_id,
               community_id,
               question_user_id,
               content,
               question_url,
               is_anonymous,
               amount,
               status,
               type
        from cc_question
        where del_flag = '0'
          and tenant_id = #{tenantId}
          and community_id = #{communityId}
          and question_url is not null
        order by amount desc, create_time desc
    </select>
</mapper>