Skip to content

Commit

Permalink
[BE] feat : 홈 화면 밑으로 스크롤 시 추가 데이터 전송
Browse files Browse the repository at this point in the history
- url 파라미터로 page 값을 주면 그 값 * 20 에 해당하는 방에 대한 정보를 보내준다

- issue : #5
  • Loading branch information
hanurii committed May 25, 2020
1 parent 7cb1e48 commit 21c1882
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ public AirbnbControllerHamill(AirbnbServiceHamill airbnbServiceHamill) {
this.airbnbServiceHamill = airbnbServiceHamill;
}

@GetMapping("")
public ResponseEntity<List<PropertiesDtoHamill>> findAllProperties(@RequestParam("page") int page,
@RequestParam("list") int list) {
logger.info("##### list : {}", list);
@GetMapping("main")
public ResponseEntity<List<PropertiesDtoHamill>> findAllProperties(
@RequestParam(value = "page", required = false) Integer page) {
return new ResponseEntity<>(airbnbServiceHamill.findAllProperties(page), HttpStatus.OK);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ public PropertiesDaoHamill(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}

public List<PropertiesDtoHamill> findAllProperties(int page) {
public List<PropertiesDtoHamill> findAllProperties(Integer page) {
if (page == null) {
page = 20;
} else if (page >= 1) {
page = page * 20;
}

return jdbcTemplate.query(
"SELECT p.id, p.title, p.state, p.city, p.address, p.latitude, p.longitude, p.reservable," +
"p.saved,p.host_type,p.price,p.place_type,p.review_average,p.number_of_reviews, GROUP_CONCAT(i.image_url) AS image " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public AirbnbServiceHamill(PropertiesDaoHamill propertiesDaoHamill) {
this.propertiesDaoHamill = propertiesDaoHamill;
}

public List<PropertiesDtoHamill> findAllProperties(int page) {
public List<PropertiesDtoHamill> findAllProperties(Integer page) {
return propertiesDaoHamill.findAllProperties(page);
}
}

// Integer page, String checkin, String checkout, Integer adults, Integer children,
// Integer infants, Integer priceMin, Integer priceMax
//, checkin, checkout, adults, children, infants, priceMin, priceMax

0 comments on commit 21c1882

Please sign in to comment.