¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.basic.mapper.ProductSupplierDensityMapper; |
| | | import com.ruoyi.basic.pojo.ProductSupplierDensity; |
| | | import com.ruoyi.basic.service.ProductSupplierDensityService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 产ååå®¶å¯åº¦ç»å®è¡¨ |
| | | * |
| | | * @author zhuo |
| | | * @since 2024-09-19 |
| | | */ |
| | | @Service |
| | | public class ProductSupplierDensityServiceImpl extends ServiceImpl<ProductSupplierDensityMapper, ProductSupplierDensity> implements ProductSupplierDensityService { |
| | | |
| | | @Override |
| | | public IPage<ProductSupplierDensity> selectByProductId(Page page, ProductSupplierDensity supplierDensity) { |
| | | if (supplierDensity.getProductId() == null) { |
| | | throw new BaseException("缺å°äº§å对象id"); |
| | | } |
| | | return baseMapper.selectListByProductId(page, QueryWrappers.queryWrappers(supplierDensity), supplierDensity.getProductId()); |
| | | } |
| | | |
| | | @Override |
| | | public void addProductSupplierDensity(ProductSupplierDensity supplierDensity) { |
| | | if (supplierDensity.getProductId() == null) { |
| | | throw new BaseException("缺å°äº§å对象id"); |
| | | } |
| | | // æ¥è¯¢æ¹åå®¶æ¯å¦ç»å®è¿ |
| | | // Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery() |
| | | // .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId()) |
| | | // .eq(ProductSupplierDensity::getModel, supplierDensity) |
| | | // .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName())); |
| | | // if (count > 0){ |
| | | // throw new BaseException("该产åå·²ç»å®è¿è¯¥åå®¶"); |
| | | // } |
| | | |
| | | baseMapper.insert(supplierDensity); |
| | | } |
| | | |
| | | @Override |
| | | public void updateProductSupplierDensity(ProductSupplierDensity supplierDensity) { |
| | | if (supplierDensity.getProductId() == null) { |
| | | throw new BaseException("缺å°äº§å对象id"); |
| | | } |
| | | // æ¥è¯¢æ¹åå®¶æ¯å¦ç»å®è¿ |
| | | // Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery() |
| | | // .ne(ProductSupplierDensity::getId, supplierDensity.getId()) |
| | | // .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId()) |
| | | // .eq(ProductSupplierDensity::getModel, supplierDensity) |
| | | // .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName())); |
| | | // if (count > 0){ |
| | | // throw new BaseException("该产åå·²ç»å®è¿è¯¥åå®¶"); |
| | | // } |
| | | baseMapper.updateById(supplierDensity); |
| | | } |
| | | } |
| | | |