| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.TechnologyMapper; |
| | | import com.yuanchu.mom.pojo.Product; |
| | | import com.yuanchu.mom.pojo.dto.ProductDto; |
| | | import com.yuanchu.mom.service.ProductService; |
| | | import com.yuanchu.mom.mapper.ProductMapper; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description 针对表【product】的数据库操作Service实现 |
| | | * @createDate 2023-07-26 16:00:44 |
| | | */ |
| | | * @author Administrator |
| | | * @description 针对表【product】的数据库操作Service实现 |
| | | * @createDate 2023-07-26 16:00:44 |
| | | */ |
| | | @Service |
| | | public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService{ |
| | | public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService { |
| | | |
| | | @Resource |
| | | private ProductMapper productMapper; |
| | | |
| | | @Override |
| | | public List<ProductDto> selectTreeProduct(String specifications, String project) { |
| | | return productMapper.selectTreeProduct(specifications, project); |
| | | } |
| | | @Resource |
| | | TechnologyMapper technologyMapper; |
| | | |
| | | //根据型号id查询项目(技术指标) |
| | | @Override |
| | | public List<Map<String, Object>> selectProductList(Integer specificationsId) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Product::getSpecificationsId, specificationsId); |
| | | wrapper.select(Product::getName, Product::getFather, Product::getRequired, Product::getInternal, Product::getUnit); |
| | | return productMapper.selectMaps(wrapper); |
| | | return productMapper.selectProductList(specificationsId); |
| | | } |
| | | |
| | | //根据型号id查询所有版本 |
| | | @Override |
| | | public List<Integer> selectVerByPro(Integer specificationsId) { |
| | | return productMapper.selectVerByPro(specificationsId); |
| | | } |
| | | |
| | | //右侧数据展示-->技术指标(检验项目) |
| | | @Override |
| | | public List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version, String message) { |
| | | return productMapper.selectAllPro(specificationsId, version, message); |
| | | } |
| | | |
| | | //右上角新增-->技术指标-->选择工序,工艺 |
| | | @Override |
| | | public List<Map<String, Object>> chooseTech(Integer specificationsId) { |
| | | return technologyMapper.chooseTech(specificationsId); |
| | | } |
| | | |
| | | //右上角新增-->技术指标-->选择项目父类 |
| | | @Override |
| | | public List<Map<String, Object>> chooseFather(Integer technologyId) { |
| | | return productMapper.chooseFather(technologyId); |
| | | } |
| | | |
| | | //右上角新增-->技术指标 |
| | | @Override |
| | | public void addProduct(Integer technologyId, ProductDto productDto) { |
| | | Product product = new Product(); |
| | | BeanUtils.copyProperties(productDto, product); |
| | | product.setTechnologyId(technologyId); |
| | | productMapper.insert(product); |
| | | } |
| | | |
| | | //填写标准值与内控值,鼠标移开保存 |
| | | @Override |
| | | public Integer write(Integer id, String required, String internal) { |
| | | Product product = new Product(); |
| | | product.setId(id); |
| | | product.setRequired(required); |
| | | product.setInternal(internal); |
| | | return productMapper.updateById(product); |
| | | } |
| | | |
| | | //添加同一个型号技术指标的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId,Integer version) { |
| | | List<Product> productList = productMapper.selAllBySpeId(specificationsId,version); |
| | | for (Product product : productList) { |
| | | product.setId(null); |
| | | //最新版本+1 |
| | | product.setVersion(productMapper.selectVerByPro(specificationsId).get(0)+1); |
| | | } |
| | | saveBatch(productList); |
| | | return productList.get(0).getVersion(); |
| | | } |
| | | |
| | | //删除 |
| | | @Override |
| | | public void delProById(Integer id) { |
| | | Product product = new Product(); |
| | | product.setId(id); |
| | | product.setState(0); |
| | | productMapper.updateById(product); |
| | | } |
| | | |
| | | //批量删除 |
| | | @Override |
| | | public void delAllPro(String ids) { |
| | | productMapper.delAllPro(ids); |
| | | } |
| | | |
| | | //查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | @Override |
| | | public List<Product> selProByVerSpe(Integer technologyId, Integer ver) { |
| | | return productMapper.selProByVerSpe(technologyId,ver); |
| | | } |
| | | } |
| | | |