-
Notifications
You must be signed in to change notification settings - Fork 0
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 #243 from ODOICHON/dev
main <- dev (ODR-5)
- Loading branch information
Showing
12 changed files
with
290 additions
and
14 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,6 @@ class HouseController( | |
} | ||
|
||
/** | ||
<<<<<<< HEAD | ||
* ๋น์ง ๋งค๋ฌผ ์ํ ๋ณ๊ฒฝ | ||
* | ||
* @author dldmsql | ||
|
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
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/example/jhouse_server/domain/house/repository/DealRepositoryCustom.kt
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,10 @@ | ||
package com.example.jhouse_server.domain.house.repository | ||
|
||
import com.example.jhouse_server.admin.house.dto.AdminDealDto | ||
import com.example.jhouse_server.admin.house.dto.AdminHouseSearch | ||
import org.springframework.data.domain.Page | ||
import org.springframework.data.domain.Pageable | ||
|
||
interface DealRepositoryCustom { | ||
fun getReviewHouseListWithPaging(adminHouseSearch: AdminHouseSearch, pageable: Pageable): Page<AdminDealDto> | ||
} |
74 changes: 74 additions & 0 deletions
74
src/main/kotlin/com/example/jhouse_server/domain/house/repository/DealRepositoryImpl.kt
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,74 @@ | ||
package com.example.jhouse_server.domain.house.repository | ||
|
||
import com.example.jhouse_server.admin.house.dto.AdminDealDto | ||
import com.example.jhouse_server.admin.house.dto.AdminHouseSearch | ||
import com.example.jhouse_server.admin.house.dto.HouseSearchFilter | ||
import com.example.jhouse_server.domain.house.entity.Deal | ||
import com.example.jhouse_server.domain.house.entity.HouseReviewStatus | ||
import com.example.jhouse_server.domain.house.entity.QDeal | ||
import com.example.jhouse_server.domain.house.entity.QDeal.deal | ||
import com.example.jhouse_server.domain.house.entity.QHouse | ||
import com.example.jhouse_server.domain.house.entity.QHouse.house | ||
import com.example.jhouse_server.domain.user.entity.QUser | ||
import com.example.jhouse_server.domain.user.entity.QUser.user | ||
import com.querydsl.core.types.dsl.BooleanExpression | ||
import com.querydsl.jpa.impl.JPAQueryFactory | ||
import org.springframework.data.domain.Page | ||
import org.springframework.data.domain.Pageable | ||
import org.springframework.data.support.PageableExecutionUtils | ||
import java.time.LocalDate | ||
|
||
class DealRepositoryImpl( | ||
private var jpaQueryFactory: JPAQueryFactory | ||
) : DealRepositoryCustom { | ||
|
||
|
||
override fun getReviewHouseListWithPaging( | ||
adminHouseSearch: AdminHouseSearch, | ||
pageable: Pageable | ||
): Page<AdminDealDto> { | ||
val result = jpaQueryFactory | ||
.selectFrom(QDeal.deal) | ||
.leftJoin(QDeal.deal.house, house) | ||
.leftJoin(QDeal.deal.buyer, user) | ||
.where( | ||
searchFilter(adminHouseSearch), | ||
) | ||
.orderBy(deal.id.asc()) | ||
.limit(pageable.pageSize.toLong()) | ||
.offset(pageable.offset) | ||
.groupBy(deal) | ||
.fetch() | ||
val countQuery = jpaQueryFactory | ||
.selectFrom(QDeal.deal) | ||
.leftJoin(QDeal.deal.house, house) | ||
.leftJoin(QDeal.deal.buyer, user) | ||
.where( | ||
searchFilter(adminHouseSearch), | ||
) | ||
.orderBy(deal.id.asc()) | ||
.groupBy(deal) | ||
return PageableExecutionUtils.getPage(getDealDto(result), pageable) {countQuery.fetch().size.toLong()} | ||
} | ||
|
||
private fun getDealDto(result: List<Deal>): MutableList<AdminDealDto> { | ||
val list = mutableListOf<AdminDealDto>() | ||
result.forEach { | ||
list.add(AdminDealDto(it.id, it.buyer.nickName, it.house.title, it.score, it.dealDate, it.buyer.phoneNum, it.buyer.age.value, it.review, it.house.id)) | ||
} | ||
return list | ||
} | ||
|
||
/** | ||
* ๊ด๋ฆฌ์ ํ์ด์ง - ๋น์ง ๊ฑฐ๋ ์น์ธ | ||
* ๊ฒ์๊ธ ์ ๋ชฉ, ๋ด์ฉ, ์์ฑ์ ๊ฒ์ | ||
* */ | ||
private fun searchFilter(adminHouseSearch: AdminHouseSearch): BooleanExpression? { | ||
return when(adminHouseSearch.filter) { | ||
HouseSearchFilter.TITLE -> QHouse.house.title.contains(adminHouseSearch.keyword) | ||
HouseSearchFilter.CONTENT -> QHouse.house.content.contains(adminHouseSearch.keyword) | ||
HouseSearchFilter.WRITER -> QUser.user.nickName.contains(adminHouseSearch.keyword) | ||
else -> 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
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,149 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
|
||
<style> | ||
.container { | ||
max-width: 800px; | ||
} | ||
|
||
.dropdown-item:active { | ||
background-color: #FFBE3C; | ||
} | ||
caption { | ||
caption-side: top; | ||
text-align: right; | ||
} | ||
a{ | ||
text-decoration: none; | ||
color: #ffc107; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div th:replace="fragments/nav :: nav"/> | ||
<br> | ||
<br> | ||
<div class="container"> | ||
|
||
<form class="input-group" th:object="${searchForm}"> | ||
<div class="input-group row"> | ||
<div class="col-1"> | ||
</div> | ||
<div class="col-3"> | ||
<select class="form-select btn-outline-info" th:field="${searchForm.filter}"> | ||
<option selected th:value="${filterList[0]}" | ||
th:text="${filterList[2].value}">๊ฒ์๋ฌผ ์์ฑ์ | ||
</option> | ||
</select> | ||
</div> | ||
<div class="col-5"> | ||
<input type="text" class="form-control col-6" th:field="${searchForm.keyword}"> | ||
</div> | ||
<div class="col-2" style="float: right;"> | ||
<button type="submit" class="btn btn-warning">๊ฒ์</button> | ||
</div> | ||
<div class="col-1"> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<br> | ||
|
||
<table class="table" style="vertical-align: middle;"> | ||
<thead> | ||
<tr> | ||
<th scope="col">No.</th> | ||
<th scope="col">๊ฑฐ๋ ๋ง์กฑ๋</th> | ||
<th scope="col">๊ฑฐ๋ ๋ ์ง(ํ๋ฆฐ ๋ ์ง)</th> | ||
<th scope="col">๊ตฌ๋งค์ ์ ํ๋ฒํธ</th> | ||
<th scope="col">๊ตฌ๋งค์ ๋๋ค์</th> | ||
<th scope="col">๊ตฌ๋งค์ ์ฐ๋ น</th> | ||
<th scope="col">๊ฑฐ๋ ํ๊ธฐ</th> | ||
<th scope="col">๋น์ง ๊ฒ์๊ธ ์ ๋ชฉ</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr th:each="deal : ${dealList.content}"> | ||
<td th:text="${deal.id}"> | ||
1 | ||
</td> | ||
<td th:text="${deal.score}"> | ||
5 | ||
</td> | ||
<td th:text="${deal.dealDate}"> | ||
2023-09-01 | ||
</td> | ||
<td th:text="${deal.contact}"> | ||
010-0000-0000 | ||
</td> | ||
<td th:text="${deal.nickName}"> | ||
๊ด๋ฆฌ์1 | ||
</td> | ||
<td th:text="${deal.age}"> | ||
20๋ | ||
</td> | ||
<td th:text="${deal.review}"> | ||
๊ฑฐ๋ ๋ง์กฑํฉ๋๋ค. | ||
</td> | ||
<td> | ||
<a th:href="@{/admin/house/{id}(id=${deal.houseId})}" th:text="${deal.title}">๊ฒ์๊ธ ์ ๋ชฉ ๋ณด๊ธฐ</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
<nav aria-label="..." style="position:absolute; left: 50%; transform: translateX(-50%); bottom: 6%;"> | ||
<ul class="pagination pagination-sm"> | ||
<!-- ์ด์ ๋ฒํผ--> | ||
<li class="page-item" th:if="${pageCom gt 0}"> | ||
<a class="page-link" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=((5 *${pageCom})-1))}"> | ||
์ด์ </a> | ||
</li> | ||
<!-- ๋ฐ์ดํฐ ์กด์ฌ x ๊ฒฝ์ฐ--> | ||
<li class="page-item" th:if="${dealList.totalPages eq 0}"> | ||
<a class="page-link active" href="#">1</a> | ||
</li> | ||
<!-- ๋ง์ง๋ง ํ์ด์ง๊ฐ ์ํด ์์ง ์์ ๊ฒฝ์ฐ--> | ||
<li class="page-item" th:if="${dealList.totalPages gt 5*(pageCom + 1) and dealList.totalPages gt 0}" | ||
th:each="num : ${#numbers.sequence(pageCom*5 + 1 , 5*(pageCom + 1))}"> | ||
<a class="page-link active" th:if="${num eq dealList.pageable.pageNumber+1}" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=${num}-1)}" | ||
th:text="${num}">num</a> | ||
<a class="page-link" th:unless="${num eq dealList.pageable.pageNumber+1}" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=${num}-1)}" | ||
th:text="${num}">num</a> | ||
</li> | ||
<!-- ๋ง์ง๋ง ํ์ด์ง๊ฐ ์ํด์๋ ๊ฒฝ์ฐ--> | ||
<li class="page-item" th:if="${dealList.totalPages le 5*(pageCom + 1) and dealList.totalPages gt 0}" | ||
th:each="num : ${#numbers.sequence(pageCom*5 + 1, dealList.totalPages)}"> | ||
<a class="page-link active" th:if="${num eq dealList.pageable.pageNumber+1}" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=${num}-1)}" | ||
th:text="${num}">num</a> | ||
<a class="page-link" th:unless="${num eq dealList.pageable.pageNumber+1}" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=${num}-1)}" | ||
th:text="${num}">num</a> | ||
</li> | ||
<!-- ๋ค์ ๋ฒํผ--> | ||
<li class="page-item" th:if="${(dealList.totalPages / (5.0 *(pageCom+1))) gt 1}"> | ||
<a class="page-link" | ||
th:href="@{/admin/house/review(filter=${param.filter}, keyword=${param.keyword}, page=(5 *(${pageCom}+1)))}"> | ||
๋ค์</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" | ||
crossorigin="anonymous"> | ||
</script> | ||
<script th:inline="javascript"> | ||
|
||
</script> | ||
</body> | ||
</html> |
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.