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