diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 3d416b3a91..9dbbf9992f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -108,41 +108,24 @@ topicContent, type FROM - ( - SELECT - a.ID AS textId, - a.TOPIC_CONTENT AS topicContent, - 'topic' AS type, - max( a.CREATED_TIME ) AS CREATED_TIME - FROM - resi_topic a - WHERE - a.GROUP_ID = #{groupId} - GROUP BY - a.GROUP_ID UNION ALL - SELECT - a.ID AS textId, - a.TITLE AS topicContent, - 'notice' AS type, - max( a.CREATED_TIME ) AS CREATED_TIME - FROM - notice a - WHERE - a.GROUP_ID = #{groupId} - GROUP BY - a.GROUP_ID UNION ALL - SELECT - a.ID AS textId, - a.TITLE AS topicContent, - 'activity' AS type, - max( a.CREATED_TIME ) AS CREATED_TIME - FROM - group_act_info a - WHERE - a.GROUP_ID = #{groupId} - GROUP BY - a.GROUP_ID - ) a + ( + SELECT + a.ID AS textId, + a.TOPIC_CONTENT AS topicContent, + 'topic' AS type, + a.CREATED_TIME + FROM + resi_topic a + INNER JOIN ( + SELECT max( CREATED_TIME ) AS CREATED_TIME + FROM resi_topic + WHERE GROUP_ID = #{groupId} + AND DEL_FLAG = '0' + ) b ON a.CREATED_TIME = b.CREATED_TIME + WHERE + a.DEL_FLAG = '0' + AND a.GROUP_ID = #{groupId} + ) a ORDER BY CREATED_TIME DESC LIMIT 1