package com.ruoyi.logistics.service.impl;

import java.util.Collections;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.logistics.mapper.BizWaybillCostDetailsMapper;
import com.ruoyi.logistics.domain.BizWaybillCostDetails;
import com.ruoyi.logistics.service.IBizWaybillCostDetailsService;

/**
 * 运单明细Service业务层处理
 * 
 * @author RuiJing
 * @date 2026-01-29
 */
@Service
public class BizWaybillCostDetailsServiceImpl implements IBizWaybillCostDetailsService 
{
    @Autowired
    private BizWaybillCostDetailsMapper bizWaybillCostDetailsMapper;

    /**
     * 查询运单明细
     * 
     * @param waybillDetailId 运单明细主键
     * @return 运单明细
     */
    @Override
    public BizWaybillCostDetails selectBizWaybillCostDetailsByWaybillDetailId(Long waybillDetailId)
    {
        return bizWaybillCostDetailsMapper.selectBizWaybillCostDetailsByWaybillDetailId(waybillDetailId);
    }

    /**
     * 查询运单明细列表
     * 
     * @param bizWaybillCostDetails 运单明细
     * @return 运单明细
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<BizWaybillCostDetails> selectBizWaybillCostDetailsList(BizWaybillCostDetails bizWaybillCostDetails)
    {
        return bizWaybillCostDetailsMapper.selectBizWaybillCostDetailsList(bizWaybillCostDetails);
    }

    /**
     * 新增运单明细
     * 
     * @param bizWaybillCostDetails 运单明细
     * @return 结果
     */
    @Override
    public int insertBizWaybillCostDetails(BizWaybillCostDetails bizWaybillCostDetails)
    {
        bizWaybillCostDetails.setCreateTime(DateUtils.getNowDate());
        return bizWaybillCostDetailsMapper.insertBizWaybillCostDetails(bizWaybillCostDetails);
    }

    /**
     * 修改运单明细
     * 
     * @param bizWaybillCostDetails 运单明细
     * @return 结果
     */
    @Override
    public int updateBizWaybillCostDetails(BizWaybillCostDetails bizWaybillCostDetails)
    {
        //修改运费明细后  会向修改记录插入数据




        bizWaybillCostDetails.setUpdateTime(DateUtils.getNowDate());
        return bizWaybillCostDetailsMapper.updateBizWaybillCostDetails(bizWaybillCostDetails);
    }

    /**
     * 批量删除运单明细
     * 
     * @param waybillDetailIds 需要删除的运单明细主键
     * @return 结果
     */
    @Override
    public int deleteBizWaybillCostDetailsByWaybillDetailIds(Long[] waybillDetailIds)
    {
        return bizWaybillCostDetailsMapper.deleteBizWaybillCostDetailsByWaybillDetailIds(waybillDetailIds);
    }

    /**
     * 删除运单明细信息
     * 
     * @param waybillDetailId 运单明细主键
     * @return 结果
     */
    @Override
    public int deleteBizWaybillCostDetailsByWaybillDetailId(Long waybillDetailId)
    {
        return bizWaybillCostDetailsMapper.deleteBizWaybillCostDetailsByWaybillDetailId(waybillDetailId);
    }

    @Override
    public List<BizWaybillCostDetails> selectBizWaybillCostDetailsListByWx(BizWaybillCostDetails bizWaybillCostDetails) {
        return bizWaybillCostDetailsMapper.selectBizWaybillCostDetailsListByWx(bizWaybillCostDetails);
    }
}
