package com.ruoyi.ems.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.ems.domain.AreaElectricityAttr;
import com.ruoyi.ems.mapper.AreaElectricityAttrMapper;
import com.ruoyi.ems.service.IAreaElectricityAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

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

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

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

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

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

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