-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/query dsl 도입 및 적용하기 #433
base: develop
Are you sure you want to change the base?
The head ref may contain hidden characters: "feature/query_dsl_\uC801\uC6A9"
Changes from all commits
abb411f
6c65414
3ec9ff6
8285634
f4d0df4
aa27865
826a3f4
8f82725
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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); | ||
|
||
} |
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(); | ||
} | ||
|
||
} |
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); | ||
|
||
} |
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 | ||
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. 이 어노테이션은 어떤 역할을 하나요? 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(); | ||
} | ||
|
||
} |
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); | ||
|
||
} |
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(); | ||
} | ||
|
||
} |
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 파일들이 올라갔는데 의도하신 건지 궁금합니당!