package org.dromara.ems.base.service.impl;

import org.dromara.common.core.utils.DateUtils;
import org.dromara.ems.base.domain.EmsBaseEnergyType;
import org.dromara.ems.base.mapper.EmsBaseEnergyTypeMapper;
import org.dromara.ems.base.service.IEmsBaseEnergyTypeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 能源类型信息Service业务层处理
 * 
 * @author Yinq
 * @date 2024-05-08
 */
@Service
@RequiredArgsConstructor
public class EmsBaseEnergyTypeServiceImpl implements IEmsBaseEnergyTypeService 
{
    
    private final EmsBaseEnergyTypeMapper emsBaseEnergyTypeMapper;

    /**
     * 查询能源类型信息
     * 
     * @param objId 能源类型信息主键
     * @return 能源类型信息
     */
    @Override
    public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId)
    {
        return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeByObjId(objId);
    }

    /**
     * 查询能源类型信息列表
     * 
     * @param emsBaseEnergyType 能源类型信息
     * @return 能源类型信息
     */
    @Override
    public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType)
    {
        return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
    }

    /**
     * 新增能源类型信息
     * 
     * @param emsBaseEnergyType 能源类型信息
     * @return 结果
     */
    @Override
    public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
    {
        emsBaseEnergyType.setCreateTime(DateUtils.getNowDate());
        return emsBaseEnergyTypeMapper.insertEmsBaseEnergyType(emsBaseEnergyType);
    }

    /**
     * 修改能源类型信息
     * 
     * @param emsBaseEnergyType 能源类型信息
     * @return 结果
     */
    @Override
    public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
    {
        emsBaseEnergyType.setUpdateTime(DateUtils.getNowDate());
        return emsBaseEnergyTypeMapper.updateEmsBaseEnergyType(emsBaseEnergyType);
    }

    /**
     * 批量删除能源类型信息
     * 
     * @param objIds 需要删除的能源类型信息主键
     * @return 结果
     */
    @Override
    public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds)
    {
        return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjIds(objIds);
    }

    /**
     * 删除能源类型信息信息
     * 
     * @param objId 能源类型信息主键
     * @return 结果
     */
    @Override
    public int deleteEmsBaseEnergyTypeByObjId(Long objId)
    {
        return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjId(objId);
    }

    /**
     * 根据能源类型id查询能源类型名称
     * @param energyTypeId
     * @return
     */
    @Override
    public String queryEnergyNameByEnergyTypeId(int energyTypeId) {
        return emsBaseEnergyTypeMapper.selectEmsBaseEnergyNameByEnergyTypeId(energyTypeId);
    }
}
