| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.WarehouseAreaParam; |
| | | import com.vincent.rsf.server.manager.mapper.WarehouseAreasMapper; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service("warehouseAreasService") |
| | | public class WarehouseAreasServiceImpl extends ServiceImpl<WarehouseAreasMapper, WarehouseAreas> implements WarehouseAreasService { |
| | | |
| | | /** |
| | | * 批量修改库区 |
| | | * |
| | | * @param params |
| | | * @param loginUserId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean batchUpdate(WarehouseAreaParam params, Long loginUserId) { |
| | | List<Long> ids = params.getIds(); |
| | | if (ids.isEmpty()) { |
| | | throw new CoolException("库区不能为空!!"); |
| | | } |
| | | List<WarehouseAreas> warehouseAreas = this.list(new LambdaQueryWrapper<WarehouseAreas>().in(WarehouseAreas::getId, ids)); |
| | | if (warehouseAreas.isEmpty()) { |
| | | throw new CoolException("所选库区不存在!!"); |
| | | } |
| | | WarehouseAreas areas = params.getWarehouseAreas(); |
| | | if (!this.update(new LambdaUpdateWrapper<WarehouseAreas>().in(WarehouseAreas::getId, ids) |
| | | .set(!Objects.isNull(areas.getName()), WarehouseAreas::getName, areas.getName()) |
| | | .set(!Objects.isNull(areas.getCode()), WarehouseAreas::getCode, areas.getCode()) |
| | | .set(!Objects.isNull(areas.getFlagMix()), WarehouseAreas::getFlagMix, areas.getFlagMix()) |
| | | .set(!Objects.isNull(areas.getFlagMinus()), WarehouseAreas::getFlagMinus, areas.getFlagMinus()) |
| | | .set(WarehouseAreas::getUpdateBy, loginUserId) |
| | | .set(!Objects.isNull(areas.getWarehouseId()), WarehouseAreas::getWarehouseId, areas.getWarehouseId()) |
| | | )) { |
| | | throw new CoolException("批量修改失败"); |
| | | } |
| | | return true; |
| | | } |
| | | } |