package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.predict.domain.PvPowerStation;
import com.ruoyi.predict.mapper.PvPowerStationMapper;
import com.ruoyi.predict.service.IPvPowerStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * PvPowerStationService业务层处理
 * 
 * @author hlf
 * @date 2022-07-11
 */
@Service
public class PvPowerStationServiceImpl implements IPvPowerStationService 
{
    @Autowired(required = false)
    private PvPowerStationMapper pvPowerStationMapper;

    /**
     * 查询PvPowerStation
     * 
     * @param pvStationNo PvPowerStationID
     * @return PvPowerStation
     */
    @Override
    public PvPowerStation selectPvPowerStationById(Long pvStationNo)
    {
        return pvPowerStationMapper.selectPvPowerStationById(pvStationNo);
    }

    /**
     * 查询PvPowerStation列表
     * 
     * @param pvPowerStation PvPowerStation
     * @return PvPowerStation
     */
    @Override
    public List<PvPowerStation> selectPvPowerStationList(PvPowerStation pvPowerStation)
    {
        return pvPowerStationMapper.selectPvPowerStationList(pvPowerStation);
    }

    /**
     * 新增PvPowerStation
     * 
     * @param pvPowerStation PvPowerStation
     * @return 结果
     */
    @Override
    public int insertPvPowerStation(PvPowerStation pvPowerStation)
    {
        return pvPowerStationMapper.insertPvPowerStation(pvPowerStation);
    }

    /**
     * 修改PvPowerStation
     * 
     * @param pvPowerStation PvPowerStation
     * @return 结果
     */
    @Override
    public int updatePvPowerStation(PvPowerStation pvPowerStation)
    {
        return pvPowerStationMapper.updatePvPowerStation(pvPowerStation);
    }

    /**
     * 删除PvPowerStation对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePvPowerStationByIds(String ids)
    {
        return pvPowerStationMapper.deletePvPowerStationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除PvPowerStation信息
     * 
     * @param pvStationNo PvPowerStationID
     * @return 结果
     */
    @Override
    public int deletePvPowerStationById(Long pvStationNo)
    {
        return pvPowerStationMapper.deletePvPowerStationById(pvStationNo);
    }

    @Override
    public String checkPvStationNameUnique(String pvStationName) {
        int count = pvPowerStationMapper.checkPvStationNameUnique(pvStationName);
        if (count > 0)
        {
            return UserConstants.USER_NAME_NOT_UNIQUE;
        }
        return UserConstants.USER_NAME_UNIQUE;
    }

    @Override
    public Long selectNewData() {
        return pvPowerStationMapper.selectNewData();
    }

    @Override
    public PvPowerStation selectPvPowerStationByStationCode(String stationCode) {
        return pvPowerStationMapper.selectPvPowerStationByStationCode(stationCode);
    }
}
