-
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 pull request #146 from UMC-WOWMARKET/feat/MyOrderManage-137
[Feat] 수요조사 주문 테이블 생성
- Loading branch information
Showing
19 changed files
with
167 additions
and
30 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
31 changes: 31 additions & 0 deletions
31
src/main/java/wowmarket/wow_server/domain/DemandOrder.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 wowmarket.wow_server.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.ColumnDefault; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "demand_orders") | ||
@AttributeOverride(name = "created_time", column = @Column(name = "order_time")) | ||
public class DemandOrder extends BaseEntity{ | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "demand_order_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "buyer_id", referencedColumnName = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "demand_project_id", referencedColumnName = "demand_project_id") | ||
private DemandProject demandProject; | ||
|
||
@ColumnDefault("0") | ||
@Setter | ||
private int isDel; | ||
} |
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
12 changes: 12 additions & 0 deletions
12
...n/java/wowmarket/wow_server/mypage/myorder/demand/controller/MyDemandOrderController.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,12 @@ | ||
package wowmarket.wow_server.mypage.myorder.demand.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/myorder-demand") | ||
@RequiredArgsConstructor | ||
public class MyDemandOrderController { | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/wowmarket/wow_server/mypage/myorder/demand/dto/MyDemandOrderFormDto.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 wowmarket.wow_server.mypage.myorder.demand.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import wowmarket.wow_server.domain.DemandOrder; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class MyDemandOrderFormDto { | ||
private Long demand_order_id; | ||
private String name; | ||
private LocalDateTime createdtime; | ||
private int is_del; | ||
private String description; | ||
private String thumbnail; | ||
|
||
public MyDemandOrderFormDto(DemandOrder order){ | ||
this.demand_order_id = order.getId(); | ||
this.name = order.getDemandProject().getProjectName(); | ||
this.createdtime = order.getCreated_time(); | ||
this.is_del = order.getIsDel(); | ||
this.description = order.getDemandProject().getDescription(); | ||
this.thumbnail = order.getDemandProject().getThumbnail(); | ||
|
||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...java/wowmarket/wow_server/mypage/myorder/demand/dto/MyDemandOrderFormListResponseDto.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 wowmarket.wow_server.mypage.myorder.demand.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class MyDemandOrderFormListResponseDto { | ||
//나의 수요조사 주문폼 전체보기 리스트 dto | ||
private List<MyDemandOrderFormDto> demand_order_list; | ||
private int total_page; | ||
private int current_page; | ||
|
||
public MyDemandOrderFormListResponseDto(List<MyDemandOrderFormDto> demand_order_list, int total_page, int current_page){ | ||
this.demand_order_list = demand_order_list; | ||
this.total_page = total_page; | ||
this.current_page = current_page; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/wowmarket/wow_server/mypage/myorder/demand/service/MyOrderDemandService.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,34 @@ | ||
package wowmarket.wow_server.mypage.myorder.demand.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import org.springframework.web.server.ResponseStatusException; | ||
import wowmarket.wow_server.domain.DemandOrder; | ||
import wowmarket.wow_server.domain.User; | ||
import wowmarket.wow_server.mypage.myorder.demand.dto.MyDemandOrderFormDto; | ||
import wowmarket.wow_server.mypage.myorder.demand.dto.MyDemandOrderFormListResponseDto; | ||
import wowmarket.wow_server.repository.DemandDetailRepository; | ||
import wowmarket.wow_server.repository.DemandOrderRepository; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class MyOrderDemandService { | ||
private final DemandOrderRepository demandOrderRepository; | ||
private final DemandDetailRepository demandDetailRepository; | ||
|
||
@Transactional(readOnly = true) | ||
public MyDemandOrderFormListResponseDto findMyAllDemandOrderForm(Pageable pageable, User user){ | ||
if (user == null) | ||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST); | ||
Page<DemandOrder> demandOrders = demandOrderRepository.findByUser_Id(user.getId(), pageable); | ||
Page<MyDemandOrderFormDto> demandOrderFormDtos = demandOrders.map(MyDemandOrderFormDto::new); | ||
MyDemandOrderFormListResponseDto responseDto = new MyDemandOrderFormListResponseDto(demandOrderFormDtos.getContent(), | ||
demandOrderFormDtos.getTotalPages(), demandOrderFormDtos.getNumber()); | ||
return responseDto; | ||
} | ||
|
||
} |
19 changes: 9 additions & 10 deletions
19
...myorder/controller/MyOrderController.java → ...es/controller/MyOrderSalesController.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
...age/myorder/dto/MyOrderFormDetailDto.java → ...order/sales/dto/MyOrderFormDetailDto.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
5 changes: 1 addition & 4 deletions
5
...der/dto/MyOrderFormDetailResponseDto.java → ...les/dto/MyOrderFormDetailResponseDto.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
...er/dto/MyOrderFormItemListRequestDto.java → ...es/dto/MyOrderFormItemListRequestDto.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
3 changes: 1 addition & 2 deletions
3
...order/dto/MyOrderFormListResponseDto.java → ...sales/dto/MyOrderFormListResponseDto.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/myorder/dto/MyOrderFormResponseDto.java → ...der/sales/dto/MyOrderFormResponseDto.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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/wowmarket/wow_server/repository/DemandOrderRepository.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,11 @@ | ||
package wowmarket.wow_server.repository; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import wowmarket.wow_server.domain.DemandOrder; | ||
|
||
public interface DemandOrderRepository extends JpaRepository<DemandOrder, Long> { | ||
|
||
Page<DemandOrder> findByUser_Id(Long buyer_id, Pageable pageable); | ||
} |