Browse Source

【pc端 新闻发布数,社群书,社群话题数】-【数据校验sql修改】-(魏凯)-2020/05/22

feature/dangjian
weikai 6 years ago
parent
commit
d277bb87a4
  1. 77
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml
  2. 9
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml
  3. 4
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java
  4. 3
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NewsDao.xml

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

@ -120,16 +120,19 @@
<foreach collection="gridIdList" item="gridId" open="(" separator="UNION ALL" close=") t">
SELECT #{gridId} gridId
</foreach>
LEFT JOIN esua_epdc_news.epdc_news nne ON t.gridId = nne.DEPT_ID AND nne.DEL_FLAG = '0'
LEFT JOIN esua_epdc_news.epdc_notice nnn ON t.gridId = nnn.DEPT_ID AND nnn.DEL_FLAG = '0'
LEFT JOIN esua_epdc_events.epdc_events eee ON t.gridId = eee.GRID_ID AND eee.DEL_FLAG = '0' AND eee.EVENT_STATE = '4'
where 1=1
LEFT JOIN esua_epdc_news.epdc_news nne ON FIND_IN_SET(t.gridId,nne.ALL_DEPT_IDS) AND nne.DEL_FLAG = '0'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(nne.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
LEFT JOIN esua_epdc_news.epdc_notice nnn ON t.gridId = nnn.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_events eee ON t.gridId = eee.GRID_ID AND eee.DEL_FLAG = '0' AND eee.EVENT_STATE = '4'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(eee.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
GROUP BY
GROUP BY
t.gridId
</select>
@ -163,7 +166,13 @@
FROM
esua_epdc_group.epdc_group epgr
LEFT JOIN esua_epdc_group.epdc_user_group ug ON epgr.id = ug.group_id AND ug.DEL_FLAG = '0'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(ug.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
LEFT JOIN esua_epdc_group.epdc_topic ut ON epgr.id = ut.group_id AND ut.DEL_FLAG = '0'
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(ut.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
WHERE
epgr.DEL_FLAG = '0' AND ( epgr.STATE = '10' OR epgr.STATE = '15' )
<if test="gridIdList != null and gridIdList.size() > 0">
@ -624,38 +633,54 @@
<!--社群成员数-->
<select id="selectExportCommunityMemberCount" resultType="com.elink.esua.epdc.dto.user.result.ExportOperationDataResultDTO">
SELECT
t0.`name` streetName,
COUNT(ug.user_id) communityMemberCount
a.streetName streetName,
SUM(a.communityMemberCount) communityMemberCount
FROM
(
SELECT
ad.id,
ad.`name`,
ad.pid
FROM
esua_epdc_admin.sys_dept ad
WHERE
ad.id IN <include refid="foreachAllDeptIdsShow"></include>
AND ad.del_flag = 0
) t0
LEFT JOIN esua_epdc_group.epdc_group epgr ON find_in_set(t0.id, epgr.ALL_DEPT_IDS)
(SELECT
t0.`name` streetName,
t0.id,
COUNT( DISTINCT ug.user_id) communityMemberCount
FROM
(
SELECT
ad.id,
ad.`name`,
ad.pid
FROM
esua_epdc_admin.sys_dept ad
WHERE
ad.id IN<include refid="foreachAllDeptIdsShow"></include>
AND ad.del_flag = 0
) t0
LEFT JOIN esua_epdc_group.epdc_group epgr ON FIND_IN_SET(t0.id,epgr.ALL_DEPT_IDS)
AND epgr.DEL_FLAG = '0'
<if test="operationStartTime != null and operationEndTime != null and operationEndTime != ''">
AND DATE_FORMAT(epgr.CREATED_TIME,'%Y-%m-%d') BETWEEN #{operationStartTime} AND #{operationEndTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT(epgr.CREATED_TIME,'%Y-%m-%d') &lt;=#{endTime}
</if>
AND (
epgr.STATE = '10'
OR epgr.STATE = '15'
epgr.STATE = '10'
OR epgr.STATE = '15'
)
LEFT JOIN esua_epdc_group.epdc_user_group ug ON epgr.id = ug.group_id
AND ug.DEL_FLAG = '0'
<if test="operationStartTime != null and operationEndTime != null and operationEndTime != ''">
AND DATE_FORMAT(ug.CREATED_TIME,'%Y-%m-%d') BETWEEN #{operationStartTime} AND #{operationEndTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT(ug.CREATED_TIME,'%Y-%m-%d') &lt;=#{endTime}
</if>
GROUP BY
t0.id
epgr.GRID_ID,
t0.id
ORDER BY
t0.id ASC
t0.id ASC
)a
GROUP BY
a.id
</select>
<!--社群话题数-->
@ -689,6 +714,12 @@
)
LEFT JOIN esua_epdc_group.epdc_topic ug ON epgr.id = ug.group_id
AND ug.DEL_FLAG = '0'
<if test="operationStartTime != null and operationEndTime != null and operationEndTime != ''">
AND ug.CREATED_TIME BETWEEN #{operationStartTime} AND #{operationEndTime}
</if>
<if test="endTime != null and endTime != ''">
and ug.CREATED_TIME &lt;=#{endTime}
</if>
GROUP BY
t0.id
ORDER BY

9
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml

@ -193,10 +193,13 @@
( temp.BROWSE_NUM + temp.COMMENT_NUM ) AS participantsNum,
temp.STATE
FROM
epdc_topic temp
epdc_group epgr
left join
epdc_topic temp ON epgr.id = temp.group_id AND temp.DEL_FLAG = '0'
WHERE
temp.DEL_FLAG = '0'
AND temp.STATE IN ( 0, 5, 20)
AND temp.STATE IN ( 0, 5,10,15,20)
and epgr.DEL_FLAG = '0' AND ( epgr.STATE = '10' OR epgr.STATE = '15' )
<if test="deptIdList != null and deptIdList.size() > 0">
AND temp.GRID_ID in
<foreach collection="deptIdList" open="(" separator="," close=")" item="deptId">
@ -219,6 +222,7 @@
OR find_in_set(#{gridId},temp.ALL_DEPT_IDS))
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND DATE_FORMAT( epgr.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
AND DATE_FORMAT( temp.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
</if>
<if test="groupId != null and groupId != ''">
@ -227,6 +231,7 @@
<if test="keyword != null and keyword != ''">
AND temp.TOPIC_CONTENT like concat('%', trim(#{keyword}), '%')
</if>
GROUP BY temp.ID
ORDER BY
<if test="orderType == 0">
temp.CREATED_TIME DESC

4
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java

@ -480,8 +480,8 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem
public PageData<NewsDTO> allPage(Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
List<Long> deptIdList = user.getDeptIdList();
params.put("deptIdList", deptIdList);
IPage<NewsDTO> page = getPage(params);
params.put("deptIdList", deptIdList);
List<NewsDTO> newsDaoList = baseDao.selectAllPage(params);
return new PageData<>(newsDaoList, page.getTotal());
}
@ -542,4 +542,4 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem
return entities;
}
}
}

3
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NewsDao.xml

@ -110,7 +110,7 @@
GROUP BY
nd.NEWS_ID
) t0
LEFT JOIN epdc_news n ON find_in_set(t0.NEWS_ID, n.ALL_DEPT_IDS)
LEFT JOIN epdc_news n ON t0.NEWS_ID = n.ID
WHERE
n.ID IS NOT NULL
AND n.DEL_FLAG = '0'
@ -129,7 +129,6 @@
</if>
ORDER BY
n.CREATED_TIME DESC
</select>
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.NewsDTO">

Loading…
Cancel
Save