| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.dto.WarehouseDto; |
| | | import com.yuanchu.mom.mapper.WarehouseCellMapper; |
| | |
| | | import com.yuanchu.mom.mapper.WarehouseMapper; |
| | | import com.yuanchu.mom.mapper.WarehouseShelfMapper; |
| | | import com.yuanchu.mom.pojo.Warehouse; |
| | | import com.yuanchu.mom.pojo.WarehouseCell; |
| | | import com.yuanchu.mom.pojo.WarehouseHistory; |
| | | import com.yuanchu.mom.pojo.WarehouseShelf; |
| | | import com.yuanchu.mom.service.WarehouseService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public List<WarehouseDto> selectWarehouse() { |
| | | return warehouseMapper.selectWarehouseList(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addShelf(WarehouseShelf warehouseShelf) { |
| | | warehouseShelfMapper.insert(warehouseShelf); |
| | | List<WarehouseCell> cells = new ArrayList<>(); |
| | | for (Integer i = 0; i < warehouseShelf.getRow(); i++) { |
| | | for (Integer a = 0; a < warehouseShelf.getCol(); a++) { |
| | | WarehouseCell cell = new WarehouseCell(); |
| | | cell.setRow(i); |
| | | cell.setCol(a); |
| | | cell.setState(1); |
| | | cells.add(cell); |
| | | } |
| | | } |
| | | warehouseCellMapper.saveBatch(cells); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delWarehouse(Integer id) { |
| | | warehouseShelfMapper.delete(Wrappers.<WarehouseShelf>lambdaUpdate().eq(WarehouseShelf::getWarehouseId, id)); |
| | | return warehouseMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public int upWarehouse(Warehouse warehouse) { |
| | | return warehouseMapper.updateById(warehouse); |
| | | } |
| | | } |
| | | |
| | | |