package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.predict.domain.WindplantPoint;
import com.ruoyi.predict.mapper.WindplantPointMapper;
import com.ruoyi.predict.service.IWindplantPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * WindplantPointService业务层处理
 *
 * @author hlf
 * @date 2022-01-10
 */
@Service
public class WindplantPointServiceImpl implements IWindplantPointService {
    @Autowired(required = false)
    private WindplantPointMapper windplantPointMapper;

    /**
     * 查询WindplantPoint
     *
     * @param windplantNo WindplantPointID
     * @return WindplantPoint
     */
    @Override
    public WindplantPoint selectWindplantPointById(Long windplantNo) {
        return windplantPointMapper.selectWindplantPointById(windplantNo);
    }

    /**
     * 查询WindplantPoint列表
     *
     * @param windplantPoint WindplantPoint
     * @return WindplantPoint
     */
    @Override
    public List<WindplantPoint> selectWindplantPointList(WindplantPoint windplantPoint) {
        return windplantPointMapper.selectWindplantPointList(windplantPoint);
    }

    /**
     * 新增WindplantPoint
     *
     * @param windplantPoint WindplantPoint
     * @return 结果
     */
    @Override
    public int insertWindplantPoint(WindplantPoint windplantPoint) {
        return windplantPointMapper.insertWindplantPoint(windplantPoint);
    }

    /**
     * 修改WindplantPoint
     *
     * @param windplantPoint WindplantPoint
     * @return 结果
     */
    @Override
    public int updateWindplantPoint(WindplantPoint windplantPoint) {
        return windplantPointMapper.updateWindplantPoint(windplantPoint);
    }

    /**
     * 删除WindplantPoint信息
     *
     * @param windplantNo WindplantPointID
     * @return 结果
     */
    @Override
    public int deleteWindplantPointById(Long windplantNo) {
        return windplantPointMapper.deleteWindplantPointById(windplantNo);
    }

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

    @Override
    public String checkWindplantNoUnique(Long windplantNo) {
        int count = windplantPointMapper.checkWindplantNoUnique(windplantNo);
        if (count > 0)
        {
            return UserConstants.USER_NAME_NOT_UNIQUE;
        }
        return UserConstants.USER_NAME_UNIQUE;
    }
}
