package com.ruoyi.ems.service.impl;

import com.ruoyi.ems.domain.FacsSubCategory;
import com.ruoyi.ems.mapper.FacsSubCategoryMapper;
import com.ruoyi.ems.service.IFacsSubCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 能源设施/系统子类Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-10
 */
@Service
public class FacsSubCategoryServiceImpl implements IFacsSubCategoryService {
    @Autowired
    private FacsSubCategoryMapper subCategoryMapper;

    /**
     * 查询能源设施/系统子类
     *
     * @param id 能源设施/系统子类主键
     * @return 能源设施/系统子类
     */
    @Override
    public FacsSubCategory selectSubCategoryById(Long id) {
        return subCategoryMapper.selectSubCategoryById(id);
    }

    @Override
    public List<FacsSubCategory> selectSubCategoryList() {
        return subCategoryMapper.selectSubCategoryAll();
    }

    /**
     * 查询能源设施/系统子类列表
     *
     * @param subCategory 能源设施/系统子类
     * @return 能源设施/系统子类
     */
    @Override
    public List<FacsSubCategory> selectSubCategoryList(FacsSubCategory subCategory) {
        return subCategoryMapper.selectSubCategoryList(subCategory);
    }

    /**
     * 新增能源设施/系统子类
     *
     * @param subCategory 能源设施/系统子类
     * @return 结果
     */
    @Override
    public int insertSubCategory(FacsSubCategory subCategory) {
        return subCategoryMapper.insertSubCategory(subCategory);
    }

    @Override
    public void insertSubCategoryBatch(List<FacsSubCategory> subCategorys) {
        subCategoryMapper.insertSubCategoryBatch(subCategorys);
    }

    /**
     * 修改能源设施/系统子类
     *
     * @param subCategory 能源设施/系统子类
     * @return 结果
     */
    @Override
    public int updateSubCategory(FacsSubCategory subCategory) {
        return subCategoryMapper.updateSubCategory(subCategory);
    }

    /**
     * 批量删除能源设施/系统子类
     *
     * @param ids 需要删除的能源设施/系统子类主键
     * @return 结果
     */
    @Override
    public int deleteSubCategoryByIds(Long[] ids) {
        return subCategoryMapper.deleteSubCategoryByIds(ids);
    }

    /**
     * 删除能源设施/系统子类信息
     *
     * @param id 能源设施/系统子类主键
     * @return 结果
     */
    @Override
    public int deleteSubCategoryById(Long id) {
        return subCategoryMapper.deleteSubCategoryById(id);
    }

    @Override
    public int deleteSubCategoryByParentCode(String code) {
        return subCategoryMapper.deleteSubCategoryByParentCode(code);
    }
}
