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.TWarehouseCheckItemsDetailsMapper;
import com.ruoyi.warehouse.check.domain.TWarehouseCheckItemsDetails;
import com.ruoyi.warehouse.check.service.ITWarehouseCheckItemsDetailsService;

/**
 * 巡检check-items-detailsService业务层处理
 * 
 * @author dongyongwei
 * @date 2021-07-21
 */
@Service
public class TWarehouseCheckItemsDetailsServiceImpl implements ITWarehouseCheckItemsDetailsService 
{
    @Autowired
    private TWarehouseCheckItemsDetailsMapper tWarehouseCheckItemsDetailsMapper;

    /**
     * 查询巡检check-items-details
     * 
     * @param fId 巡检check-items-detailsID
     * @return 巡检check-items-details
     */
    @Override
    public TWarehouseCheckItemsDetails selectTWarehouseCheckItemsDetailsById(Long fId)
    {
        return tWarehouseCheckItemsDetailsMapper.selectTWarehouseCheckItemsDetailsById(fId);
    }

    /**
     * 查询巡检check-items-details列表
     * 
     * @param tWarehouseCheckItemsDetails 巡检check-items-details
     * @return 巡检check-items-details
     */
    @Override
    public List<TWarehouseCheckItemsDetails> selectTWarehouseCheckItemsDetailsList(TWarehouseCheckItemsDetails tWarehouseCheckItemsDetails)
    {
        return tWarehouseCheckItemsDetailsMapper.selectTWarehouseCheckItemsDetailsList(tWarehouseCheckItemsDetails);
    }

    /**
     * 新增巡检check-items-details
     * 
     * @param tWarehouseCheckItemsDetails 巡检check-items-details
     * @return 结果
     */
    @Override
    public int insertTWarehouseCheckItemsDetails(TWarehouseCheckItemsDetails tWarehouseCheckItemsDetails)
    {
        tWarehouseCheckItemsDetails.setfCreateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        tWarehouseCheckItemsDetails.setfCreateTime(new Date());
        int i =tWarehouseCheckItemsDetailsMapper.insertTWarehouseCheckItemsDetails(tWarehouseCheckItemsDetails);
        System.out.println(tWarehouseCheckItemsDetails.getfId());
        return i;
    }

    /**
     * 修改巡检check-items-details
     * 
     * @param tWarehouseCheckItemsDetails 巡检check-items-details
     * @return 结果
     */
    @Override
    public int updateTWarehouseCheckItemsDetails(TWarehouseCheckItemsDetails tWarehouseCheckItemsDetails)
    {
        tWarehouseCheckItemsDetails.setfUpdateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        tWarehouseCheckItemsDetails.setfUpdateTime(new Date());
        return tWarehouseCheckItemsDetailsMapper.updateTWarehouseCheckItemsDetails(tWarehouseCheckItemsDetails);
    }

    /**
     * 批量删除巡检check-items-details
     * 
     * @param fIds 需要删除的巡检check-items-detailsID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseCheckItemsDetailsByIds(Long[] fIds)
    {
        return tWarehouseCheckItemsDetailsMapper.deleteTWarehouseCheckItemsDetailsByIds(fIds);
    }

    /**
     * 删除巡检check-items-details信息
     * 
     * @param fId 巡检check-items-detailsID
     * @return 结果
     */
    @Override
    public int deleteTWarehouseCheckItemsDetailsById(Long fId)
    {
        return tWarehouseCheckItemsDetailsMapper.deleteTWarehouseCheckItemsDetailsById(fId);
    }
}
