From 036e658a871daaaf8efe2cd11455b665b8ede7c4 Mon Sep 17 00:00:00 2001 From: dldmsql Date: Thu, 2 Nov 2023 22:10:25 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20#305=20=EA=B2=8C=EC=8B=9C=EA=B8=80,?= =?UTF-8?q?=20=EB=B9=88=EC=A7=91,=20=EC=9C=A0=EC=A0=80=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=EC=97=90=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/jhouse_server/domain/board/entity/Board.kt | 2 +- .../example/jhouse_server/domain/house/entity/House.kt | 7 +++++-- .../com/example/jhouse_server/domain/user/entity/User.kt | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/board/entity/Board.kt b/src/main/kotlin/com/example/jhouse_server/domain/board/entity/Board.kt index d52f8ed0..c97df0cf 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/board/entity/Board.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/board/entity/Board.kt @@ -15,7 +15,7 @@ import javax.persistence.* @Entity @Table( - name = "board" + name = "board", indexes = [Index(name = "idx__prefixCategory__category", columnList = "category, prefixCategory, useYn")] ) class Board( var title: String, diff --git a/src/main/kotlin/com/example/jhouse_server/domain/house/entity/House.kt b/src/main/kotlin/com/example/jhouse_server/domain/house/entity/House.kt index f11c705c..de980396 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/house/entity/House.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/house/entity/House.kt @@ -1,11 +1,14 @@ package com.example.jhouse_server.domain.house.entity -import com.example.jhouse_server.domain.board.entity.* +import com.example.jhouse_server.domain.board.entity.BoardImageUrlConverter import com.example.jhouse_server.domain.scrap.entity.Scrap import com.example.jhouse_server.domain.user.entity.User import com.example.jhouse_server.global.entity.BaseEntity import javax.persistence.* - +@Table(name = "house", + indexes = [Index(name = "idx__rental_type", columnList = "rentalType, useYn, tmpYn, reported, applied"), + Index(name = "idx__title", columnList = "title, useYn, tmpYn, reported, applied") + ]) @Entity class House( @Convert(converter = RentalTypeConverter::class) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/user/entity/User.kt b/src/main/kotlin/com/example/jhouse_server/domain/user/entity/User.kt index 0bf408d1..18c2b7c9 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/user/entity/User.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/user/entity/User.kt @@ -1,7 +1,6 @@ package com.example.jhouse_server.domain.user.entity import com.example.jhouse_server.domain.board.entity.Board -import com.example.jhouse_server.domain.scrap.entity.Scrap import com.example.jhouse_server.domain.comment.entity.Comment import com.example.jhouse_server.domain.house.entity.House import com.example.jhouse_server.domain.notification.entity.Notification @@ -9,12 +8,16 @@ import com.example.jhouse_server.domain.record.entity.Record import com.example.jhouse_server.domain.record_comment.entity.RecordComment import com.example.jhouse_server.domain.record_review.entity.RecordReview import com.example.jhouse_server.domain.record_review_apply.entity.RecordReviewApply +import com.example.jhouse_server.domain.scrap.entity.Scrap import com.example.jhouse_server.domain.user.WithdrawalUser -import com.example.jhouse_server.domain.user.entity.WithdrawalStatus.* +import com.example.jhouse_server.domain.user.entity.WithdrawalStatus.APPROVE import com.example.jhouse_server.global.entity.BaseEntity import org.springframework.util.StringUtils import javax.persistence.* - +@Table(name = "user", + indexes = [Index(name = "idx__email", columnList = "email"), + Index(name = "idx__nick_name", columnList = "nickName") + ]) @Entity @DiscriminatorValue("U") class User( From c7a502cbc1f3ff4e62568b717217464099e127fd Mon Sep 17 00:00:00 2001 From: dldmsql Date: Thu, 2 Nov 2023 22:10:56 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20#305=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=ED=8A=9C=EB=8B=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/board/repository/BoardRepositoryImpl.kt | 9 +++++++-- .../domain/house/repository/HouseRepositoryImpl.kt | 7 ++++++- .../domain/user/repository/UserRepositoryImpl.kt | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/board/repository/BoardRepositoryImpl.kt b/src/main/kotlin/com/example/jhouse_server/domain/board/repository/BoardRepositoryImpl.kt index 34da9ad9..354be2b6 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/board/repository/BoardRepositoryImpl.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/board/repository/BoardRepositoryImpl.kt @@ -98,8 +98,8 @@ class BoardRepositoryImpl( override fun getBoardAll(boardListDto: BoardListDto, pageable: Pageable): Page { val result = jpaQueryFactory .selectFrom(board) - .join(board.boardCode, boardCode).fetchJoin() - .join(board.user, user).fetchJoin() + .join(board.boardCode, boardCode) + .join(board.user, user) .leftJoin(board.comment, comment) .where( board.useYn.eq(true), @@ -114,6 +114,9 @@ class BoardRepositoryImpl( .fetch() val countQuery = jpaQueryFactory .selectFrom(board) + .join(board.boardCode, boardCode) + .join(board.user, user) + .leftJoin(board.comment, comment) .where( board.useYn.eq(true), filterWithPrefixCategory(boardListDto.prefix), @@ -190,6 +193,7 @@ class BoardRepositoryImpl( .fetch() val countQuery = jpaQueryFactory .selectFrom(board).distinct() + .join(board.comment, comment) .where( board.useYn.eq(true), comment.user.eq(user) @@ -217,6 +221,7 @@ class BoardRepositoryImpl( .fetch() val countQuery = jpaQueryFactory .selectFrom(board).distinct() + .join(board.love, love) .where( board.useYn.eq(true), love.user.eq(user) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/house/repository/HouseRepositoryImpl.kt b/src/main/kotlin/com/example/jhouse_server/domain/house/repository/HouseRepositoryImpl.kt index ea48c45a..e01b31b9 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/house/repository/HouseRepositoryImpl.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/house/repository/HouseRepositoryImpl.kt @@ -60,6 +60,8 @@ class HouseRepositoryImpl( val countQuery : Long = jpaQueryFactory .selectFrom(house) + .innerJoin(house.user) + .leftJoin(house.houseTag) .where( house.useYn.eq(true), // 삭제 X searchWithRentalType(houseListDto.rentalType), @@ -97,6 +99,7 @@ class HouseRepositoryImpl( val countQuery : Long = jpaQueryFactory .selectFrom(house) + .innerJoin(house.user) .where( house.useYn.eq(true), // 삭제 X house.reported.eq(false), // 신고 X @@ -115,7 +118,7 @@ class HouseRepositoryImpl( override fun getScrapHouseAll(user: User, filter: String?, pageable: Pageable): Page { val result = jpaQueryFactory .selectFrom(house) - .join(house.user, QUser.user).fetchJoin() + .join(house.user, QUser.user) .join(house.scrap, scrap) .where( house.useYn.eq(true), // 삭제 X @@ -128,6 +131,8 @@ class HouseRepositoryImpl( .fetch() val countQuery = jpaQueryFactory .selectFrom(house) + .join(house.user, QUser.user) + .join(house.scrap, scrap) .where( house.useYn.eq(true), // 삭제 X house.reported.eq(false), // 신고 X diff --git a/src/main/kotlin/com/example/jhouse_server/domain/user/repository/UserRepositoryImpl.kt b/src/main/kotlin/com/example/jhouse_server/domain/user/repository/UserRepositoryImpl.kt index d6685fa0..a18a549c 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/user/repository/UserRepositoryImpl.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/user/repository/UserRepositoryImpl.kt @@ -43,7 +43,7 @@ class UserRepositoryImpl( val total = jpaQueryFactory .selectFrom(user) .where(user.authority.eq(Authority.USER)) - .fetch().size.toLong() + .fetch().size.toLong() return getOrderAgeRateResult(queryResult, total) } @@ -66,7 +66,7 @@ class UserRepositoryImpl( .selectFrom(userJoinPath) .join(userJoinPath.user, user) .where(user.authority.eq(Authority.USER)) - .fetch().size.toLong() + .fetch().size.toLong() return getOrderJoinPathRateResult(queryResult, total) } From e55287b54f08cf70ed5e05d4e005b7894ce1ceff Mon Sep 17 00:00:00 2001 From: dldmsql Date: Thu, 2 Nov 2023 22:13:08 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20#305=20ehcache=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=A7=81=EB=A0=AC=ED=99=94=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/jhouse_server/domain/house/dto/HouseReqDto.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/house/dto/HouseReqDto.kt b/src/main/kotlin/com/example/jhouse_server/domain/house/dto/HouseReqDto.kt index 04936e17..a00102b9 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/house/dto/HouseReqDto.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/house/dto/HouseReqDto.kt @@ -11,7 +11,6 @@ import java.sql.Timestamp import java.util.* import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern -import kotlin.streams.toList /** * ================================================================================================ @@ -79,7 +78,7 @@ data class MyHouseResDto( * 빈집 매물 게시글 리스트 조회 시, 응답 DTO * ================================================================================================ * */ -class HouseResDto() { +class HouseResDto() : Serializable { var houseId: Long = 0 // 게시글 아이디 lateinit var rentalType: RentalType // 매물 유형 lateinit var city: String // 매물 위치 From 07843e979c94a3feffbfd0b8d2519a08d59d9385 Mon Sep 17 00:00:00 2001 From: dldmsql Date: Thu, 2 Nov 2023 22:13:23 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20#305=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/jhouse_server/domain/board/dto/BoardReqDto.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/example/jhouse_server/domain/board/dto/BoardReqDto.kt b/src/main/kotlin/com/example/jhouse_server/domain/board/dto/BoardReqDto.kt index c1dd940a..652fd22a 100644 --- a/src/main/kotlin/com/example/jhouse_server/domain/board/dto/BoardReqDto.kt +++ b/src/main/kotlin/com/example/jhouse_server/domain/board/dto/BoardReqDto.kt @@ -7,7 +7,6 @@ import com.example.jhouse_server.domain.comment.dto.CommentResDto import java.sql.Timestamp import java.util.* import javax.validation.constraints.NotNull -import kotlin.streams.toList /** * ============================================================================================= * REQUEST DTO @@ -84,6 +83,12 @@ fun toListDto(board : Board) : BoardResDto { fun toDto(board: Board) : BoardResOneDto { return BoardResOneDto(board.id, board.title, board.boardCode.code, board.user.nickName, Timestamp.valueOf(board.createdAt), board.imageUrls, board.love.size, board.category.name, board.prefixCategory.name, board.comment.size, board.comment.stream().map { com.example.jhouse_server.domain.comment.dto.toDto(it) }.toList()) } + +/** + * ============================================================================================= + * UTIL FUNCTION + * ============================================================================================= + * */ fun sliceContentWithRegex(content : String) : String { return if (content.length >= 200) { content.take(200) From dc41a7754a8ccb95dae2a4cd42cb62190ec2947c Mon Sep 17 00:00:00 2001 From: dldmsql Date: Thu, 2 Nov 2023 22:42:08 +0900 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20#305=20JDK17=20=EB=B2=84=EC=A0=84?= =?UTF-8?q?=20=EC=97=85=EA=B7=B8=EB=A0=88=EC=9D=B4=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD-dev.yml | 9 ++++----- .github/workflows/CD.yml | 9 ++++----- .github/workflows/CI-Sonar.yml | 8 ++++---- .github/workflows/CI.yml | 9 ++++----- build.gradle.kts | 5 ++--- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CD-dev.yml b/.github/workflows/CD-dev.yml index f4e08a08..95ec6890 100644 --- a/.github/workflows/CD-dev.yml +++ b/.github/workflows/CD-dev.yml @@ -13,12 +13,11 @@ jobs: steps: #jdk 세팅 - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: '11' - distribution: 'temurin' + java-version: 17 + distribution: 'zulu' #gradle 캐싱 - name: Gradle Caching diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 45fcb581..27ea58d7 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -18,12 +18,11 @@ jobs: steps: #jdk 세팅 - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: '11' - distribution: 'temurin' + java-version: 17 + distribution: 'zulu' #gradle 캐싱 - name: Gradle Caching diff --git a/.github/workflows/CI-Sonar.yml b/.github/workflows/CI-Sonar.yml index 28d9175b..ba3c96ea 100644 --- a/.github/workflows/CI-Sonar.yml +++ b/.github/workflows/CI-Sonar.yml @@ -23,11 +23,11 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: 11 - distribution: 'temurin' # Alternative distribution options are available + java-version: 17 + distribution: 'zulu' - name: Cache SonarCloud packages uses: actions/cache@v3 with: diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a79ccf11..e059076b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,12 +13,11 @@ jobs: steps: #jdk 세팅 - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: '11' - distribution: 'temurin' + java-version: 17 + distribution: 'zulu' #gradle 캐싱 - name: Gradle Caching diff --git a/build.gradle.kts b/build.gradle.kts index 4812ac46..74627f45 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,4 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.kapt3.base.Kapt.kapt plugins { id("org.springframework.boot") version "2.7.8" @@ -30,7 +29,7 @@ sonarqube { group = "com.example" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_11 +java.sourceCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() @@ -87,7 +86,7 @@ dependencies { tasks.withType { kotlinOptions { freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "11" + jvmTarget = "17" } }