| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void addVipBenefits(MallVipBenefits mallVipBenefits) { |
| | | if (mallVipBenefits == null) { |
| | | return; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void delVipBenefits(Long id) { |
| | | this.baseMapper.deleteById(id); |
| | | |
| | |
| | | this.mallVipBenefitsDetailsService.remove(delQuery); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void editVipBenefits(MallVipBenefits mallVipBenefits) { |
| | | if (mallVipBenefits.getId() == null) { |
| | | throw new FebsException("缺少重要参数"); |
| | | } |
| | | |
| | | this.baseMapper.updateById(mallVipBenefits); |
| | | |
| | | LambdaQueryWrapper<MallVipBenefitsDetails> delQuery = new LambdaQueryWrapper<>(); |
| | | delQuery.eq(MallVipBenefitsDetails::getBenefitsId, mallVipBenefits.getId()); |
| | | this.mallVipBenefitsDetailsService.remove(delQuery); |
| | | |
| | | mallVipBenefits.getDetails().forEach(item -> { |
| | | item.setBenefitsId(mallVipBenefits.getId()); |
| | | }); |
| | | this.mallVipBenefitsDetailsService.saveBatch(mallVipBenefits.getDetails()); |
| | | |
| | | } |
| | | |
| | | |
| | | } |