Skip to content

Commit

Permalink
[BE/#54] Feat : 마일스톤 리스트 반환 관련 Dao 쿼리 구현 (오픈 된 이슈 리스트 반환)
Browse files Browse the repository at this point in the history
- milestoneDao.findCountOfOpenedIssueById()
  • Loading branch information
MuseopKim committed Jun 18, 2020
1 parent df03ff8 commit a95e389
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ public List<Milestone> findAllMilestones() {
return jdbcTemplate.query(sql, (rs, rowNum) -> new Milestone.Builder()
.id(rs.getInt("id"))
.title(rs.getString("title"))
.description(rs.getString("description"))
.dueDate(rs.getDate("due_date").toLocalDate())
.createdDateTime(rs.getTimestamp("created_date_time").toLocalDateTime())
.updatedDateTime(rs.getTimestamp("updated_date_time").toLocalDateTime())
.build());
}

public Integer findCountOfOpenedIssueById(Integer milestoneId, boolean isOpened) {
String sql = "SELECT COUNT(*) FROM issue i JOIN milestone m ON i.milestone_id = m.id " +
"WHERE i.milestone_id = ? AND i.is_opened = ?";
return jdbcTemplate.queryForObject(sql, new Object[]{milestoneId, isOpened}, Integer.class);
}
}

0 comments on commit a95e389

Please sign in to comment.