package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.predict.domain.WfLoadGrow;
import com.ruoyi.predict.mapper.WfLoadGrowMapper;
import com.ruoyi.predict.service.IWfLoadGrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * WfLoadGrowService业务层处理
 *
 * @author hlf
 * @date 2022-01-10
 */
@Service
public class WfLoadGrowServiceImpl implements IWfLoadGrowService {
    @Autowired(required = false)
    private WfLoadGrowMapper wfLoadGrowMapper;

    /**
     * 查询WfLoadGrow
     *
     * @param windplantNo WfLoadGrowID
     * @return WfLoadGrow
     */
    @Override
    public WfLoadGrow selectWfLoadGrowById(Long windplantNo) {
        return wfLoadGrowMapper.selectWfLoadGrowById(windplantNo);
    }

    /**
     * 查询WfLoadGrow列表
     *
     * @param wfLoadGrow WfLoadGrow
     * @return WfLoadGrow
     */
    @Override
    public List<WfLoadGrow> selectWfLoadGrowList(WfLoadGrow wfLoadGrow) {
        return wfLoadGrowMapper.selectWfLoadGrowList(wfLoadGrow);
    }

    /**
     * 新增WfLoadGrow
     *
     * @param wfLoadGrow WfLoadGrow
     * @return 结果
     */
    @Override
    public int insertWfLoadGrow(WfLoadGrow wfLoadGrow) {
        return wfLoadGrowMapper.insertWfLoadGrow(wfLoadGrow);
    }

    /**
     * 修改WfLoadGrow
     *
     * @param wfLoadGrow WfLoadGrow
     * @return 结果
     */
    @Override
    public int updateWfLoadGrow(WfLoadGrow wfLoadGrow) {
        return wfLoadGrowMapper.updateWfLoadGrow(wfLoadGrow);
    }

    /**
     * 删除WfLoadGrow信息
     *
     * @param windplantNo WfLoadGrowID
     * @return 结果
     */
    @Override
    public int deleteWfLoadGrowById(Long windplantNo) {
        return wfLoadGrowMapper.deleteWfLoadGrowById(windplantNo);
    }

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

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