package com.ruoyi.basicData.service.impl;


import com.ruoyi.basicData.domain.TWarehouseLocation;
import com.ruoyi.basicData.mapper.TWarehouseLocationMapper;
import com.ruoyi.basicData.service.ITWarehouseLocationService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库位Service业务层处理
 *
 * @author ruoyi
 * @date 2020-12-11
 */
@Service
public class TWarehouseLocationServiceImpl implements ITWarehouseLocationService {
    @Autowired
    private TWarehouseLocationMapper tWarehouseLocationMapper;

    /**
     * 查询库位
     *
     * @param fId 库位ID
     * @return 库位
     */
    @Override
    public TWarehouseLocation selectTWarehouseLocationById(Long fId) {
        return tWarehouseLocationMapper.selectTWarehouseLocationById(fId);
    }

    /**
     * 查询库位列表
     *
     * @param tWarehouseLocation 库位
     * @return 库位
     */
    @Override
    public List<TWarehouseLocation> selectTWarehouseLocationList(TWarehouseLocation tWarehouseLocation) {
        return tWarehouseLocationMapper.selectTWarehouseLocationList(tWarehouseLocation);
    }

    /**
     * 新增库位
     *
     * @param tWarehouseLocation 库位
     * @return 结果
     */
    @Override
    public int insertTWarehouseLocation(TWarehouseLocation tWarehouseLocation) {
        tWarehouseLocation.setCreateTime(DateUtils.getNowDate());
        return tWarehouseLocationMapper.insertTWarehouseLocation(tWarehouseLocation);
    }

    /**
     * 修改库位
     *
     * @param tWarehouseLocation 库位
     * @return 结果
     */
    @Override
    public int updateTWarehouseLocation(TWarehouseLocation tWarehouseLocation) {
        tWarehouseLocation.setUpdateTime(DateUtils.getNowDate());
        return tWarehouseLocationMapper.updateTWarehouseLocation(tWarehouseLocation);
    }

    /**
     * 批量删除库位
     *
     * @param fIds 需要删除的库位ID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseLocationByIds(Long[] fIds) {
        return tWarehouseLocationMapper.deleteTWarehouseLocationByIds(fIds);
    }

    /**
     * 删除库位信息
     *
     * @param fId 库位ID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseLocationById(Long fId) {
        return tWarehouseLocationMapper.deleteTWarehouseLocationById(fId);
    }
}
