| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.mapper.MaterialMapper; |
| | | import com.yuanchu.limslaboratory.mapper.ProductModelMapper; |
| | |
| | | //添加标准 |
| | | @Override |
| | | public void addproductModel(ProductModelDto productModelDto) { |
| | | ProductModel productModel = new ProductModel(); |
| | | BeanUtils.copyProperties(productModelDto,productModel); |
| | | productModelMapper.insert(productModel); |
| | | if (ObjectUtils.isEmpty(productModelDto.getFather())) { |
| | | ProductModel productModel = ProductModel.builder() |
| | | .name(productModelDto.getName()) |
| | | .material(productModelDto.getMaterial()) |
| | | .unit(productModelDto.getUnit()) |
| | | .build(); |
| | | productModelMapper.insert(productModel); |
| | | } else { |
| | | ProductModel productModel = new ProductModel(); |
| | | BeanUtils.copyProperties(productModelDto, productModel); |
| | | productModelMapper.insert(productModel); |
| | | } |
| | | //添加物料产品库 |
| | | Material material = new Material(); |
| | | material.setName(productModelDto.getName()).setCode(MyUtil.getTimeSixNumberCode("CP","CP")); |
| | | material.setName(productModelDto.getMaterial()).setCode(MyUtil.getTimeSixNumberCode("CP", "CP")); |
| | | materialMapper.insert(material); |
| | | } |
| | | |
| | | //查询标准模版列表 |
| | | @Override |
| | | public List<Map<String, Object>> selectproductModel(String name, String father, String material) { |
| | | return productModelMapper.selectproductModel(name,father,material); |
| | | return productModelMapper.selectproductModel(name, father, material); |
| | | } |
| | | |
| | | //根据id查询详情 |
| | |
| | | public ProductModelDto selectproductModelById(Integer id) { |
| | | ProductModel productModel = productModelMapper.selectById(id); |
| | | ProductModelDto productModelDto = new ProductModelDto(); |
| | | BeanUtils.copyProperties(productModel,productModelDto); |
| | | BeanUtils.copyProperties(productModel, productModelDto); |
| | | return productModelDto; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void writeproductModel(Integer id, ProductModelDto productModelDto) { |
| | | ProductModel productModel = new ProductModel(); |
| | | BeanUtils.copyProperties(productModelDto,productModel); |
| | | BeanUtils.copyProperties(productModelDto, productModel); |
| | | productModel.setId(id); |
| | | productModelMapper.updateById(productModel); |
| | | } |