package com.ruoyi.asset.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.asset.mapper.TbAssetCategoryMapper;
import com.ruoyi.asset.domain.TbAssetCategory;
import com.ruoyi.asset.service.ITbAssetCategoryService;

/**
 * 资产分类Service业务层处理
 * 
 * @author 原动力
 * @date 2023-05-15
 */
@Service
public class TbAssetCategoryServiceImpl implements ITbAssetCategoryService 
{
    @Autowired
    private TbAssetCategoryMapper tbAssetCategoryMapper;

    /**
     * 查询资产分类
     * 
     * @param id 资产分类主键
     * @return 资产分类
     */
    @Override
    public TbAssetCategory selectTbAssetCategoryById(Long id)
    {
        return tbAssetCategoryMapper.selectTbAssetCategoryById(id);
    }

    /**
     * 查询资产分类列表
     * 
     * @param tbAssetCategory 资产分类
     * @return 资产分类
     */
    @Override
    public List<TbAssetCategory> selectTbAssetCategoryList(TbAssetCategory tbAssetCategory)
    {
        return tbAssetCategoryMapper.selectTbAssetCategoryList(tbAssetCategory);
    }

    /**
     * 新增资产分类
     * 
     * @param tbAssetCategory 资产分类
     * @return 结果
     */
    @Override
    public int insertTbAssetCategory(TbAssetCategory tbAssetCategory)
    {
        tbAssetCategory.setCreateTime(DateUtils.getNowDate());
        tbAssetCategory.setCreateBy(SecurityUtils.getUsername());
        return tbAssetCategoryMapper.insertTbAssetCategory(tbAssetCategory);
    }

    /**
     * 修改资产分类
     * 
     * @param tbAssetCategory 资产分类
     * @return 结果
     */
    @Override
    public int updateTbAssetCategory(TbAssetCategory tbAssetCategory)
    {
        tbAssetCategory.setUpdateTime(DateUtils.getNowDate());
        return tbAssetCategoryMapper.updateTbAssetCategory(tbAssetCategory);
    }

    /**
     * 批量删除资产分类
     * 
     * @param ids 需要删除的资产分类主键
     * @return 结果
     */
    @Override
    public int deleteTbAssetCategoryByIds(Long[] ids)
    {
        return tbAssetCategoryMapper.deleteTbAssetCategoryByIds(ids);
    }

    /**
     * 删除资产分类信息
     * 
     * @param id 资产分类主键
     * @return 结果
     */
    @Override
    public int deleteTbAssetCategoryById(Long id)
    {
        return tbAssetCategoryMapper.deleteTbAssetCategoryById(id);
    }
}
