Commit 2ce4cc2b by 郑永强

解决查询重复记录问题

parent 16c3bf16
...@@ -32,15 +32,16 @@ ...@@ -32,15 +32,16 @@
SELECT SELECT
a.id, a.id,
a.ad_news_id adNewsId, a.ad_news_id adNewsId,
c.wechat_name wechatName, d.wechat_name wechatName,
b.title, c.title,
b.short_url shortUrl, c.short_url shortUrl,
a.custom_content customContent, a.custom_content customContent,
a.content_type contentType a.content_type contentType
FROM FROM
ad_news_group_record a ad_news_group_record a
LEFT JOIN ad_news b ON a.ad_news_id=b.id INNER JOIN ad_news_message_statistic b ON a.message_statistic_id=b.id
LEFT JOIN ad_news_wechat c ON b.news_from=c.news_from LEFT JOIN ad_news c ON a.ad_news_id=c.id
LEFT JOIN ad_news_wechat d ON d.news_from=c.news_from AND ((b.content_from=2 AND d.adviser_id=#{partyId,jdbcType=BIGINT}) OR b.content_from <![CDATA[<>]]> 2)
WHERE a.message_statistic_id=#{messageStatisticId,jdbcType=BIGINT} WHERE a.message_statistic_id=#{messageStatisticId,jdbcType=BIGINT}
AND a.create_user=#{partyId,jdbcType=BIGINT} AND a.create_user=#{partyId,jdbcType=BIGINT}
</select> </select>
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time
FROM FROM
ad_news a ad_news a
INNER JOIN ad_news_wechat b ON a.news_from = b.news_from AND b.is_delete = 0 INNER JOIN ad_news_wechat b ON a.news_from = b.news_from AND b.is_delete = 0 AND b.adviser_id=#{adviserId}
WHERE WHERE
NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = #{adviserId} ) NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = #{adviserId} )
AND NOT EXISTS (SELECT 1 from ad_news_group_record f WHERE f.ad_news_id=a.id and f.ad_news_set_id=#{adNewsSetId}) AND NOT EXISTS (SELECT 1 from ad_news_group_record f WHERE f.ad_news_id=a.id and f.ad_news_set_id=#{adNewsSetId})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment