Skip to content

Commit

Permalink
#18 [Refactor] store id를 int에서 long으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Jin committed Jul 26, 2022
1 parent 141d8f4 commit 26a35a4
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Getter
@NoArgsConstructor
public class AdminResponseDto {
private int registerStoreId;
private long registerStoreId;
private String name;
private String address;
private String elevator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class LocationInfoDto {
public static class LocationResponse {

String category;
Integer storeId;
Long storeId;
String storeName;
String longitude;
String latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static class Result {
public static class Row {
@JsonProperty("SEQ")
int SEQ;
Integer storeId;
Long storeId;
BigDecimal latitude;
BigDecimal longitude;
String category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ public LocationInfoDto.LocationResponse convertGeoAndStoreNameToKeyword(String l
return null;
}
return LocationInfoDto.LocationResponse.builder()
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeId(Long.parseLong(latLngDoc.getId()))
.latitude(latLngDoc.getY())
.longitude(latLngDoc.getX())
.category(categoryFilter(latLngDoc.getCategory_name()))
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeName(latLngDoc.getPlace_name())
.phoneNumber(latLngDoc.getPhone()).build();
}
Expand Down Expand Up @@ -195,7 +194,7 @@ private void getStoreResults(String lat, String lng, String address, String type
.longitude(latLngDoc.getX())
.category(categoryFilter(latLngDoc.getCategory_name()))
.storeName(latLngDoc.getPlace_name())
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeId(Long.parseLong(latLngDoc.getId()))
.phoneNumber(latLngDoc.getPhone())
.build();
if (newResult.validate()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ public LocationInfoDto.LocationResponse convertGeoAndStoreNameToKeyword(String l
return null;
}
return LocationInfoDto.LocationResponse.builder()
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeId(Long.parseLong(latLngDoc.getId()))
.latitude(latLngDoc.getY())
.longitude(latLngDoc.getX())
.category(categoryFilter(latLngDoc.getCategory_name()))
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeName(latLngDoc.getPlace_name())
.phoneNumber(latLngDoc.getPhone()).build();
}
Expand Down Expand Up @@ -178,7 +177,7 @@ private void getStoreResults(String lat, String lng, String address, String type
.longitude(latLngDoc.getX())
.category(categoryFilter(latLngDoc.getCategory_name()))
.storeName(latLngDoc.getPlace_name())
.storeId(Integer.parseInt(latLngDoc.getId()))
.storeId(Long.parseLong(latLngDoc.getId()))
.phoneNumber(latLngDoc.getPhone())
.build();
if (newResult.validate()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BookmarkService {
public void bookmark(BookmarkRequestDto bookmarkRequestDto, String socialId) {

Folder folder = folderRepository.findById(bookmarkRequestDto.getFolderId()).orElseThrow(()-> new IllegalArgumentException("폴더가 존재하지 않습니다"));
Store store = storeRepository.findById(bookmarkRequestDto.getStoreId()).orElseThrow(()-> new IllegalArgumentException("가게가 존재하지 않습니다"));
Store store = storeRepository.findById((long) bookmarkRequestDto.getStoreId()).orElseThrow(()-> new IllegalArgumentException("가게가 존재하지 않습니다"));
User user = userRepository.findBySocialId(socialId); if(user == null) { throw new IllegalArgumentException("해당하는 유저가 없습니다."); }

Bookmark bookmark = Bookmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Builder
public class ReviewMainResponseDto {
// review 테이블 컬럼
private int storeId;
private long storeId;
private int userId;
private String storeName;
private String userName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Builder
public class ReviewRequestDto {
//review 테이블 컬럼
private int storeId; //업장 아이디
private long storeId; //업장 아이디
private String content; //리뷰 코멘트
private double point; //별점
private List<String> tagList; //태그
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Getter @Setter
public class ReviewResponseDto {
private int reviewId; // storeId
private int storeId;
private long storeId;
private int userId;
private Double point;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ReviewService {
/** 리뷰 작성 */
public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IOException {

int storeId = reviewRequestDto.getStoreId();
long storeId = reviewRequestDto.getStoreId();
Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다."));
User user = userRepository.findBySocialId(socialId);
Review review = new Review(reviewRequestDto, store, user);
Expand Down Expand Up @@ -82,7 +82,7 @@ public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IO



public List<ReviewResponseDto> getReview(int storeId) {
public List<ReviewResponseDto> getReview(long storeId) {
Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당 가게가 없습니다"));
return reviewRepository.findAllByStoreId(store)
.stream().map(ReviewResponseDto::new).collect(Collectors.toList());
Expand All @@ -94,7 +94,7 @@ public List<ReviewResponseDto> getReview(int storeId) {
/** 리뷰 수정 */
public void reviewUpdate(ReviewRequestDto reviewRequestDto, String socialId, int reviewId) throws IOException {

int storeId = reviewRequestDto.getStoreId();
long storeId = reviewRequestDto.getStoreId();
User user = userRepository.findBySocialId(socialId); if(user == null){ new IllegalArgumentException("해당하는 소셜아이디를 찾을 수 없습니다."); }
Store store = storeRepository.findById(storeId) .orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다."));
Review review = reviewRepository.findById(reviewId) .orElseThrow(() -> new IllegalArgumentException("해당하는 리뷰가 없습니다."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public Map<String, List<String>> getSigungu(@RequestParam(required = false) Stri
return storeService.getSigungu(sido);
}

@ApiOperation(value = "시/도, 시/군/구, 검색어를 이용해 업장 리스트를 조회하는 메소드")
@GetMapping("/search")
public List<StoreCardResponseDto> searchStoresByKeyword(
@RequestParam String sido,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mpnp/baechelin/store/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Slf4j
public class Store {
@Id
private int id;
private long id;

@Column(nullable = false)
private String category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UserRegisterStore extends TimeStamped {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private long id;

@Column(nullable = false)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Builder
@Slf4j
public class StoreCardResponseDto implements Comparable<StoreCardResponseDto> {
private int storeId;
private long storeId;
private String category;
private String name;
private BigDecimal latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

import java.util.List;

public interface StoreRepository extends JpaRepository<Store, Integer> {
public interface StoreRepository extends JpaRepository<Store, Long> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserRegisterStoreRepository extends JpaRepository<UserRegisterStore, Integer> {
public interface UserRegisterStoreRepository extends JpaRepository<UserRegisterStore, Long> {
Page<UserRegisterStore> findAll(Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private List<StoreCardResponseDto> getStoreCardResponseDtos(User targetUser, Lis
* @param socialId 유저 social 아이디
* @return 업장 상세 정보
*/
public StoreCardResponseDto getStore(int storeId, String socialId) {
public StoreCardResponseDto getStore(long storeId, String socialId) {
Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다."));

if (socialId == null) {
Expand Down

0 comments on commit 26a35a4

Please sign in to comment.