-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: project, admin 검색 기능 추가, participant - student 연결
- Loading branch information
1 parent
3ad7708
commit aacc960
Showing
20 changed files
with
256 additions
and
102 deletions.
There are no files selected for viewing
This file contains 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 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,8 @@ | ||
package kr.tgwing.tech.admin.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class StudentQuery { | ||
private String keyword = ""; | ||
} |
This file contains 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 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 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 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 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
38 changes: 38 additions & 0 deletions
38
src/main/java/kr/tgwing/tech/project/domain/ProjectSpecification.java
This file contains 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,38 @@ | ||
package kr.tgwing.tech.project.domain; | ||
|
||
import jakarta.persistence.criteria.Join; | ||
import jakarta.persistence.criteria.Predicate; | ||
import kr.tgwing.tech.user.entity.User; | ||
import org.springframework.data.jpa.domain.Specification; | ||
|
||
public class ProjectSpecification { | ||
public static Specification<Project> hasKeywordInProject(String keyword) { | ||
return (root, query, cb) -> { | ||
String pattern = "%" + keyword + "%"; | ||
|
||
Predicate title = cb.like(root.get("title"), pattern); | ||
Predicate description = cb.like(root.get("description"), pattern); | ||
|
||
Join<Project, Participant> participantJoin = root.join("participant"); | ||
Predicate name = cb.like(participantJoin.get("name"), pattern); | ||
Predicate studentNumber = cb.like(participantJoin.get("studentNumber"), pattern); | ||
|
||
return cb.or(title, description, name, studentNumber); | ||
}; | ||
} | ||
|
||
public static Specification<Project> hasKeywordInMyProject(String keyword) { | ||
return (root, query, cb) -> { | ||
String pattern = "%" + keyword + "%"; | ||
|
||
Predicate title = cb.like(root.get("title"), pattern); | ||
Predicate description = cb.like(root.get("description"), pattern); | ||
|
||
Join<Project, Participant> participantJoin = root.join("participant"); | ||
Predicate studentNumber = cb.equal(participantJoin.get("studentNumber"), pattern); | ||
|
||
return cb.or(title, description, studentNumber); | ||
}; | ||
} | ||
|
||
} |
This file contains 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 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 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,8 @@ | ||
package kr.tgwing.tech.project.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class ProjectQuery { | ||
private String keyword = ""; | ||
} |
Oops, something went wrong.