package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.predict.domain.Windplant;
import com.ruoyi.predict.mapper.WindplantMapper;
import com.ruoyi.predict.service.IWindplantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * WindplantService业务层处理
 *
 * @author hlf
 * @date 2021-07-07
 */
@Service
public class WindplantServiceImpl implements IWindplantService {
    @Autowired(required = false)
    private WindplantMapper windplantMapper;

    /**
     * 查询Windplant
     *
     * @param windplantNo WindplantID
     * @return Windplant
     */
    @Override
    public Windplant selectWindplantById(Long windplantNo) {
        return windplantMapper.selectWindplantById(windplantNo);
    }

    /**
     * 查询Windplant列表
     *
     * @param windplant Windplant
     * @return Windplant
     */
    @Override
    public List<Windplant> selectWindplantList(Windplant windplant) {
        return windplantMapper.selectWindplantList(windplant);
    }

    /**
     * 新增Windplant
     *
     * @param windplant Windplant
     * @return 结果
     */
    @Override
    public int insertWindplant(Windplant windplant) {
        return windplantMapper.insertWindplant(windplant);
    }

    /**
     * 修改Windplant
     *
     * @param windplant Windplant
     * @return 结果
     */
    @Override
    public int updateWindplant(Windplant windplant) {
        return windplantMapper.updateWindplant(windplant);
    }

    /**
     * 删除Windplant信息
     *
     * @param windplantNo WindplantID
     * @return 结果
     */
    @Override
    public int deleteWindplantById(Long windplantNo) {
        return windplantMapper.deleteWindplantById(windplantNo);
    }

    @Override
    public Windplant checkWindplantNoUnique(Long windplantNo) {
        return windplantMapper.checkWindplantNoUnique(windplantNo);
    }

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

    @Override
    public String checkWindplantNameUnique(String windplantName) {
        int count = windplantMapper.checkWindplantNameUnique(windplantName);
        if (count > 0)
        {
            return UserConstants.USER_NAME_NOT_UNIQUE;
        }
        return UserConstants.USER_NAME_UNIQUE;
    }

    @Override
    public List<Windplant> selectWindplantListByGlFlag() {
        return windplantMapper.selectWindplantListByGlFlag();
    }

    @Override
    public List<Windplant> selectWindplantListByDlFlag() {
        return windplantMapper.selectWindplantListByDlFlag();
    }

    @Override
    public List<Windplant> selectWindplantListByXhjyFlag() {
        return windplantMapper.selectWindplantListByXhjyFlag();
    }

    @Override
    public Windplant selectWindplantByStationCode(String stationCode) {
        return windplantMapper.selectWindplantByStationCode(stationCode);
    }
}
