package com.ruoyi.warehouse.check.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.check.mapper.TWarehouseCheckItemsMapper;
import com.ruoyi.warehouse.check.domain.TWarehouseCheckItems;
import com.ruoyi.warehouse.check.service.ITWarehouseCheckItemsService;

/**
 * 巡检check-itemService业务层处理
 * 
 * @author dongyongwei
 * @date 2021-07-21
 */
@Service
public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsService 
{
    @Autowired
    private TWarehouseCheckItemsMapper tWarehouseCheckItemsMapper;

    /**
     * 查询巡检check-item
     * 
     * @param fId 巡检check-itemID
     * @return 巡检check-item
     */
    @Override
    public TWarehouseCheckItems selectTWarehouseCheckItemsById(Long fId)
    {
        return tWarehouseCheckItemsMapper.selectTWarehouseCheckItemsById(fId);
    }

    /**
     * 查询巡检check-item列表
     * 
     * @param tWarehouseCheckItems 巡检check-item
     * @return 巡检check-item
     */
    @Override
    public List<TWarehouseCheckItems> selectTWarehouseCheckItemsList(TWarehouseCheckItems tWarehouseCheckItems)
    {
        return tWarehouseCheckItemsMapper.selectTWarehouseCheckItemsList(tWarehouseCheckItems);
    }

    /**
     * 新增巡检check-item
     * 
     * @param tWarehouseCheckItems 巡检check-item
     * @return 结果
     */
    @Override
    public int insertTWarehouseCheckItems(TWarehouseCheckItems tWarehouseCheckItems)
    {
        tWarehouseCheckItems.setfCreateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        tWarehouseCheckItems.setfCreateTime(new Date());
        return tWarehouseCheckItemsMapper.insertTWarehouseCheckItems(tWarehouseCheckItems);
    }

    /**
     * 修改巡检check-item
     * 
     * @param tWarehouseCheckItems 巡检check-item
     * @return 结果
     */
    @Override
    public int updateTWarehouseCheckItems(TWarehouseCheckItems tWarehouseCheckItems)
    {
        tWarehouseCheckItems.setfUpdateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        tWarehouseCheckItems.setfUpdateTime(new Date());
        return tWarehouseCheckItemsMapper.updateTWarehouseCheckItems(tWarehouseCheckItems);
    }

    /**
     * 批量删除巡检check-item
     * 
     * @param fIds 需要删除的巡检check-itemID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseCheckItemsByIds(Long[] fIds)
    {
        return tWarehouseCheckItemsMapper.deleteTWarehouseCheckItemsByIds(fIds);
    }

    /**
     * 删除巡检check-item信息
     * 
     * @param fId 巡检check-itemID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseCheckItemsById(Long fId)
    {
        return tWarehouseCheckItemsMapper.deleteTWarehouseCheckItemsById(fId);
    }
}
