产品列表配置附加费
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.price.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.price.domain.PrcSurchargeRel;
|
||||
|
||||
/**
|
||||
* 附加费与产品/明细关联 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IPrcSurchargeRelService
|
||||
{
|
||||
/** 查询某产品已关联的附加费(含附加费与明细展示字段) */
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode);
|
||||
|
||||
public List<PrcSurchargeRel> selectPrcSurchargeRelList(PrcSurchargeRel rel);
|
||||
|
||||
public int insertPrcSurchargeRel(PrcSurchargeRel rel);
|
||||
|
||||
public int deletePrcSurchargeRelByIds(Long[] relIds);
|
||||
|
||||
/** 删除产品时清理其关联 */
|
||||
public int deleteRelByProductCodes(String[] productCodes);
|
||||
}
|
||||
+5
@@ -32,6 +32,7 @@ import com.ruoyi.price.domain.BmsProductCountry;
|
||||
import com.ruoyi.price.mapper.BmsProductCountryMapper;
|
||||
import com.ruoyi.price.mapper.BmsProductMapper;
|
||||
import com.ruoyi.price.service.IBmsProductService;
|
||||
import com.ruoyi.price.service.IPrcSurchargeRelService;
|
||||
import com.ruoyi.system.domain.BmsRegion;
|
||||
import com.ruoyi.system.mapper.BmsRegionMapper;
|
||||
|
||||
@@ -64,6 +65,9 @@ public class BmsProductServiceImpl implements IBmsProductService
|
||||
@Autowired
|
||||
private BmsRegionMapper regionMapper;
|
||||
|
||||
@Autowired
|
||||
private IPrcSurchargeRelService surchargeRelService;
|
||||
|
||||
@Override
|
||||
public BmsProduct selectBmsProductById(Long productId)
|
||||
{
|
||||
@@ -116,6 +120,7 @@ public class BmsProductServiceImpl implements IBmsProductService
|
||||
if (!codes.isEmpty())
|
||||
{
|
||||
countryMapper.deleteByProductCodes(codes.toArray(new String[0]));
|
||||
surchargeRelService.deleteRelByProductCodes(codes.toArray(new String[0]));
|
||||
}
|
||||
return productMapper.deleteBmsProductByIds(productIds);
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.price.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.price.domain.PrcSurchargeRel;
|
||||
import com.ruoyi.price.mapper.PrcSurchargeRelMapper;
|
||||
import com.ruoyi.price.service.IPrcSurchargeRelService;
|
||||
|
||||
/**
|
||||
* 附加费与产品/明细关联 服务层实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class PrcSurchargeRelServiceImpl implements IPrcSurchargeRelService
|
||||
{
|
||||
@Autowired
|
||||
private PrcSurchargeRelMapper relMapper;
|
||||
|
||||
@Override
|
||||
public List<PrcSurchargeRel> selectRelByProductCode(String productCode)
|
||||
{
|
||||
PrcSurchargeRel query = new PrcSurchargeRel();
|
||||
query.setProductCode(productCode);
|
||||
return relMapper.selectPrcSurchargeRelList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcSurchargeRel> selectPrcSurchargeRelList(PrcSurchargeRel rel)
|
||||
{
|
||||
return relMapper.selectPrcSurchargeRelList(rel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertPrcSurchargeRel(PrcSurchargeRel rel)
|
||||
{
|
||||
validate(rel);
|
||||
return relMapper.insertPrcSurchargeRel(rel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deletePrcSurchargeRelByIds(Long[] relIds)
|
||||
{
|
||||
if (relIds == null || relIds.length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return relMapper.deletePrcSurchargeRelByIds(relIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRelByProductCodes(String[] productCodes)
|
||||
{
|
||||
if (productCodes == null || productCodes.length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return relMapper.deleteRelByProductCodes(productCodes);
|
||||
}
|
||||
|
||||
private void validate(PrcSurchargeRel rel)
|
||||
{
|
||||
if (rel.getScId() == null)
|
||||
{
|
||||
throw new ServiceException("附加费ID不能为空");
|
||||
}
|
||||
if (rel.getProductId() == null)
|
||||
{
|
||||
throw new ServiceException("产品ID不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(rel.getProductCode()))
|
||||
{
|
||||
throw new ServiceException("产品代码不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user