Commit c64e629f authored by Quxl's avatar Quxl

x

parent 8d3e4e7c
...@@ -44,7 +44,8 @@ public class NewsServiceImpl implements NewsService { ...@@ -44,7 +44,8 @@ public class NewsServiceImpl implements NewsService {
@Override @Override
public List<Map<String, Object>> queryListForUser(Integer uid, Integer gid, Page page) { public List<Map<String, Object>> queryListForUser(Integer uid, Integer gid, Page page) {
String sql = "select n.*, ns.sender, ns.send_time, nr.user_id, nr.read_time from fc_news n left join (select user_id, news_id, max(read_time) read_time from fc_news_read where user_id = ? group by user_id, news_id) nr on nr.news_id = n.id, fc_news_sender ns where n.id = ns.news_id and (ns.user_id = ? or ns.user_group_id = ?)"; String sqlRead = "select t.user_id, t.news_id, max(t.read_time) read_time from fc_news_read t where t.user_id = ? group by t.user_id, t.news_id";
String sql = "select n.*, ns.sender, ns.send_time, nr.user_id, nr.read_time from fc_news n left join (" + sqlRead + ") nr on nr.news_id = n.id, fc_news_sender ns where n.id = ns.news_id and (ns.user_id = ? or ns.user_group_id = ?) order by n.create_time desc";
return jdbcTemplate.limit(sql, page, uid, uid, gid); return jdbcTemplate.limit(sql, page, uid, uid, gid);
} }
......
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