Browse Source

11.18 制造商维护

Part Info By Customer
Part Info By Manufacturer
print/logistic/save
yuejiayang 1 year ago
parent
commit
5b16454ab2
  1. 11
      src/main/java/com/gaotao/modules/manufacturer/service/impl/ManufacturerInformationServiceImpl.java

11
src/main/java/com/gaotao/modules/manufacturer/service/impl/ManufacturerInformationServiceImpl.java

@ -8,6 +8,8 @@ import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.manufacturer.data.ManufacturerInformationData;
import com.gaotao.modules.manufacturer.mapper.ManufacturerInformationMapper;
import com.gaotao.modules.manufacturer.service.ManufacturerInformationService;
import com.gaotao.modules.part.entity.ExternalPartManufacturer;
import com.gaotao.modules.part.mapper.ExternalPartManufacturerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,6 +22,9 @@ public class ManufacturerInformationServiceImpl extends ServiceImpl<Manufacturer
@Autowired
private ManufacturerInformationMapper manufacturerInformationMapper;
@Autowired
private ExternalPartManufacturerMapper externalPartManufacturerMapper;
@Override
public PageUtils manufacturerInformationSearch(ManufacturerInformationData data) {
IPage<ManufacturerInformationData> resultList = this.manufacturerInformationMapper.manufacturerInformationSearch(new Page<ManufacturerInformationData>(data.getPage(), data.getLimit()), data);
@ -55,6 +60,12 @@ public class ManufacturerInformationServiceImpl extends ServiceImpl<Manufacturer
@Override
public void manufacturerInformationDelete(ManufacturerInformationData data) {
QueryWrapper<ExternalPartManufacturer> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("site", data.getSite()).eq("manufacturer_no", data.getManufacturerNo());
Integer count = externalPartManufacturerMapper.selectCount(queryWrapper);
if (count > 0) {
throw new RuntimeException("This manufacturer has been referenced and cannot be removed!");
}
manufacturerInformationMapper.deleteById(data);
}
}

Loading…
Cancel
Save