Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Tags
- springboot
- 자바스크립트
- postgresql
- baekjoon
- 플러터
- Oracle
- 백준
- 자바
- 스프링 부트 쇼핑몰 프로젝트 with JPA
- javascript
- Flutter
- 데이터
- 프로그래머스
- 파이썬
- 스프링
- 스프링부트
- Java
- Spring Security
- 리눅스
- 네트워크
- 자료구조
- spring
- JPA
- python
- CS지식
- 시큐리티
- 데이터베이스
- DB
- CS
- backjoon
Archives
- Today
- Total
Jin's Dev Story
[스프링 부트 쇼핑몰 프로젝트 with JPA] 17-4. 게시판 - Repository 본문
Web & Android/스프링 부트 쇼핑몰 프로젝트 with JPA
[스프링 부트 쇼핑몰 프로젝트 with JPA] 17-4. 게시판 - Repository
woojin._. 2023. 10. 16. 20:24이 내용은 스프링 부트 쇼핑몰 프로젝트 with JPA 책을 학습한 내용입니다.
Repository
BoardRepository
import com.example.walkingmate_back.board.entity.Board; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface BoardRepository extends JpaRepository<Board, Long> { // 게시글 전체 조회 - 최신 값부터 @Query("SELECT d FROM Board d ORDER BY d.id DESC") List<Board> findAllBoard(Pageable pageable); }
BoardCommentRepository
import com.example.walkingmate_back.board.entity.BoardComment; import org.springframework.data.jpa.repository.JpaRepository; public interface BoardCommentRepository extends JpaRepository<BoardComment, Long> { void deleteAllByParentId(Long id); }
RecommedCommentRepository
import com.example.walkingmate_back.board.entity.RecommendComment; import com.example.walkingmate_back.board.entity.RecommendCommentId; import org.springframework.data.jpa.repository.JpaRepository; public interface RecommendCommentRepository extends JpaRepository<RecommendComment, RecommendCommentId> { boolean existsByBoardCommentIdAndUserId(Long id, String userId); void deleteByBoardCommentIdAndUserId(Long id, String userId); }
RecommendRepository
import com.example.walkingmate_back.board.entity.Recommend; import com.example.walkingmate_back.board.entity.RecommendId; import org.springframework.data.jpa.repository.JpaRepository; public interface RecommendRepository extends JpaRepository<Recommend, RecommendId> { boolean existsByBoardIdAndUserId(Long id, String userId); void deleteByBoardIdAndUserId(Long id, String userId); }
'Web & Android > 스프링 부트 쇼핑몰 프로젝트 with JPA' 카테고리의 다른 글
[스프링 부트 쇼핑몰 프로젝트 with JPA] 17-3. 게시판 - Service (0) | 2023.10.16 |
---|---|
[스프링 부트 쇼핑몰 프로젝트 with JPA] 17-2. 게시판 - Controller (0) | 2023.10.16 |
[스프링 부트 쇼핑몰 프로젝트 with JPA] 17-1. 게시판 - Entity (1) | 2023.10.16 |
[스프링 부트 쇼핑몰 프로젝트 with JPA] 16.장바구니 상품 삭제 & 주문 (0) | 2023.10.16 |
[스프링 부트 쇼핑몰 프로젝트 with JPA] 15. 장바구니 조회 (1) | 2023.10.16 |