package com.njcn.energy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.energy.mapper.EleRateSetMappser;
import com.njcn.energy.pojo.po.EleRateSet;
import com.njcn.energy.pojo.vo.EleRateVO;
import com.njcn.energy.service.EleRateSetService;
import com.njcn.system.enums.DicDataTypeEnum;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author denghuajun
 * @version 1.0.0
 * @date 2022年04月13日 19:39
 */
@Service
public class EleRateSetServiceImpl extends ServiceImpl<EleRateSetMappser, EleRateSet> implements EleRateSetService {
    @Override
    public List<EleRateVO> getEleRateDetail() {
        //查询费率类型配置
        return this.baseMapper.getEleRateDetail(DicDataTypeEnum.RATE_TYPE.getName());
    }

    @Override
    public boolean add(EleRateSet eleRateSet) {
        //先删除
        this.baseMapper.deleteById(eleRateSet.getId());
        //后新增
        this.baseMapper.insert(eleRateSet);
        return true;
    }
}
