package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysCategoryMapper;
import com.ruoyi.system.domain.SysCategory;
import com.ruoyi.system.service.ISysCategoryService;

/**
 * 类别Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-22
 */
@Service
public class SysCategoryServiceImpl implements ISysCategoryService 
{
    @Autowired
    private SysCategoryMapper sysCategoryMapper;

    /**
     * 查询类别
     * 
     * @param id 类别主键
     * @return 类别
     */
    @Override
    public SysCategory selectSysCategoryById(Long id)
    {
        return sysCategoryMapper.selectSysCategoryById(id);
    }

    /**
     * 查询类别列表
     * 
     * @param sysCategory 类别
     * @return 类别
     */
    @Override
    public List<SysCategory> selectSysCategoryList(SysCategory sysCategory)
    {
        return sysCategoryMapper.selectSysCategoryList(sysCategory);
    }

    /**
     * 新增类别
     * 
     * @param sysCategory 类别
     * @return 结果
     */
    @Override
    public int insertSysCategory(SysCategory sysCategory)
    {
        sysCategory.setCreateTime(DateUtils.getNowDate());
        return sysCategoryMapper.insertSysCategory(sysCategory);
    }

    /**
     * 修改类别
     * 
     * @param sysCategory 类别
     * @return 结果
     */
    @Override
    public int updateSysCategory(SysCategory sysCategory)
    {
        sysCategory.setUpdateTime(DateUtils.getNowDate());
        return sysCategoryMapper.updateSysCategory(sysCategory);
    }

    /**
     * 批量删除类别
     * 
     * @param ids 需要删除的类别主键
     * @return 结果
     */
    @Override
    public int deleteSysCategoryByIds(Long[] ids)
    {
        return sysCategoryMapper.deleteSysCategoryByIds(ids);
    }

    /**
     * 删除类别信息
     * 
     * @param id 类别主键
     * @return 结果
     */
    @Override
    public int deleteSysCategoryById(Long id)
    {
        return sysCategoryMapper.deleteSysCategoryById(id);
    }
}
