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.ProdInventoryOrderDetail;
import com.xingxi.business.ProdInventory.mapper.ProdInventoryOrderDetailMapper;
import com.xingxi.business.ProdInventory.service.IProdInventoryOrderDetailService;
import org.springframework.stereotype.Service;

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

/**
 * 商品出入库明细单Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class ProdInventoryOrderDetailServiceImpl implements IProdInventoryOrderDetailService {
    @Resource
    private ProdInventoryOrderDetailMapper prodInventoryOrderDetailMapper;

    /**
     * 查询商品出入库明细单
     *
     * @param inventoryOrderDetailId 商品出入库明细单主键
     * @return 商品出入库明细单
     */
    @Override
    public ProdInventoryOrderDetail selectProdInventoryOrderDetailByInventoryOrderDetailId(Long inventoryOrderDetailId) {
        return prodInventoryOrderDetailMapper.selectProdInventoryOrderDetailByInventoryOrderDetailId(inventoryOrderDetailId);
    }

    /**
     * 查询商品出入库明细单列表
     *
     * @param prodInventoryOrderDetail 商品出入库明细单
     * @return 商品出入库明细单
     */
    @Override
    public List<ProdInventoryOrderDetail> selectProdInventoryOrderDetailList(ProdInventoryOrderDetail prodInventoryOrderDetail) {
        return prodInventoryOrderDetailMapper.selectProdInventoryOrderDetailList(prodInventoryOrderDetail);
    }

    /**
     * 新增商品出入库明细单
     *
     * @param prodInventoryOrderDetail 商品出入库明细单
     * @return 结果
     */
    @Override
    public int insertProdInventoryOrderDetail(ProdInventoryOrderDetail prodInventoryOrderDetail) {
        prodInventoryOrderDetail.setCreateTime(DateUtils.getNowDate());
        return prodInventoryOrderDetailMapper.insertProdInventoryOrderDetail(prodInventoryOrderDetail);
    }

    /**
     * 新增商品出入库明细单
     *
     * @param prodInventoryOrderDetailList 商品出入库明细单
     * @return 结果
     */
    @Override
    public int batchInsertProdInventoryOrderDetail(List<ProdInventoryOrderDetail> prodInventoryOrderDetailList) {
        return prodInventoryOrderDetailMapper.batchInsertProdInventoryOrderDetail(prodInventoryOrderDetailList);
    }

    /**
     * 修改商品出入库明细单
     *
     * @param prodInventoryOrderDetail 商品出入库明细单
     * @return 结果
     */
    @Override
    public int updateProdInventoryOrderDetail(ProdInventoryOrderDetail prodInventoryOrderDetail) {
        prodInventoryOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return prodInventoryOrderDetailMapper.updateProdInventoryOrderDetail(prodInventoryOrderDetail);
    }

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

    /**
     * 删除商品出入库明细单信息
     *
     * @param inventoryOrderDetailId 商品出入库明细单主键
     * @return 结果
     */
    @Override
    public int deleteProdInventoryOrderDetailByInventoryOrderDetailId(Long inventoryOrderDetailId) {
        return prodInventoryOrderDetailMapper.deleteProdInventoryOrderDetailByInventoryOrderDetailId(inventoryOrderDetailId);
    }

    /**
     * 逻辑删除商品出入库明细单
     *
     * @param inventoryOrderDetailId 商品出入库明细单主键
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryOrderDetailByInventoryOrderDetailId(Long inventoryOrderDetailId) {
        return prodInventoryOrderDetailMapper.logicDeleteProdInventoryOrderDetailByInventoryOrderDetailId(inventoryOrderDetailId);
    }

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

    /**
     * 逻辑批量删除商品出入库明细单
     *
     * @param prodInventoryOrderDetail 商品出入库明细单
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryOrderDetailByCondition(ProdInventoryOrderDetail prodInventoryOrderDetail) {
        return prodInventoryOrderDetailMapper.logicDeleteProdInventoryOrderDetailByCondition(prodInventoryOrderDetail);
    }
}
