left join epdc_party_topic_img t2 on t.ID = t2.REFERENCE_ID and t2.DEL_FLAG='0'
left join (select ID,USERNAME,USER_FACE,PARTY_MEMBER,CONTENT,TOPIC_ID,DEL_FLAG from epdc_party_topic_comment order by CREATED_TIME desc) t3 on t.ID = t3.TOPIC_ID and t3.DEL_FLAG='0'
where t.DEL_FLAG='0' and t.PARTY_GROUP_ID = #{partyGroupId} and t.STATE = '0'
<iftest="timestamp != null and timestamp.trim() != ''">
<![CDATA[ AND DATE_FORMAT(t.CREATED_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> #{timestamp}
</if>
<iftest="topicType != null and topicType != ''">
and t.TOPIC_MODULE = #{topicType}
</if>
<iftest="partyTopicId!=null and partyTopicId != ''">
and t.ID = #{partyTopicId}
</if>
where
t.ID in (select tmp.ID from (SELECT
t1.ID
FROM
epdc_party_topic t1
WHERE
t1.DEL_FLAG = '0' and t1.STATE = '0'
<iftest="timestamp != null and timestamp.trim() != ''">
<![CDATA[ AND DATE_FORMAT(t1.CREATED_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> #{timestamp}
</if>
<iftest="topicType != null and topicType != ''">
and t1.TOPIC_MODULE = #{topicType}
</if>
<iftest="partyTopicId!=null and partyTopicId != ''">