Skip to content

Commit

Permalink
Merge pull request #14 from donggukthonN/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
minjeong073 authored Dec 19, 2023
2 parents bb67599 + b90252e commit a3f3864
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
@Getter
@NoArgsConstructor
public class LocationRequestDto {
private String roadName;
private String lotNumber;
private String address;
private Double latitude;
private Double longitude;

public Location toEntity(LocationRequestDto requestDto, Photo photo) {
return Location.builder()
.photo(photo)
.roadName(requestDto.getRoadName())
.lotNumber(requestDto.getLotNumber())
.address(requestDto.getAddress())
.latitude(requestDto.getLatitude())
.longitude(requestDto.getLongitude())
.build();
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/com/snowmanvillage/server/entity/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ public class Location extends BaseTimeEntity {
@JoinColumn(name="photo_id")
private Photo photo;

private String roadName;

private String lotNumber;
private String address;

private Double latitude;

private Double longitude;

@Builder
public Location(String roadName, String lotNumber, Double latitude, Double longitude) {
this.roadName = roadName;
this.lotNumber = lotNumber;
public Location(String address, Double latitude, Double longitude) {
this.address = address;
this.latitude = latitude;
this.longitude = longitude;
}
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/com/snowmanvillage/server/entity/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.web.ErrorResponse;
import lombok.Setter;

@Getter
@Entity
Expand All @@ -27,8 +27,10 @@ public class Photo extends BaseTimeEntity {

private String username;

@Setter
private String password;

@Setter
@Column(name = "like_count")
private Integer likeCount;

Expand All @@ -40,12 +42,4 @@ public Photo(String filePath, String title, String username, String password) {
this.password = password;
this.likeCount = 0;
}

public void setPassword(String encodedPassword) {
this.password = encodedPassword;
}

public void setLikeCount(int likeCount) {
this.likeCount = likeCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
@Repository
public interface LocationRepository extends JpaRepository<Location, Long> {

// roadName, lotNumber 에 searchValue 가 포함되어 있는 Location 을 반환
@Query("SELECT l.photo FROM Location l "
+ "WHERE l.roadName LIKE %:searchValue% "
+ "OR l.lotNumber LIKE %:searchValue%")
+ "WHERE l.address LIKE %:searchValue% ")
List<Photo> findByLocationContaining(@Param("searchValue") String searchValue);
}

0 comments on commit a3f3864

Please sign in to comment.