|
@@ -20,7 +20,7 @@ import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
-import static com.yc.ship.module.product.enums.ErrorCodeConstants.PRICE_VOYAGE_NOT_EXISTS;
|
|
|
+import static com.yc.ship.module.product.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
/**
|
|
|
* 航次价格 Service 实现类
|
|
@@ -46,6 +46,10 @@ public class PriceVoyageServiceImpl implements PriceVoyageService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long createPriceVoyage(PriceVoyageSaveReqVO createReqVO) {
|
|
|
+ PriceVoyageDO priceVoyageDO = priceVoyageMapper.selectByVoyageId(createReqVO.getVoyageId());
|
|
|
+ if(priceVoyageDO != null) {
|
|
|
+ throw exception(PRICE_VOYAGE_EXISTS);
|
|
|
+ }
|
|
|
// 插入
|
|
|
PriceVoyageDO priceVoyage = BeanUtils.toBean(createReqVO, PriceVoyageDO.class);
|
|
|
priceVoyageMapper.insert(priceVoyage);
|