package com.ruoyi.business.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TOngoodsshelfMapper;
import com.ruoyi.business.domain.TOngoodsshelf;
import com.ruoyi.business.service.ITOngoodsshelfService;
import com.ruoyi.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
 * 入库任务单Service业务层处理
 * 
 * @author tony.wu
 * @date 2022-05-29
 */
@Service
public class TOngoodsshelfServiceImpl extends ServiceImpl<TOngoodsshelfMapper, TOngoodsshelf> implements ITOngoodsshelfService
{
    @Autowired
    private TOngoodsshelfMapper tOngoodsshelfMapper;

    /**
     * 查询入库任务单
     * 
     * @param lotId 入库任务单主键
     * @return 入库任务单
     */
    @Override
    public TOngoodsshelf selectTOngoodsshelfByLotId(String lotId)
    {
        return tOngoodsshelfMapper.selectTOngoodsshelfByLotId(lotId);
    }

    /**
     * 查询入库任务单列表
     * 
     * @param tOngoodsshelf 入库任务单
     * @return 入库任务单
     */
    @Override
    public List<TOngoodsshelf> selectTOngoodsshelfList(TOngoodsshelf tOngoodsshelf)
    {
        return tOngoodsshelfMapper.selectTOngoodsshelfList(tOngoodsshelf);
    }

    /**
     * 新增入库任务单
     * 
     * @param tOngoodsshelf 入库任务单
     * @return 结果
     */
    @Override
    public int insertTOngoodsshelf(TOngoodsshelf tOngoodsshelf)
    {
        return tOngoodsshelfMapper.insertTOngoodsshelf(tOngoodsshelf);
    }

    /**
     * 修改入库任务单
     * 
     * @param tOngoodsshelf 入库任务单
     * @return 结果
     */
    @Override
    public int updateTOngoodsshelf(TOngoodsshelf tOngoodsshelf)
    {
        return tOngoodsshelfMapper.updateTOngoodsshelf(tOngoodsshelf);
    }

    /**
     * 批量删除入库任务单
     * 
     * @param lotIds 需要删除的入库任务单主键
     * @return 结果
     */
    @Override
    public int deleteTOngoodsshelfByLotIds(String lotIds)
    {
        return tOngoodsshelfMapper.deleteTOngoodsshelfByLotIds(Convert.toStrArray(lotIds));
    }

    /**
     * 删除入库任务单信息
     * 
     * @param lotId 入库任务单主键
     * @return 结果
     */
    @Override
    public int deleteTOngoodsshelfByLotId(String lotId)
    {
        return tOngoodsshelfMapper.deleteTOngoodsshelfByLotId(lotId);
    }

    @Override
    @Transactional
    public int insertTOngoodsshelfValues(List<TOngoodsshelf> tOngoodsshelves) {
       int count = 0;
        for (TOngoodsshelf s:
             tOngoodsshelves) {
            tOngoodsshelfMapper.insertTOngoodsshelf(s);
            count++;
        }
        return count;
    }
}
