Skip to content

Commit

Permalink
Merge pull request #399 from ungzzang/master
Browse files Browse the repository at this point in the history
프리미엄 학원 모든 배너 조회
  • Loading branch information
Leejungmin0426 authored Mar 4, 2025
2 parents 1faac2f + e50e9a1 commit 29be1a8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ public interface BannerRepository extends JpaRepository<Banner, Long> {
@Query("select new com.green.acamatch.academy.banner.model.BannerGetRes(a.acaId, a.acaName, a.bannerType, a.startDate, a.endDate,b.bannerPicIds.bannerPic, b.bannerPosition, b.bannerShow )FROM Banner a JOIN BannerPic b ON a.acaId = b.banner.acaId WHERE a.acaId= :acaId ORDER BY b.bannerPosition ASC")
List<BannerGetRes> findBanner(Long acaId);

//요청없이 모든 배너 조회
@Query("select new com.green.acamatch.academy.banner.model.BannerGetRes(a.acaId, a.acaName, a.bannerType, a.startDate, a.endDate,b.bannerPicIds.bannerPic, b.bannerPosition, b.bannerShow )FROM Banner a JOIN BannerPic b ON a.acaId = b.banner.acaId ORDER BY b.bannerPosition ASC")
List<BannerGetRes> findAllBanner();

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ public ResultResponse<List<BannerGetRes>> getBanner(BannerGetReq req) {
.resultData(res)
.build();
}

@GetMapping("all")
@Operation(summary = "모든 프리미엄학원 배너 조회 ")
public ResultResponse<List<BannerGetRes>> getBannerAll() {

List<BannerGetRes> res = bannerService.getBannerAll();
return ResultResponse.<List<BannerGetRes>>builder()
.resultMessage(academyMessage.getMessage())
.resultData(res)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ public List<BannerByPositionGetRes> getBannerByPosition(Long acaId, int position
@Transactional
public List<BannerGetRes> getBanner(Long acaId) {
List<BannerGetRes> res = bannerRepository.findBanner(acaId);
academyMessage.setMessage("%d번의, acaId" + "프리미엄학원의 배너가 조회되었습니다.");
return res;
}

@Transactional
public List<BannerGetRes> getBannerAll() {
List<BannerGetRes> res = bannerRepository.findAllBanner();
academyMessage.setMessage("프리미엄학원의 모든 배너가 조회되었습니다.");
return res;
}
}

0 comments on commit 29be1a8

Please sign in to comment.