-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from CoolPeace-yanolza/develop
01-12 오전 배포
- Loading branch information
Showing
24 changed files
with
371 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ain/java/com/coolpeace/domain/accommodation/repository/AccommodationRepositoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.coolpeace.domain.accommodation.repository; | ||
|
||
import com.coolpeace.domain.accommodation.entity.Accommodation; | ||
import java.util.List; | ||
|
||
public interface AccommodationRepositoryCustom { | ||
|
||
List<Accommodation> findAllBySigunguName(String name); | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/coolpeace/domain/accommodation/repository/AccommodationRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.coolpeace.domain.accommodation.repository; | ||
|
||
import static com.coolpeace.domain.accommodation.entity.QAccommodation.accommodation; | ||
|
||
import com.coolpeace.domain.accommodation.entity.Accommodation; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import java.util.List; | ||
|
||
public class AccommodationRepositoryImpl implements AccommodationRepositoryCustom { | ||
|
||
private JPAQueryFactory jpaQueryFactory; | ||
|
||
public AccommodationRepositoryImpl(JPAQueryFactory jpaQueryFactory) { | ||
this.jpaQueryFactory = jpaQueryFactory; | ||
} | ||
|
||
@Override | ||
public List<Accommodation> findAllBySigunguName(String name) { | ||
return jpaQueryFactory.selectFrom(accommodation) | ||
.where(accommodation.sigungu.name.eq(name)).fetch(); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
.../java/com/coolpeace/domain/coupon/dto/request/validator/CouponUpdateRequestValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.coolpeace.domain.coupon.dto.request.validator; | ||
|
||
import com.coolpeace.domain.coupon.dto.request.CouponRegisterRequest; | ||
import com.coolpeace.domain.coupon.dto.request.CouponUpdateRequest; | ||
import com.coolpeace.domain.coupon.entity.type.DiscountType; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.util.CollectionUtils; | ||
import org.springframework.validation.Errors; | ||
import org.springframework.validation.Validator; | ||
|
||
@Component | ||
public class CouponUpdateRequestValidator implements Validator { | ||
@Override | ||
public boolean supports(Class<?> clazz) { | ||
return CouponUpdateRequest.class.equals(clazz); | ||
} | ||
|
||
@Override | ||
public void validate(Object target, Errors errors) { | ||
CouponRegisterRequest request = (CouponRegisterRequest) target; | ||
|
||
// 할인 유형 | ||
if (request.discountType().equals(DiscountType.FIXED_PRICE)) { | ||
if (request.discountValue() < 100) { | ||
errors.reject("discountValue", | ||
"정액 할인일 경우 값을 100 이상으로 설정해야 합니다."); | ||
} | ||
} else { | ||
if (request.discountValue() > 100) { | ||
errors.reject("discountValue", | ||
"정률 할인일 경우 값을 100 이하로 설정해야 합니다."); | ||
} | ||
} | ||
|
||
// 특정 객실 등록 | ||
if (!request.registerAllRoom()) { | ||
if (CollectionUtils.isEmpty(request.registerRooms())) { | ||
errors.reject("registerRooms.empty", | ||
"등록할 객실 리스트가 비어 있습니다."); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/java/com/coolpeace/domain/coupon/repository/CouponRoomsRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.