LEFT JOIN information i ON dcl.id = i.type_two AND i.state = 2
LEFT JOIN cloud_trainning_project.tp_comment nc ON i.id = nc.training_project_id and nc.audit_status = 0
LEFT JOIN cloud_trainning_project.tp_comment nc ON i.id = nc.training_project_id and nc.audit_status = 0 AND nc.create_time >= DATE_SUB(NOW(), INTERVAL 24 HOUR)
<!-- select a.* from information a left join data_classification b on a.type_two=b.id
where 1=1 and a.site_id=#{siteId} and b.site_id=#{siteId} and b.name=#{name} -->
select a.* from information a where 1=1 and a.site_id=#{siteId} and a.type_two=#{typeId}
select a.*,COALESCE(COUNT(nc.id), 0) as commentCount from information a
LEFT JOIN cloud_trainning_project.tp_comment nc ON a.id = nc.training_project_id and nc.audit_status = 0 AND nc.create_time >= DATE_SUB(NOW(), INTERVAL 24 HOUR)
where 1=1 and a.site_id=#{siteId} and a.type_two=#{typeId}
<iftest="fileName != null and fileName != ''">
and (a.file_name like CONCAT('%', '${fileName}', '%' ) or a.key_words like CONCAT('%', '${fileName}', '%' ) )
</if>
...
...
@@ -111,7 +113,8 @@
<iftest="state != null">
and a.state = #{state}
</if>
order by a.is_top desc, a.update_time desc
GROUP BY a.id
order by commentCount desc,a.is_top desc, a.update_time desc