-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/query dsl 도입 및 적용하기 #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sososo0
wants to merge
8
commits into
develop
Choose a base branch
from
feature/query_dsl_적용
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "feature/query_dsl_\uC801\uC6A9"
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
abb411f
chore: query dsl 설정 추가
sososo0 6c65414
fixed utracked files
sososo0 3ec9ff6
feat: querydsl config 파일 작성
sososo0 8285634
refactor: attendance repository에 querydsl 적용
sososo0 f4d0df4
refactor: comment repository에 querydsl 적용
sososo0 aa27865
refactor: election repository에 query dsl 적용
sososo0 826a3f4
refactor: member repository에 query dsl 추가
sososo0 8f82725
refactor: post repository에 query dsl 적용
sososo0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,91 +1,91 @@ | ||
| @rem | ||
| @rem Copyright 2015 the original author or authors. | ||
| @rem | ||
| @rem Licensed under the Apache License, Version 2.0 (the "License"); | ||
| @rem you may not use this file except in compliance with the License. | ||
| @rem You may obtain a copy of the License at | ||
| @rem | ||
| @rem https://www.apache.org/licenses/LICENSE-2.0 | ||
| @rem | ||
| @rem Unless required by applicable law or agreed to in writing, software | ||
| @rem distributed under the License is distributed on an "AS IS" BASIS, | ||
| @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| @rem See the License for the specific language governing permissions and | ||
| @rem limitations under the License. | ||
| @rem | ||
|
|
||
| @if "%DEBUG%"=="" @echo off | ||
| @rem ########################################################################## | ||
| @rem | ||
| @rem Gradle startup script for Windows | ||
| @rem | ||
| @rem ########################################################################## | ||
|
|
||
| @rem Set local scope for the variables with windows NT shell | ||
| if "%OS%"=="Windows_NT" setlocal | ||
|
|
||
| set DIRNAME=%~dp0 | ||
| if "%DIRNAME%"=="" set DIRNAME=. | ||
| set APP_BASE_NAME=%~n0 | ||
| set APP_HOME=%DIRNAME% | ||
|
|
||
| @rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||
| for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||
|
|
||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||
|
|
||
| @rem Find java.exe | ||
| if defined JAVA_HOME goto findJavaFromJavaHome | ||
|
|
||
| set JAVA_EXE=java.exe | ||
| %JAVA_EXE% -version >NUL 2>&1 | ||
| if %ERRORLEVEL% equ 0 goto execute | ||
|
|
||
| echo. | ||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| echo. | ||
| echo Please set the JAVA_HOME variable in your environment to match the | ||
| echo location of your Java installation. | ||
|
|
||
| goto fail | ||
|
|
||
| :findJavaFromJavaHome | ||
| set JAVA_HOME=%JAVA_HOME:"=% | ||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
|
|
||
| if exist "%JAVA_EXE%" goto execute | ||
|
|
||
| echo. | ||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
| echo. | ||
| echo Please set the JAVA_HOME variable in your environment to match the | ||
| echo location of your Java installation. | ||
|
|
||
| goto fail | ||
|
|
||
| :execute | ||
| @rem Setup the command line | ||
|
|
||
| set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
|
|
||
|
|
||
| @rem Execute Gradle | ||
| "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | ||
|
|
||
| :end | ||
| @rem End local scope for the variables with windows NT shell | ||
| if %ERRORLEVEL% equ 0 goto mainEnd | ||
|
|
||
| :fail | ||
| rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
| rem the _cmd.exe /c_ return code! | ||
| set EXIT_CODE=%ERRORLEVEL% | ||
| if %EXIT_CODE% equ 0 set EXIT_CODE=1 | ||
| if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | ||
| exit /b %EXIT_CODE% | ||
|
|
||
| :mainEnd | ||
| if "%OS%"=="Windows_NT" endlocal | ||
|
|
||
| :omega | ||
| @rem | ||
| @rem Copyright 2015 the original author or authors. | ||
| @rem | ||
| @rem Licensed under the Apache License, Version 2.0 (the "License"); | ||
| @rem you may not use this file except in compliance with the License. | ||
| @rem You may obtain a copy of the License at | ||
| @rem | ||
| @rem https://www.apache.org/licenses/LICENSE-2.0 | ||
| @rem | ||
| @rem Unless required by applicable law or agreed to in writing, software | ||
| @rem distributed under the License is distributed on an "AS IS" BASIS, | ||
| @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| @rem See the License for the specific language governing permissions and | ||
| @rem limitations under the License. | ||
| @rem | ||
|
|
||
| @if "%DEBUG%"=="" @echo off | ||
| @rem ########################################################################## | ||
| @rem | ||
| @rem Gradle startup script for Windows | ||
| @rem | ||
| @rem ########################################################################## | ||
|
|
||
| @rem Set local scope for the variables with windows NT shell | ||
| if "%OS%"=="Windows_NT" setlocal | ||
|
|
||
| set DIRNAME=%~dp0 | ||
| if "%DIRNAME%"=="" set DIRNAME=. | ||
| set APP_BASE_NAME=%~n0 | ||
| set APP_HOME=%DIRNAME% | ||
|
|
||
| @rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||
| for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||
|
|
||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||
|
|
||
| @rem Find java.exe | ||
| if defined JAVA_HOME goto findJavaFromJavaHome | ||
|
|
||
| set JAVA_EXE=java.exe | ||
| %JAVA_EXE% -version >NUL 2>&1 | ||
| if %ERRORLEVEL% equ 0 goto execute | ||
|
|
||
| echo. | ||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| echo. | ||
| echo Please set the JAVA_HOME variable in your environment to match the | ||
| echo location of your Java installation. | ||
|
|
||
| goto fail | ||
|
|
||
| :findJavaFromJavaHome | ||
| set JAVA_HOME=%JAVA_HOME:"=% | ||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
|
|
||
| if exist "%JAVA_EXE%" goto execute | ||
|
|
||
| echo. | ||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
| echo. | ||
| echo Please set the JAVA_HOME variable in your environment to match the | ||
| echo location of your Java installation. | ||
|
|
||
| goto fail | ||
|
|
||
| :execute | ||
| @rem Setup the command line | ||
|
|
||
| set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
|
|
||
|
|
||
| @rem Execute Gradle | ||
| "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | ||
|
|
||
| :end | ||
| @rem End local scope for the variables with windows NT shell | ||
| if %ERRORLEVEL% equ 0 goto mainEnd | ||
|
|
||
| :fail | ||
| rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
| rem the _cmd.exe /c_ return code! | ||
| set EXIT_CODE=%ERRORLEVEL% | ||
| if %EXIT_CODE% equ 0 set EXIT_CODE=1 | ||
| if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | ||
| exit /b %EXIT_CODE% | ||
|
|
||
| :mainEnd | ||
| if "%OS%"=="Windows_NT" endlocal | ||
|
|
||
| :omega |
This file contains hidden or 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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/keeper/homepage/domain/attendance/dao/AttendanceRepositoryCustom.java
This file contains hidden or 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,14 @@ | ||
| package com.keeper.homepage.domain.attendance.dao; | ||
|
|
||
| import com.keeper.homepage.domain.attendance.entity.Attendance; | ||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public interface AttendanceRepositoryCustom { | ||
|
|
||
| List<Attendance> findAllRecent(@Param("member") Member member, @Param("localDate") LocalDate localDate); | ||
|
|
||
| } |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/keeper/homepage/domain/attendance/dao/AttendanceRepositoryImpl.java
This file contains hidden or 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 com.keeper.homepage.domain.attendance.dao; | ||
|
|
||
|
|
||
| import com.keeper.homepage.domain.attendance.entity.Attendance; | ||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import com.querydsl.jpa.impl.JPAQueryFactory; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| import static com.keeper.homepage.domain.attendance.entity.QAttendance.*; | ||
|
|
||
| @RequiredArgsConstructor | ||
| public class AttendanceRepositoryImpl implements AttendanceRepositoryCustom { | ||
|
|
||
| private final JPAQueryFactory queryFactory; | ||
|
|
||
| @Override | ||
| public List<Attendance> findAllRecent(@Param("member") Member member, @Param("localDate") LocalDate localDate) { | ||
| return queryFactory | ||
| .selectFrom(attendance) | ||
| .where( | ||
| attendance.member.eq(member) | ||
| .and(attendance.date.goe(localDate)) | ||
| ) | ||
| .fetch(); | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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/java/com/keeper/homepage/domain/comment/dao/CommentRepositoryCustom.java
This file contains hidden or 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.keeper.homepage.domain.comment.dao; | ||
|
|
||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| public interface CommentRepositoryCustom { | ||
|
|
||
| void updateVirtualMember(@Param("member") Member member, @Param("virtualMember") Member virtualMember); | ||
|
|
||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/keeper/homepage/domain/comment/dao/CommentRepositoryImpl.java
This file contains hidden or 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,26 @@ | ||
| package com.keeper.homepage.domain.comment.dao; | ||
|
|
||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import com.querydsl.jpa.impl.JPAQueryFactory; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.jpa.repository.Modifying; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| import static com.keeper.homepage.domain.comment.entity.QComment.*; | ||
|
|
||
| @RequiredArgsConstructor | ||
| public class CommentRepositoryImpl implements CommentRepositoryCustom { | ||
|
|
||
| private final JPAQueryFactory jpaQueryFactory; | ||
|
|
||
| @Modifying | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 어노테이션은 어떤 역할을 하나요?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 조회를 제외한 쿼리를 직접 작성할 경우에 붙여줘야 하는 걸로 압니다! (맞나용?) |
||
| @Override | ||
| public void updateVirtualMember(@Param("member") Member member, @Param("virtualMember") Member virtualMember) { | ||
| jpaQueryFactory | ||
| .update(comment) | ||
| .set(comment.member, virtualMember) | ||
| .where(comment.member.eq(member)) | ||
| .execute(); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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/java/com/keeper/homepage/domain/election/dao/ElectionRepositoryCustom.java
This file contains hidden or 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.keeper.homepage.domain.election.dao; | ||
|
|
||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| public interface ElectionRepositoryCustom { | ||
|
|
||
| void updateVirtualMember(@Param("member") Member member, @Param("virtualMember") Member virtualMember); | ||
|
|
||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/keeper/homepage/domain/election/dao/ElectionRepositoryImpl.java
This file contains hidden or 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,26 @@ | ||
| package com.keeper.homepage.domain.election.dao; | ||
|
|
||
| import com.keeper.homepage.domain.member.entity.Member; | ||
| import com.querydsl.jpa.impl.JPAQueryFactory; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.jpa.repository.Modifying; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| import static com.keeper.homepage.domain.election.entity.QElection.*; | ||
|
|
||
| @RequiredArgsConstructor | ||
| public class ElectionRepositoryImpl implements ElectionRepositoryCustom { | ||
|
|
||
| private final JPAQueryFactory jpaQueryFactory; | ||
|
|
||
| @Modifying | ||
| @Override | ||
| public void updateVirtualMember(@Param("member") Member member, @Param("virtualMember") Member virtualMember) { | ||
| jpaQueryFactory | ||
| .update(election) | ||
| .set(election.member, virtualMember) | ||
| .where(election.member.eq(member)) | ||
| .execute(); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradlew, gradlew.bat 파일들이 올라갔는데 의도하신 건지 궁금합니당!