Skip to content

Commit

Permalink
refactor: ProductJpql 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Combi153 committed Feb 2, 2024
1 parent db33653 commit 4518dba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProductCustomRepositoryImpl(
) : ProductCustomRepository {

override fun findAllByCondition(condition: ProductReadCondition, paging: ProductPaging): List<ProductResponse> {
val query = jpql(ProductJpql) {
val query = jpql(ProductDynamicJpqlGenerator) {
selectNew<ProductResponse>(
entity(Product::class),
path(Store::name)
Expand All @@ -50,7 +50,7 @@ class ProductCustomRepositoryImpl(

// cache 추가하면 어떨까요?
override fun countByCondition(condition: ProductReadCondition): Int {
val query = jpql(ProductJpql) {
val query = jpql(ProductDynamicJpqlGenerator) {
select(
count(Product::id),
).from(
Expand All @@ -70,7 +70,7 @@ class ProductCustomRepositoryImpl(
}

override fun findBySearch(condition: ProductReadCondition, paging: ProductPaging): List<ProductResponse> {
val query = jpql(ProductJpql) {
val query = jpql(ProductDynamicJpqlGenerator) {
selectNew<ProductResponse>(
entity(Product::class),
path(Store::name)
Expand All @@ -94,7 +94,7 @@ class ProductCustomRepositoryImpl(
}

override fun findByKeywordSearch(condition: ProductReadCondition, paging: ProductPaging): List<ProductResponse> {
val query = jpql(ProductJpql) {
val query = jpql(ProductDynamicJpqlGenerator) {
selectNew<ProductResponse>(
entity(Product::class),
path(Store::name)
Expand All @@ -119,7 +119,7 @@ class ProductCustomRepositoryImpl(
}

override fun countByKeywordCondition(condition: ProductReadCondition): Int {
val query = jpql(ProductJpql) {
val query = jpql(ProductDynamicJpqlGenerator) {
select(
count(Product::id),
).from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import com.petqua.domain.recommendation.ProductRecommendation

private const val ESCAPE_LETTER = '\\'

class ProductJpql : Jpql() {
companion object Constructor : JpqlDsl.Constructor<ProductJpql> {
override fun newInstance(): ProductJpql = ProductJpql()
class ProductDynamicJpqlGenerator : Jpql() {
companion object Constructor : JpqlDsl.Constructor<ProductDynamicJpqlGenerator> {
override fun newInstance(): ProductDynamicJpqlGenerator = ProductDynamicJpqlGenerator()
}

fun Jpql.sortBy(sorter: Sorter): SortNullsStep? {
Expand Down

0 comments on commit 4518dba

Please sign in to comment.