package com.ruoyi.cs.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cs.mapper.CsTransferRecordMapper;
import com.ruoyi.cs.domain.CsTransferRecord;
import com.ruoyi.cs.service.ICsTransferRecordService;

import javax.annotation.Resource;

/**
 * 转单记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-29
 */
@Service
public class CsTransferRecordServiceImpl implements ICsTransferRecordService
{
    @Resource
    private CsTransferRecordMapper csTransferRecordMapper;

    /**
     * 查询转单记录
     *
     * @param transferRecordId 转单记录主键
     * @return 转单记录
     */
    @Override
    public CsTransferRecord selectCsTransferRecordByTransferRecordId(String transferRecordId)
    {
        return csTransferRecordMapper.selectCsTransferRecordByTransferRecordId(transferRecordId);
    }

    /**
     * 查询转单记录列表
     *
     * @param csTransferRecord 转单记录
     * @return 转单记录
     */
    @Override
    public List<CsTransferRecord> selectCsTransferRecordList(CsTransferRecord csTransferRecord)
    {
        return csTransferRecordMapper.selectCsTransferRecordList(csTransferRecord);
    }

    /**
     * 新增转单记录
     *
     * @param csTransferRecord 转单记录
     * @return 结果
     */
    @Override
    public int insertCsTransferRecord(CsTransferRecord csTransferRecord)
    {
        csTransferRecord.setTransferRecordId(IdUtil.getSnowflakeNextIdStr());
        csTransferRecord.setCreateAt(DateUtils.getNowDate());
        csTransferRecord.setDelFlag("0");
        return csTransferRecordMapper.insertCsTransferRecord(csTransferRecord);
    }

    /**
     * 修改转单记录
     *
     * @param csTransferRecord 转单记录
     * @return 结果
     */
    @Override
    public int updateCsTransferRecord(CsTransferRecord csTransferRecord)
    {
        csTransferRecord.setUpdateAt(DateUtils.getNowDate());
        return csTransferRecordMapper.updateCsTransferRecord(csTransferRecord);
    }

    /**
     * 批量删除转单记录
     *
     * @param transferRecordIds 需要删除的转单记录主键
     * @return 结果
     */
    @Override
    public int deleteCsTransferRecordByTransferRecordIds(String[] transferRecordIds)
    {
        return csTransferRecordMapper.deleteCsTransferRecordByTransferRecordIds(transferRecordIds);
    }

    /**
     * 删除转单记录信息
     *
     * @param transferRecordId 转单记录主键
     * @return 结果
     */
    @Override
    public int deleteCsTransferRecordByTransferRecordId(String transferRecordId)
    {
        return csTransferRecordMapper.deleteCsTransferRecordByTransferRecordId(transferRecordId);
    }
}
