Browse Source

【pc端 网格开通情况 】-【新闻sql优化】-(魏凯)-2020/05/25

feature/dangjian
weikai 5 years ago
parent
commit
3ee852ed19
  1. 12
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

12
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

@ -113,17 +113,17 @@
<!--新闻数 通知数 议题数-->
<select id="selectListNewsNoticeEventCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT
dept.id,
dept.id gridId,
COUNT( DISTINCT nne.id ) newsCount,
-- COUNT( DISTINCT nnn.ID ) noticeCount,
COUNT( DISTINCT nnn.ID ) noticeCount,
COUNT( DISTINCT eee.ID ) eventCount
FROM
esua_epdc_admin.sys_dept dept
LEFT JOIN esua_epdc_news.epdc_news nne ON nne.DEPT_ID = dept.id AND nne.DEL_FLAG = '0'
<!-- LEFT JOIN esua_epdc_news.epdc_notice nnn ON nnn.DEPT_ID = dept.id AND nnn.DEL_FLAG = '0'-->
<!-- <if test="startTime != null and endTime != null and endTime != ''">-->
<!-- AND DATE_FORMAT(nnn.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}-->
<!-- </if>-->
LEFT JOIN esua_epdc_news.epdc_notice nnn ON nnn.DEPT_ID = dept.id AND nnn.DEL_FLAG = '0'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(nnn.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
LEFT JOIN esua_epdc_events.epdc_issue eee ON eee.GRID_ID = dept.id AND eee.DEL_FLAG = '0'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(eee.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}

Loading…
Cancel
Save