package com.xingxi.business.ProdInventory.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.ProdInventory.domain.ProdInventoryOrder;
import com.xingxi.business.ProdInventory.mapper.ProdInventoryOrderMapper;
import com.xingxi.business.ProdInventory.service.IProdInventoryOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品出入库单Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class ProdInventoryOrderServiceImpl implements IProdInventoryOrderService {
    @Resource
    private ProdInventoryOrderMapper prodInventoryOrderMapper;

    /**
     * 查询商品出入库单
     *
     * @param inventoryOrderId 商品出入库单主键
     * @return 商品出入库单
     */
    @Override
    public ProdInventoryOrder selectProdInventoryOrderByInventoryOrderId(Long inventoryOrderId) {
        return prodInventoryOrderMapper.selectProdInventoryOrderByInventoryOrderId(inventoryOrderId);
    }

    /**
     * 查询商品出入库单列表
     *
     * @param prodInventoryOrder 商品出入库单
     * @return 商品出入库单
     */
    @Override
    public List<ProdInventoryOrder> selectProdInventoryOrderList(ProdInventoryOrder prodInventoryOrder) {
        return prodInventoryOrderMapper.selectProdInventoryOrderList(prodInventoryOrder);
    }

    /**
     * 新增商品出入库单
     *
     * @param prodInventoryOrder 商品出入库单
     * @return 结果
     */
    @Override
    public int insertProdInventoryOrder(ProdInventoryOrder prodInventoryOrder) {
        prodInventoryOrder.setCreateTime(DateUtils.getNowDate());
        return prodInventoryOrderMapper.insertProdInventoryOrder(prodInventoryOrder);
    }

    /**
     * 新增商品出入库单
     *
     * @param prodInventoryOrderList 商品出入库单
     * @return 结果
     */
    @Override
    public int batchInsertProdInventoryOrder(List<ProdInventoryOrder> prodInventoryOrderList) {
        return prodInventoryOrderMapper.batchInsertProdInventoryOrder(prodInventoryOrderList);
    }

    /**
     * 修改商品出入库单
     *
     * @param prodInventoryOrder 商品出入库单
     * @return 结果
     */
    @Override
    public int updateProdInventoryOrder(ProdInventoryOrder prodInventoryOrder) {
        prodInventoryOrder.setUpdateTime(DateUtils.getNowDate());
        return prodInventoryOrderMapper.updateProdInventoryOrder(prodInventoryOrder);
    }

    /**
     * 批量删除商品出入库单
     *
     * @param inventoryOrderIds 需要删除的商品出入库单主键
     * @return 结果
     */
    @Override
    public int deleteProdInventoryOrderByInventoryOrderIds(String inventoryOrderIds) {
        return prodInventoryOrderMapper.deleteProdInventoryOrderByInventoryOrderIds(Convert.toStrArray(inventoryOrderIds));
    }

    /**
     * 删除商品出入库单信息
     *
     * @param inventoryOrderId 商品出入库单主键
     * @return 结果
     */
    @Override
    public int deleteProdInventoryOrderByInventoryOrderId(Long inventoryOrderId) {
        return prodInventoryOrderMapper.deleteProdInventoryOrderByInventoryOrderId(inventoryOrderId);
    }

    /**
     * 逻辑删除商品出入库单
     *
     * @param inventoryOrderId 商品出入库单主键
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryOrderByInventoryOrderId(Long inventoryOrderId) {
        return prodInventoryOrderMapper.logicDeleteProdInventoryOrderByInventoryOrderId(inventoryOrderId);
    }

    /**
     * 逻辑批量删除商品出入库单
     *
     * @param inventoryOrderIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryOrderByInventoryOrderIds(String[] inventoryOrderIds) {
        return prodInventoryOrderMapper.logicDeleteProdInventoryOrderByInventoryOrderIds(inventoryOrderIds);
    }

    /**
     * 逻辑批量删除商品出入库单
     *
     * @param prodInventoryOrder 商品出入库单
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryOrderByCondition(ProdInventoryOrder prodInventoryOrder) {
        return prodInventoryOrderMapper.logicDeleteProdInventoryOrderByCondition(prodInventoryOrder);
    }
}
