-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'EnjoyTripKorea:main' into main
- Loading branch information
Showing
28 changed files
with
303 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...yTripBackend/src/main/java/com/example/EnjoyTripBackend/controller/CampingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.example.EnjoyTripBackend.controller; | ||
|
||
import com.example.EnjoyTripBackend.dto.ResponseResult; | ||
import com.example.EnjoyTripBackend.dto.camping.CampingResponseDto; | ||
import com.example.EnjoyTripBackend.service.CampingService; | ||
import com.example.EnjoyTripBackend.util.argumentresolver.LimitedSizePagination; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.web.PageableDefault; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
@RequiredArgsConstructor | ||
public class CampingController { | ||
|
||
private final CampingService campingService; | ||
|
||
@GetMapping("/camping") | ||
@LimitedSizePagination(maxSize = 20) | ||
public ResponseEntity<ResponseResult<List<CampingResponseDto>>> findAll(@PageableDefault(size = 6) Pageable pageable) { | ||
return ResponseEntity.ok().body(campingService.findAll(pageable)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...yTripBackend/src/main/java/com/example/EnjoyTripBackend/controller/PaymentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/domain/Camping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.example.EnjoyTripBackend.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Camping extends BaseTimeDomain{ | ||
|
||
private Long id; | ||
private String name; | ||
private String shortIntro; | ||
private String Intro; | ||
private String zipcode; | ||
private String address; | ||
private double latitude; | ||
private double longitude; | ||
private String imageUrl; | ||
private String homepage; | ||
private String tel; | ||
} |
22 changes: 22 additions & 0 deletions
22
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/dto/camping/CampItemDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.example.EnjoyTripBackend.dto.camping; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import lombok.*; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class CampItemDto { | ||
private String facltNm; | ||
private String intro; | ||
private String tel; | ||
private String zipcode; | ||
private double mapY; | ||
private double mapX; | ||
private String lineIntro; | ||
private String firstImageUrl; | ||
private String addr1; | ||
private String homepage; | ||
} |
37 changes: 37 additions & 0 deletions
37
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/dto/camping/CampingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.example.EnjoyTripBackend.dto.camping; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import lombok.*; | ||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class CampingResponse { | ||
private Response response; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class Response { | ||
private BodyDto body; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class BodyDto { | ||
private ItemsDto items; | ||
} | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class ItemsDto { | ||
private List<CampItemDto> item; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ripBackend/src/main/java/com/example/EnjoyTripBackend/dto/camping/CampingResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example.EnjoyTripBackend.dto.camping; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CampingResponseDto { | ||
|
||
private String name; | ||
private String Intro; | ||
private String zipcode; | ||
private String address; | ||
private double latitude; | ||
private double longitude; | ||
private String imageUrl; | ||
private String homepage; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/filter/WebConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...yTripBackend/src/main/java/com/example/EnjoyTripBackend/repository/CampingRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.example.EnjoyTripBackend.repository; | ||
|
||
import com.example.EnjoyTripBackend.domain.Camping; | ||
import com.example.EnjoyTripBackend.dto.PageRequestList; | ||
import com.example.EnjoyTripBackend.dto.camping.CampingResponseDto; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
import java.util.List; | ||
|
||
@Mapper | ||
public interface CampingRepository { | ||
Long save(Camping camping); | ||
Long findTotalCount(); | ||
List<CampingResponseDto> findAll(PageRequestList<?> requestList); | ||
} |
36 changes: 36 additions & 0 deletions
36
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/service/CampingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.example.EnjoyTripBackend.service; | ||
|
||
import com.example.EnjoyTripBackend.domain.Camping; | ||
import com.example.EnjoyTripBackend.dto.PageRequestList; | ||
import com.example.EnjoyTripBackend.dto.ResponseResult; | ||
import com.example.EnjoyTripBackend.dto.camping.CampingResponseDto; | ||
import com.example.EnjoyTripBackend.repository.CampingRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class CampingService { | ||
|
||
private final CampingRepository campingRepository; | ||
|
||
@Transactional | ||
public Long save(Camping camping) { | ||
return campingRepository.save(camping); | ||
} | ||
|
||
public ResponseResult<List<CampingResponseDto>> findAll(Pageable pageable) { | ||
PageRequestList<?> requestList = PageRequestList.builder() | ||
.pageable(pageable) | ||
.build(); | ||
|
||
long totalCount = campingRepository.findTotalCount(); | ||
int totalPages = (int) Math.ceil((double) totalCount / pageable.getPageSize()); | ||
return ResponseResult.of("캠핑 정보 게시글 목록입니다.", campingRepository.findAll(requestList),totalPages); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
EnjoyTripBackend/src/main/java/com/example/EnjoyTripBackend/util/DataUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...util/LimitedPageableArgumentResolver.java → ...lver/LimitedPageableArgumentResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ipBackend/util/LimitedSizePagination.java → ...gumentresolver/LimitedSizePagination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/EnjoyTripBackend/util/SessionConst.java → ...d/util/argumentresolver/SessionConst.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...le/EnjoyTripBackend/util/SessionUser.java → ...nd/util/argumentresolver/SessionUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ipBackend/util/AirplaneInfoCollector.java → ...util/collector/AirplaneInfoCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.