From 227425b80a98077b5cd2680f67d6b08a99e55d77 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Wed, 24 Jun 2026 18:51:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(bugcollect):=20=E4=BF=AE=E5=A4=8D=20trend?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=20500=20=E2=80=94=20GROUP=20BY=20?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=20MySQL=20only=5Ffull=5Fgroup=5Fby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SELECT e.createdAt 配合 GROUP BY DATE(e.createdAt) 在 MySQL strict mode 下触发 Expression #1 of SELECT list is not in GROUP BY clause 错误。 改为 MIN(e.createdAt) 作为聚合列,类型不变,LogService 无需修改。 Co-Authored-By: Claude Sonnet 4.6 --- .../com/xuqm/bugcollect/repository/LogIssueEventRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xuqm-bugcollect-service/src/main/java/com/xuqm/bugcollect/repository/LogIssueEventRepository.java b/xuqm-bugcollect-service/src/main/java/com/xuqm/bugcollect/repository/LogIssueEventRepository.java index 922f3d3..a2bb0bb 100644 --- a/xuqm-bugcollect-service/src/main/java/com/xuqm/bugcollect/repository/LogIssueEventRepository.java +++ b/xuqm-bugcollect-service/src/main/java/com/xuqm/bugcollect/repository/LogIssueEventRepository.java @@ -25,7 +25,7 @@ public interface LogIssueEventRepository extends JpaRepository findByAppKeyAndCreatedAtBetween( String appKey, LocalDateTime from, LocalDateTime to, Pageable pageable); - @Query("SELECT e.createdAt, COUNT(e), COUNT(DISTINCT e.userId) FROM LogIssueEventEntity e " + + @Query("SELECT MIN(e.createdAt), COUNT(e), COUNT(DISTINCT e.userId) FROM LogIssueEventEntity e " + "WHERE e.issueId = :issueId AND e.createdAt BETWEEN :from AND :to " + "GROUP BY FUNCTION('DATE', e.createdAt) ORDER BY FUNCTION('DATE', e.createdAt)") List findDailyCountsByIssueId(