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.ProdInventoryBill;
import com.xingxi.business.ProdInventory.mapper.ProdInventoryBillMapper;
import com.xingxi.business.ProdInventory.service.IProdInventoryBillService;
import org.springframework.stereotype.Service;

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

/**
 * 商品库存流水Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class ProdInventoryBillServiceImpl implements IProdInventoryBillService {
    @Resource
    private ProdInventoryBillMapper prodInventoryBillMapper;

    /**
     * 查询商品库存流水
     *
     * @param inventoryBillId 商品库存流水主键
     * @return 商品库存流水
     */
    @Override
    public ProdInventoryBill selectProdInventoryBillByInventoryBillId(Long inventoryBillId) {
        return prodInventoryBillMapper.selectProdInventoryBillByInventoryBillId(inventoryBillId);
    }

    /**
     * 查询商品库存流水列表
     *
     * @param prodInventoryBill 商品库存流水
     * @return 商品库存流水
     */
    @Override
    public List<ProdInventoryBill> selectProdInventoryBillList(ProdInventoryBill prodInventoryBill) {
        return prodInventoryBillMapper.selectProdInventoryBillList(prodInventoryBill);
    }

    /**
     * 新增商品库存流水
     *
     * @param prodInventoryBill 商品库存流水
     * @return 结果
     */
    @Override
    public int insertProdInventoryBill(ProdInventoryBill prodInventoryBill) {
        prodInventoryBill.setCreateTime(DateUtils.getNowDate());
        return prodInventoryBillMapper.insertProdInventoryBill(prodInventoryBill);
    }

    /**
     * 新增商品库存流水
     *
     * @param prodInventoryBillList 商品库存流水
     * @return 结果
     */
    @Override
    public int batchInsertProdInventoryBill(List<ProdInventoryBill> prodInventoryBillList) {
        return prodInventoryBillMapper.batchInsertProdInventoryBill(prodInventoryBillList);
    }

    /**
     * 修改商品库存流水
     *
     * @param prodInventoryBill 商品库存流水
     * @return 结果
     */
    @Override
    public int updateProdInventoryBill(ProdInventoryBill prodInventoryBill) {
        prodInventoryBill.setUpdateTime(DateUtils.getNowDate());
        return prodInventoryBillMapper.updateProdInventoryBill(prodInventoryBill);
    }

    /**
     * 批量删除商品库存流水
     *
     * @param inventoryBillIds 需要删除的商品库存流水主键
     * @return 结果
     */
    @Override
    public int deleteProdInventoryBillByInventoryBillIds(String inventoryBillIds) {
        return prodInventoryBillMapper.deleteProdInventoryBillByInventoryBillIds(Convert.toStrArray(inventoryBillIds));
    }

    /**
     * 删除商品库存流水信息
     *
     * @param inventoryBillId 商品库存流水主键
     * @return 结果
     */
    @Override
    public int deleteProdInventoryBillByInventoryBillId(Long inventoryBillId) {
        return prodInventoryBillMapper.deleteProdInventoryBillByInventoryBillId(inventoryBillId);
    }

    /**
     * 逻辑删除商品库存流水
     *
     * @param inventoryBillId 商品库存流水主键
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryBillByInventoryBillId(Long inventoryBillId) {
        return prodInventoryBillMapper.logicDeleteProdInventoryBillByInventoryBillId(inventoryBillId);
    }

    /**
     * 逻辑批量删除商品库存流水
     *
     * @param inventoryBillIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryBillByInventoryBillIds(String[] inventoryBillIds) {
        return prodInventoryBillMapper.logicDeleteProdInventoryBillByInventoryBillIds(inventoryBillIds);
    }

    /**
     * 逻辑批量删除商品库存流水
     *
     * @param prodInventoryBill 商品库存流水
     * @return 结果
     */
    @Override
    public int logicDeleteProdInventoryBillByCondition(ProdInventoryBill prodInventoryBill) {
        return prodInventoryBillMapper.logicDeleteProdInventoryBillByCondition(prodInventoryBill);
    }
}
