package com.xtd.project.assets.service.impl;

import com.xtd.common.utils.DateUtils;
import com.xtd.project.assets.domain.DbAssetsStock;
import com.xtd.project.assets.domain.DbAssetsStockListVo;
import com.xtd.project.assets.domain.DbAssetsStockSelectVo;
import com.xtd.project.assets.mapper.DbAssetsStockMapper;
import com.xtd.project.assets.service.IDbAssetsStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库存管理Service业务层处理
 *
 * @author xtd
 * @date 2020-04-09
 */
@Service
public class DbAssetsStockServiceImpl implements IDbAssetsStockService
{
    @Autowired
    private DbAssetsStockMapper dbAssetsStockMapper;

    /**
     * 查询库存管理
     *
     * @param aId 库存管理ID
     * @return 库存管理
     */
    @Override
    public DbAssetsStock selectDbAssetsStockById(Long aId)
    {
        return dbAssetsStockMapper.selectDbAssetsStockById(aId);
    }

    /**
     * 查询库存管理列表
     *
     * @param dbAssetsStock 库存管理
     * @return 库存管理
     */
    @Override
    //@DataScope(deptAlias = "d", userAlias = "u")
    public List<DbAssetsStockListVo> selectDbAssetsStockList(DbAssetsStock dbAssetsStock)
    {
        return dbAssetsStockMapper.selectDbAssetsStockList(dbAssetsStock);
    }

    /**
     * 新增库存管理
     *
     * @param dbAssetsStock 库存管理
     * @return 结果
     */
    @Override
    public int insertDbAssetsStock(DbAssetsStock dbAssetsStock)
    {
        dbAssetsStock.setCreateTime(DateUtils.getNowDate());
        return dbAssetsStockMapper.insertDbAssetsStock(dbAssetsStock);
    }

    /**
     * 修改库存管理
     *
     * @param dbAssetsStock 库存管理
     * @return 结果
     */
    @Override
    public int updateDbAssetsStock(DbAssetsStock dbAssetsStock)
    {
        dbAssetsStock.setUpdateTime(DateUtils.getNowDate());
        return dbAssetsStockMapper.updateDbAssetsStock(dbAssetsStock);
    }

    /**
     * 批量删除库存管理
     *
     * @param aIds 需要删除的库存管理ID
     * @return 结果
     */
    @Override
    public int deleteDbAssetsStockByIds(Long[] aIds)
    {
        return dbAssetsStockMapper.deleteDbAssetsStockByIds(aIds);
    }

    /**
     * 删除库存管理信息
     *
     * @param aId 库存管理ID
     * @return 结果
     */
    @Override
    public int deleteDbAssetsStockById(Long aId)
    {
        return dbAssetsStockMapper.deleteDbAssetsStockById(aId);
    }

    @Override
    public List<DbAssetsStockSelectVo> selectlist(Long dbMaterielId,Integer status) {
        return dbAssetsStockMapper.selectlist(dbMaterielId,status);
    }
    @Override
    public List<DbAssetsStockSelectVo> out(Long depId,Long leadUserId,Integer status) {
        return dbAssetsStockMapper.out(depId,leadUserId,status);
    }

    @Override
    public List<DbAssetsStockListVo> export(DbAssetsStock dbAssetsStock) {
        return dbAssetsStockMapper.export(dbAssetsStock);
    }

}
