| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | |
| | | |
| | | //新增销售单 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String addSale(String saleman, SaleDto saleDto) { |
| | | Sale sale = new Sale(); |
| | | BeanUtils.copyProperties(saleDto, sale); |
| | |
| | | |
| | | //根据销售单id删除 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delSale(Integer id) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setState(0); |
| | |
| | | |
| | | //根据id批量删除 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delAllSale(List<Integer> ids) { |
| | | List<Sale> sales = saleMapper.selectBatchIds(ids); |
| | | for (Sale sale : sales) { |
| | |
| | | |
| | | //根据销售单id修改信息 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateSaleById(String saleman, Integer id, SaleVo saleVo) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setSaleman(saleman); |
| | |
| | | List<SaleMaterialDto> saleMaterialDtos = saleVo.getSaleMaterialList(); |
| | | for (SaleMaterialDto saleMaterialDto : saleMaterialDtos) { |
| | | SaleMaterial saleMaterial = new SaleMaterial(); |
| | | BeanUtils.copyProperties(saleMaterialDto,saleMaterial); |
| | | BeanUtils.copyProperties(saleMaterialDto, saleMaterial); |
| | | saleMaterialMapper.updateById(saleMaterial); |
| | | } |
| | | } |
| | | |
| | | //审核 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void check(String checkname, Integer id, Integer type) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setType(type); |