Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #200 from FinFellows/develop
Browse files Browse the repository at this point in the history
[FIX]: policy detail 토큰 없이도 조회 가능하게 변경 (#199)
  • Loading branch information
sejineer authored Jan 17, 2024
2 parents 17a6690 + 27c26bb commit ee597f6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public Page<SearchPolicyInfoRes> findPolicyInfos(UserPrincipal userPrincipal, St

@Override
public PolicyInfoDetailRes findPolicyDetail(UserPrincipal userPrincipal, Long policyId) {
return policyInfoRepository.findPolicyDetail(policyId, userPrincipal.getId());
if(userPrincipal != null){
return policyInfoRepository.findPolicyDetailWithAuthorization(policyId, userPrincipal.getId());
}
return policyInfoRepository.findPolicyDetail(policyId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface PolicyInfoQueryDslRepository {

Page<SearchPolicyInfoRes> findPolicyInfos(String searchKeyword, Pageable pageable);
Page<SearchPolicyInfoRes> findPolicyInfosWithAuthorization(String searchKeyword, Pageable pageable, Long userId);
PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId);
PolicyInfoDetailRes findPolicyDetailWithAuthorization(Long policyId, Long userId);
PolicyInfoDetailRes findPolicyDetail(Long policyId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Page<SearchPolicyInfoRes> findPolicyInfos(String searchKeyword, Pageable
}

@Override
public PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId) {
public PolicyInfoDetailRes findPolicyDetailWithAuthorization(Long policyId, Long userId) {
QPolicyInfoBookmark policyInfoBookmark = QPolicyInfoBookmark.policyInfoBookmark;

List<PolicyInfoDetailRes> result = queryFactory
Expand Down Expand Up @@ -122,6 +122,39 @@ public PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId) {
return result.get(0);
}

@Override
public PolicyInfoDetailRes findPolicyDetail(Long policyId) {
List<PolicyInfoDetailRes> result = queryFactory
.select(new QPolicyInfoDetailRes(
Expressions.constant(false),
policyInfo.polyBizSjNm,
policyInfo.polyItcnCn,
policyInfo.sporCn,
policyInfo.bizPrdCn,
policyInfo.rqutPrdCn,
policyInfo.sporScvl,
policyInfo.ageInfo,
policyInfo.prcpCn,
policyInfo.accrRqisCn,
policyInfo.majrRqisCn,
policyInfo.empmSttsCn,
policyInfo.splzRlmRqisCn,
policyInfo.aditRscn,
policyInfo.prcpLmttTrgtCn,
policyInfo.rqutProcCn,
policyInfo.jdgnPresCn,
policyInfo.rqutUrla,
policyInfo.pstnPaprCn
))
.from(policyInfo)
.where(
policyInfo.id.eq(policyId)
)
.fetch();

return result.get(0);
}

private BooleanExpression searchEq(String searchKeyword) {
return searchKeyword != null ? policyInfo.polyBizSjNm.contains(searchKeyword).or(policyInfo.polyItcnCn.contains(searchKeyword)) : null;
}
Expand Down

0 comments on commit ee597f6

Please sign in to comment.