| | |
| | | ConvenientProductDO convenientProductDO = new ConvenientProductDO(); |
| | | BeanUtils.copyProperties(convenientProductDTO, convenientProductDO); |
| | | Date nowDate = new Date(); |
| | | if (convenientProductDTO.getOnShelf()) { |
| | | convenientProductDO.setOnShelfAt(nowDate); |
| | | } |
| | | convenientProductDO.setCreatedAt(nowDate); |
| | | this.baseMapper.insert(convenientProductDO); |
| | | Long productId = convenientProductDO.getId(); |
| | |
| | | Long productId = convenientProductDTO.getId(); |
| | | Long updatedBy = convenientProductDTO.getUpdatedBy(); |
| | | ConvenientProductDO convenientProductDO = this.baseMapper.selectById(productId); |
| | | Boolean isOnShelf = convenientProductDO.getOnShelf(); |
| | | if (isNull(convenientProductDO)) { |
| | | return R.fail("产品不存在"); |
| | | } |
| | | BeanUtils.copyProperties(convenientProductDTO, convenientProductDO); |
| | | Date nowDate = new Date(); |
| | | if (!isOnShelf && convenientProductDTO.getOnShelf()) { |
| | | convenientProductDO.setOnShelfAt(nowDate); |
| | | } |
| | | convenientProductDO.setUpdatedBy(updatedBy); |
| | | this.baseMapper.updateById(convenientProductDO); |
| | | List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList(); |
| | | List<Long> notNeedDelIds = productSpecificationDTOList.stream().filter(specificationDTO -> nonNull(specificationDTO.getId())) |
| | | .map(ConvenientProductSpecificationDTO::getId).collect(Collectors.toList()); |
| | | Date nowDate = new Date(); |
| | | productSpecificationDTOList.forEach(specificationDTO -> { |
| | | Long specificationId = specificationDTO.getId(); |
| | | if (isNull(specificationId)) { |