fix(account): findTagsByEntryIds Map key 소문자로 통일 + null guard
Deploy / deploy (push) Failing after 14m54s
Deploy / deploy (push) Failing after 14m54s
JDBC driver마다 column alias의 대소문자를 다르게 반환할 수 있어 entryId → entry_id, tagName → tag_name 으로 소문자 통일. NPE 방지를 위한 null 체크도 추가. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,8 +60,10 @@ public class AccountService {
|
|||||||
List<Long> ids = entries.stream().map(AccountEntry::getId).toList();
|
List<Long> ids = entries.stream().map(AccountEntry::getId).toList();
|
||||||
Map<Long, List<String>> tagsByEntry = new HashMap<>();
|
Map<Long, List<String>> tagsByEntry = new HashMap<>();
|
||||||
for (Map<String, Object> row : mapper.findTagsByEntryIds(ids)) {
|
for (Map<String, Object> row : mapper.findTagsByEntryIds(ids)) {
|
||||||
Long eid = ((Number) row.get("entryId")).longValue();
|
Object rawId = row.get("entry_id");
|
||||||
String name = (String) row.get("tagName");
|
String name = (String) row.get("tag_name");
|
||||||
|
if (rawId == null || name == null) continue;
|
||||||
|
Long eid = ((Number) rawId).longValue();
|
||||||
tagsByEntry.computeIfAbsent(eid, k -> new ArrayList<>()).add(name);
|
tagsByEntry.computeIfAbsent(eid, k -> new ArrayList<>()).add(name);
|
||||||
}
|
}
|
||||||
return entries.stream()
|
return entries.stream()
|
||||||
|
|||||||
@@ -236,7 +236,7 @@
|
|||||||
|
|
||||||
<!-- 복수 항목의 태그를 한 번에 조회 — {entry_id, tag_name} 행 반환 -->
|
<!-- 복수 항목의 태그를 한 번에 조회 — {entry_id, tag_name} 행 반환 -->
|
||||||
<select id="findTagsByEntryIds" resultType="map">
|
<select id="findTagsByEntryIds" resultType="map">
|
||||||
SELECT aet.entry_id AS entryId, t.name AS tagName
|
SELECT aet.entry_id AS entry_id, t.name AS tag_name
|
||||||
FROM account_tag t
|
FROM account_tag t
|
||||||
JOIN account_entry_tag aet ON aet.tag_id = t.id
|
JOIN account_entry_tag aet ON aet.tag_id = t.id
|
||||||
WHERE aet.entry_id IN
|
WHERE aet.entry_id IN
|
||||||
|
|||||||
Reference in New Issue
Block a user