사업자등록번호 유니크 문제 수정
This commit is contained in:
@@ -12,6 +12,11 @@ public interface PortalOrgRepository extends BaseRepository<PortalOrg, String> {
|
||||
|
||||
Optional<PortalOrg> findByCompRegNo(String compRegNo);
|
||||
|
||||
/**
|
||||
* 사업자등록번호 존재 여부 확인 (중복 데이터가 있어도 안전하게 처리)
|
||||
*/
|
||||
boolean existsByCompRegNo(String compRegNo);
|
||||
|
||||
long countByOrgStatusAndApprovalStatus(PortalOrgEnums.OrgStatus status, PortalOrgEnums.ApprovalStatus approvalStatus);
|
||||
|
||||
Optional<PortalOrg> findById(String orgId);
|
||||
|
||||
@@ -59,8 +59,8 @@ public class PortalOrgService {
|
||||
org.setApprovalStatus(ApprovalStatus.PENDING);
|
||||
}
|
||||
|
||||
// 사업자등록번호 중복 체크
|
||||
// 사업자등록번호 중복 체크 (Spring Data JPA의 existsBy 쿼리 사용 - 중복 데이터에도 안전)
|
||||
public boolean existsByCompRegNo(String compRegNo) {
|
||||
return portalOrgRepository.findByCompRegNo(compRegNo).isPresent();
|
||||
return portalOrgRepository.existsByCompRegNo(compRegNo);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user