Skip to content

Commit

Permalink
fix(server): display same image once (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub authored Oct 28, 2024
1 parent c556c32 commit 0389e5d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/resources/mapper/TbmessageMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@
<select id="fileDetails" parameterType="string" resultType="com.thc.realspr.dto.TbmessageDto$FileDetail">
SELECT file.hash AS hash,
file.ext AS ext
FROM (SELECT file_hash, appear_order
FROM TbFileMessageRelation
WHERE message_id = #{messageId}) as fml
LEFT JOIN TbKaFile AS file
ON file.hash = fml.file_hash
ORDER BY fml.appear_order
FROM TbKaFile AS file
JOIN (SELECT file_hash, appear_order, MAX(modified_at) AS latest_modified_at
FROM TbFileMessageRelation
WHERE message_id = #{messageId}
GROUP BY file_hash, appear_order) AS fml
ON file.hash = fml.file_hash
JOIN (SELECT appear_order, MAX(modified_at) AS latest_modified_at
FROM TbFileMessageRelation
WHERE message_id = #{messageId}
GROUP BY appear_order) AS latest ON fml.appear_order = latest.appear_order
AND fml.latest_modified_at = latest.latest_modified_at
ORDER BY fml.appear_order;
</select>

</mapper>

0 comments on commit 0389e5d

Please sign in to comment.