| | |
| | | package com.ruoyi.business.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.CoalFieldMapper; |
| | | import com.ruoyi.basic.mapper.CoalValueMapper; |
| | | import com.ruoyi.business.dto.PendingInventoryDto; |
| | | import com.ruoyi.business.entity.PendingInventory; |
| | | import com.ruoyi.business.mapper.PendingInventoryMapper; |
| | | import com.ruoyi.business.service.PendingInventoryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequiredArgsConstructor |
| | | public class PendingInventoryServiceImpl extends ServiceImpl<PendingInventoryMapper, PendingInventory> implements PendingInventoryService { |
| | | |
| | | private final PendingInventoryMapper pendingInventoryMapper; |
| | | |
| | | private final CoalValueMapper coalValueMapper; |
| | | |
| | | private final CoalFieldMapper coalFieldMapper; |
| | | |
| | | @Override |
| | | public IPage<PendingInventory> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) { |
| | | LambdaQueryWrapper<PendingInventory> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.orderByDesc(PendingInventory::getCreateTime); |
| | | return pendingInventoryMapper.selectPage(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public int addOrEditPending(PendingInventoryDto pendingInventoryDto) { |
| | | PendingInventory pendingInventory = new PendingInventory(); |
| | | BeanUtils.copyProperties(pendingInventoryDto, pendingInventory); |
| | | if (Objects.isNull(pendingInventoryDto.getId())) { |
| | | return pendingInventoryMapper.insert(pendingInventory); |
| | | } else { |
| | | return pendingInventoryMapper.updateById(pendingInventory); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int delByIds(Long[] ids) { |
| | | // 检查参数 |
| | | if (ids == null || ids.length == 0) { |
| | | return 0; |
| | | } |
| | | // 构造更新条件 |
| | | UpdateWrapper<PendingInventory> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.in("id", ids) |
| | | .set("deleted", 1); // 设置 deleted 为 1 表示已删除 |
| | | // 执行批量逻辑删除 |
| | | return pendingInventoryMapper.update(null, updateWrapper); |
| | | } |
| | | } |