This commit is contained in:
parent
c5fafdaeac
commit
e9b7e75810
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.onsaleproduct;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
|
|
@ -11,11 +12,13 @@ import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.HaoKaProductRes
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapi.vo.SuperiorApiRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.onsaleproduct.OnSaleProductMapper;
|
||||
import cn.iocoder.yudao.module.haoka.enums.LogRecordConstants;
|
||||
import cn.iocoder.yudao.module.haoka.service.orders.OrdersService;
|
||||
import cn.iocoder.yudao.module.haoka.service.product.HaoKaProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
|
|
@ -25,12 +28,14 @@ import com.mzt.logapi.context.LogRecordContext;
|
|||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
|
||||
import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.ON_SALE_PRODUCT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +43,7 @@ import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.ON_SALE_PRO
|
|||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Lazy
|
||||
@Service
|
||||
@Validated
|
||||
public class OnSaleProductServiceImpl extends ServiceImpl<OnSaleProductMapper,OnSaleProductDO> implements OnSaleProductService {
|
||||
|
|
@ -45,15 +51,22 @@ public class OnSaleProductServiceImpl extends ServiceImpl<OnSaleProductMapper,On
|
|||
@Resource
|
||||
private OnSaleProductMapper onSaleProductMapper;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private HaoKaProductService haoKaProductService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Override
|
||||
@LogRecord(type = LogRecordConstants.HAOKA_SALE_PRODUCT,
|
||||
subType = LogRecordConstants.HAOKA_UPDATE,
|
||||
|
|
@ -93,10 +106,10 @@ public class OnSaleProductServiceImpl extends ServiceImpl<OnSaleProductMapper,On
|
|||
// 校验存在
|
||||
validateOnSaleProductExists(id);
|
||||
|
||||
// List<OrdersDO> list = ordersService.list(new LambdaQueryWrapperX<OrdersDO>().eq(OrdersDO::getProductId, id));
|
||||
// if (CollectionUtil.isNotEmpty(list)){
|
||||
// throw invalidParamException("存在关联订单!");
|
||||
// }
|
||||
List<OrdersDO> list = ordersService.list(new LambdaQueryWrapperX<OrdersDO>().eq(OrdersDO::getProductId, id));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
throw invalidParamException("存在关联订单!");
|
||||
}
|
||||
// 删除
|
||||
onSaleProductMapper.deleteById(id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue