瀏覽代碼

fix(mapper): 修复LifeCollectMapper中的SQL查询逻辑

- 在动态SQL查询中添加了GROUP BY子句以解决数据重复问题
- 保持按收藏时间倒序排序的功能不变
- 确保SQL查询的正确性和数据完整性
fcw 2 天之前
父節點
當前提交
43948aa970
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      alien-entity/src/main/java/shop/alien/mapper/LifeCollectMapper.java

+ 1 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeCollectMapper.java

@@ -51,6 +51,7 @@ public interface LifeCollectMapper extends BaseMapper<LifeCollect> {
             "    #{id}" +
             "  </foreach>" +
             "</if>" +
+            "GROUP BY sg.id" +
             // 按收藏时间倒序排序
             "ORDER BY lc.created_time DESC" +
             "</script>")