Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public interface PinLocationRepository extends JpaRepository<PinLocation, Long>
ST_Y(pl.pin_point) AS lat,
ST_X(pl.pin_point) AS lng,
pl.detail_address AS detailAddress,
l.location AS region
l.location AS region,
CASE WHEN p.pin_type = 'STORE' THEN ep.discount ELSE NULL END AS discount
FROM pin_location pl
INNER JOIN pin p ON pl.pin_id = p.pin_id
INNER JOIN location l ON pl.location_id = l.location_id
Expand Down Expand Up @@ -79,7 +80,8 @@ List<MapPinView> findPinsInBoundingBox(
pl.detail_address AS detailAddress,
l.location AS region,
ST_Y(ST_SnapToGrid(pl.pin_point, :gridSize)) AS clusterLat,
ST_X(ST_SnapToGrid(pl.pin_point, :gridSize)) AS clusterLng
ST_X(ST_SnapToGrid(pl.pin_point, :gridSize)) AS clusterLng,
CASE WHEN p.pin_type = 'STORE' THEN ep.discount ELSE NULL END AS discount
FROM pin_location pl
INNER JOIN pin p ON pl.pin_id = p.pin_id
INNER JOIN location l ON pl.location_id = l.location_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface MapPinClusterView {
Double getClusterLat();

Double getClusterLng();

String getDiscount();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public record PinItemDTO(
double latitude, // ์œ„๋„ (latitude)
double longitude, // ๊ฒฝ๋„ (longitude)
String pinDetailAddress,
String pinLocation
String pinLocation,
String discount
Comment on lines 10 to +14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

ํ˜„์žฌ PinItemDTO์—์„œ latitude์™€ longitude๊ฐ€ ๊ธฐ๋ณธ ํƒ€์ž…์ธ double๋กœ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ์ด DTO๋กœ ๋ณ€ํ™˜๋˜๋Š” ์†Œ์Šค์ธ MapPinView์™€ MapPinClusterView ์ธํ„ฐํŽ˜์ด์Šค์—์„œ๋Š” ์œ„๊ฒฝ๋„ ๊ฐ’์„ ๋ž˜ํผ ํƒ€์ž…์ธ Double๋กœ ๋ฐ˜ํ™˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์กฐํšŒ ๊ฒฐ๊ณผ๋‚˜ ๋ฐ์ดํ„ฐ ์ •ํ•ฉ์„ฑ ๋ฌธ์ œ๋กœ ์ธํ•ด ์œ„๊ฒฝ๋„ ๊ฐ’์ด null๋กœ ๋ฐ˜ํ™˜๋˜๋Š” ๊ฒฝ์šฐ, ์ž๋ฐ”์˜ ์˜คํ†  ์–ธ๋ฐ•์‹ฑ(auto-unboxing) ๊ณผ์ •์—์„œ NullPointerException์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์•ˆ์ •์ ์ธ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด double ๋Œ€์‹  Double ํƒ€์ž…์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.

Suggested change
double latitude, // ์œ„๋„ (latitude)
double longitude, // ๊ฒฝ๋„ (longitude)
String pinDetailAddress,
String pinLocation
String pinLocation,
String discount
Double latitude, // ์œ„๋„ (latitude)
Double longitude, // ๊ฒฝ๋„ (longitude)
String pinDetailAddress,
String pinLocation,
String discount

) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public interface MapPinView {
Double getLng(); // ST_X(pin_point) โ†’ ๊ฒฝ๋„
String getDetailAddress();
String getRegion(); // location.location ์ปฌ๋Ÿผ (๋ฒ•์ •๋™ ์ฃผ์†Œ ๋ฌธ์ž์—ด)
String getDiscount();
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ private MapPinResDTO.PinItemDTO toDto(MapPinView view) {
view.getLat(),
view.getLng(),
view.getDetailAddress(),
view.getRegion()
view.getRegion(),
view.getDiscount()
);
}

Expand All @@ -99,7 +100,8 @@ private MapPinResDTO.PinItemDTO toDto(MapPinClusterView view) {
view.getLat(),
view.getLng(),
view.getDetailAddress(),
view.getRegion()
view.getRegion(),
view.getDiscount()
);
}

Expand Down
Loading