package com.ruoyi.ems.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.ems.domain.ElecAttr;
import com.ruoyi.ems.mapper.ElecAttrMapper;
import com.ruoyi.ems.service.IElecAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 服务区用电属性Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@Service
public class AreaElectricityAttrServiceImpl implements IElecAttrService {
    @Autowired
    private ElecAttrMapper areaElectricityAttrMapper;

    /**
     * 查询服务区用电属性
     *
     * @param id 服务区用电属性主键
     * @return 服务区用电属性
     */
    @Override
    public ElecAttr selectElecAttrById(Long id) {
        return areaElectricityAttrMapper.selectElecAttrById(id);
    }

    /**
     * 查询服务区用电属性列表
     *
     * @param areaElectricityAttr 服务区用电属性
     * @return 服务区用电属性
     */
    @Override
    public List<ElecAttr> selectElecAttrList(ElecAttr areaElectricityAttr) {
        return areaElectricityAttrMapper.selectElecAttrList(areaElectricityAttr);
    }

    /**
     * 新增服务区用电属性
     *
     * @param areaElectricityAttr 服务区用电属性
     * @return 结果
     */
    @Override
    public int insertElecAttr(ElecAttr areaElectricityAttr) {
        areaElectricityAttr.setCreateTime(DateUtils.getNowDate());
        return areaElectricityAttrMapper.insertElecAttr(areaElectricityAttr);
    }

    /**
     * 修改服务区用电属性
     *
     * @param areaElectricityAttr 服务区用电属性
     * @return 结果
     */
    @Override
    public int updateElecAttr(ElecAttr areaElectricityAttr) {
        areaElectricityAttr.setUpdateTime(DateUtils.getNowDate());
        return areaElectricityAttrMapper.updateElecAttr(areaElectricityAttr);
    }

    /**
     * 批量删除服务区用电属性
     *
     * @param ids 需要删除的服务区用电属性主键
     * @return 结果
     */
    @Override
    public int deleteElecAttrByIds(Long[] ids) {
        return areaElectricityAttrMapper.deleteElecAttrByIds(ids);
    }

    /**
     * 删除服务区用电属性信息
     *
     * @param id 服务区用电属性主键
     * @return 结果
     */
    @Override
    public int deleteElecAttrById(Long id) {
        return areaElectricityAttrMapper.deleteElecAttrById(id);
    }
}
