|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|