Skip to content

Commit

Permalink
refactor: studyId로 my-study 정보 Map에 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jaejae-yoo committed Aug 2, 2022
1 parent ed2a934 commit 748df68
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,25 @@ public class MyStudyDao {
private static final ResultSetExtractor<Map<Long, StudyOwnerAndTagsData>> OWNER_WITH_TAG_ROW_MAPPER = rs -> {
Map<Long, StudyOwnerAndTagsData> result = new LinkedHashMap<>();

List<TagSummaryData> tagSummary = new ArrayList<>();
Long studyId;
while (rs.next()) {
final Long studyId = rs.getLong("study.id");
studyId = rs.getLong("study.id");

if (!result.containsKey(studyId)) {
Long githubId = rs.getLong("github_id");
String username = rs.getString("username");
String imageUrl = rs.getString("image_url");
String profileUrl = rs.getString("profile_url");

tagSummary = new ArrayList<>();
result.put(studyId, new StudyOwnerAndTagsData(new MemberData(githubId, username, imageUrl, profileUrl),
tagSummary));
new ArrayList<>()));
}

final Long tagId = rs.getLong("tag.id");
final String tagName = rs.getString("tag.name");
tagSummary.add(new TagSummaryData(tagId, tagName));
result.get(studyId)
.getTags()
.add(new TagSummaryData(tagId, tagName));
}
return result;
};
Expand Down

0 comments on commit 748df68

Please sign in to comment.