-
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 'dev' into fix/59-fix-searchApi
- Loading branch information
Showing
23 changed files
with
527 additions
and
4 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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/mapu/domain/figure/api/FigureController.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,28 @@ | ||
package com.mapu.domain.figure.api; | ||
|
||
import com.mapu.domain.figure.application.FigureService; | ||
import com.mapu.domain.figure.application.response.FigureResponseDTO; | ||
import com.mapu.global.common.response.BaseResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/figure") | ||
@RequiredArgsConstructor | ||
public class FigureController { | ||
|
||
private FigureService figureService; | ||
|
||
@GetMapping("/{figureId}") | ||
public BaseResponse<FigureResponseDTO> getFigure(@PathVariable Long figureId) { | ||
FigureResponseDTO figureDTO = figureService.getFigure(figureId); | ||
return new BaseResponse<>(figureDTO); | ||
} | ||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/mapu/domain/figure/application/FigureService.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,16 @@ | ||
package com.mapu.domain.figure.application; | ||
|
||
import com.mapu.domain.figure.application.response.FigureResponseDTO; | ||
import com.mapu.domain.figure.dao.FigureRepository; | ||
import com.mapu.domain.figure.domain.Figure; | ||
|
||
public class FigureService { | ||
|
||
private FigureRepository figureRepository; | ||
|
||
public FigureResponseDTO getFigure(Long figureId) { | ||
Figure figure = figureRepository.findById(figureId).orElseThrow(() -> new RuntimeException()); | ||
return FigureResponseDTO.from(figure); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/mapu/domain/figure/application/response/FigureResponseDTO.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,31 @@ | ||
package com.mapu.domain.figure.application.response; | ||
|
||
import com.mapu.domain.figure.domain.Figure; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class FigureResponseDTO { | ||
private Long id; | ||
private int type; | ||
private String address; | ||
private int round; | ||
private int area; | ||
private int length; | ||
private String name; | ||
private String text; | ||
|
||
public static FigureResponseDTO from(Figure figure) { | ||
return FigureResponseDTO.builder() | ||
.id(figure.getId()) | ||
.type(figure.getType().ordinal()) | ||
.address(figure.getAddress()) | ||
.round(figure.getRound()) | ||
.area(figure.getArea()) | ||
.length(figure.getLength()) | ||
.name(figure.getName()) | ||
.text(figure.getText()) | ||
.build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/mapu/domain/figure/dao/FigureRepository.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,20 @@ | ||
package com.mapu.domain.figure.dao; | ||
|
||
import com.mapu.domain.figure.domain.Figure; | ||
import com.mapu.domain.figure.domain.FigureType; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface FigureRepository extends JpaRepository<Figure, Long> { | ||
|
||
List<Figure> findByMapId(Long mapId); | ||
|
||
} |
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,58 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
import com.mapu.domain.map.domain.Map; | ||
import com.mapu.global.common.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
public class Figure extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "map_id") | ||
private Map map; | ||
|
||
@NotNull | ||
private FigureType type; | ||
|
||
@NotNull | ||
private String address; | ||
|
||
private int round; | ||
|
||
private int area; | ||
|
||
private int length; | ||
|
||
@NotNull | ||
private String name; | ||
|
||
@NotNull | ||
private String text; | ||
|
||
@OneToMany(mappedBy = "figure", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private List<FigureTag> tags = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "figure", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private List<FigureRate> rate = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "figure", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private List<FigureRate> relation = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "figure", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private List<FigureRate> vertex = new ArrayList<>(); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/mapu/domain/figure/domain/FigureRate.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,30 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
import com.mapu.global.common.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
public class FigureRate extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "figure_id") | ||
private Figure figure; | ||
|
||
@NotNull | ||
private String rate_name; | ||
|
||
@NotNull | ||
private int rate_star; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/mapu/domain/figure/domain/FigureRelation.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,26 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
import com.mapu.global.common.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
public class FigureRelation extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "figure1_id") | ||
private Figure figure; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "figure2_id") | ||
private Figure figure2; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/mapu/domain/figure/domain/FigureTag.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,27 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
import com.mapu.domain.map.domain.Map; | ||
import com.mapu.global.common.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
public class FigureTag extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "figure_id") | ||
private Figure figure; | ||
|
||
@NotNull | ||
private String tag; | ||
} |
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,5 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
public enum FigureType { | ||
POINT ,LINE, POLYGON | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/mapu/domain/figure/domain/FirgureVertex.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,31 @@ | ||
package com.mapu.domain.figure.domain; | ||
|
||
import com.mapu.global.common.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
public class FirgureVertex extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "figure_id") | ||
private Figure figure; | ||
|
||
@NotNull | ||
private double latitude; | ||
|
||
@NotNull | ||
private double longtitude; | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/mapu/domain/figure/exception/FigureException.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,4 @@ | ||
package com.mapu.domain.figure.exception; | ||
|
||
public class FigureException extends RuntimeException{ | ||
} |
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,32 @@ | ||
package com.mapu.domain.map.api; | ||
|
||
import com.mapu.global.common.response.BaseResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/home") | ||
@RequiredArgsConstructor | ||
public class HomeController { | ||
|
||
@RequestMapping("/editor") | ||
@GetMapping | ||
public BaseResponse<Void> getRecommandEditor() { | ||
return new BaseResponse<>(null); | ||
} | ||
|
||
@RequestMapping("/keyword") | ||
@GetMapping | ||
public BaseResponse<Void> getRecommandKeyword() { | ||
return new BaseResponse<>(null); | ||
} | ||
|
||
|
||
|
||
|
||
} |
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.