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" } } 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) 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/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/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 // 매물 위치 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/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/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( 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) }