Skip to content

Commit

Permalink
✨mission(#6) : setting repository & service
Browse files Browse the repository at this point in the history
  • Loading branch information
2ghrms committed Nov 7, 2024
1 parent 139ed72 commit fb60baa
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package umc.spring.repository.MemberMissionRepository;

import org.springframework.data.jpa.repository.JpaRepository;
import umc.spring.domain.mapping.MemberMission;
import umc.spring.repository.StoreRepository.StoreRepositoryCustom;

public interface MemberMissionRepository extends JpaRepository<MemberMission, Long>, MemberMissionRepositoryCustom {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package umc.spring.repository.MemberMissionRepository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import umc.spring.domain.mapping.MemberMission;

public interface MemberMissionRepositoryCustom {
Page<MemberMission> findMissionsByMemberAndStatus(Long memberId, String status, Long cursor, Pageable pageable);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package umc.spring.repository.MemberMissionRepository;

import com.querydsl.core.BooleanBuilder;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import umc.spring.domain.mapping.MemberMission;
import umc.spring.domain.mapping.QMemberMission;

import java.util.List;

@Repository
@RequiredArgsConstructor
public class MemberMissionRepositoryImpl implements MemberMissionRepository {
private final JPAQueryFactory jpaQueryFactory;
private final QMemberMission memberMission = QMemberMission.memberMission;

public List<MemberMission> dynamicQueryWithBooleanBuilder(String name, Float score) {
BooleanBuilder predicate = new BooleanBuilder();

return jpaQueryFactory
.selectFrom(memberMission)
.where(predicate)
.fetch();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package umc.spring.service.MemberMissionService;

public interface MemberMissionQueryService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package umc.spring.service.MemberMissionService;

public class MemberMissionQueryServiceImpl implements MemberMissionQueryService {
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package umc.spring.service.RegionService;
package umc.spring.service.ReviewService;

import umc.spring.domain.Store;

import java.util.List;
import java.util.Optional;

public interface RegionQueryService {
public interface ReviewQueryService {

Optional<Store> findStore(Long id);
List<Store> findStoresByNameAndScore(String name, Float score);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package umc.spring.service.RegionService;
package umc.spring.service.ReviewService;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -12,7 +12,7 @@
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class RegionQueryServiceImpl implements RegionQueryService {
public class ReviewQueryServiceImpl implements ReviewQueryService {

private final StoreRepository storeRepository;

Expand Down

0 comments on commit fb60baa

Please sign in to comment.