| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | @Resource |
| | | private ProductMapper productMapper; |
| | | |
| | | @Override |
| | | public List<Product> selectProductByMaterialId(String materialId) { |
| | | return productMapper.selectProductByMaterialId(materialId); |
| | | } |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getListProductInformation(Integer materialId) { |
| | | public List<Map<String, Object>> getListProductInformation(String materialId) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Product::getMaterialId, materialId); |
| | | wrapper.select(Product::getId, Product::getName, Product::getFather); |
| | |
| | | |
| | | @Override |
| | | public Integer deleteProductInformation(Integer productId) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(Product::getId, productId); |
| | | return productMapper.delete(wrapper); |
| | | wrapper.set(Product::getState, 0); |
| | | return productMapper.update(new Product(), wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteProductEqMaterialId(List<String> materialListId) { |
| | | for (String materialId : materialListId){ |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | public void MaterialIdDeleteProduct(List<String> deleteMaterialId) { |
| | | for (String materialId : deleteMaterialId){ |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(Product::getMaterialId, materialId); |
| | | wrapper.select(Product::getId); |
| | | List<Product> products = productMapper.selectList(wrapper); |
| | | List<Integer> productDeleteId = new ArrayList<>(); |
| | | for (Product product : products){ |
| | | productDeleteId.add(product.getId()); |
| | | } |
| | | productMapper.deleteBatchIds(productDeleteId); |
| | | wrapper.set(Product::getState, 0); |
| | | productMapper.update(new Product(), wrapper); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateMaterialInformation(Product product) { |
| | | LambdaUpdateWrapper<Product> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Product::getId, product.getId()); |
| | | return productMapper.update(product, updateWrapper); |
| | | } |
| | | } |