package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.predict.domain.WfStatType;
import com.ruoyi.predict.mapper.WfStatTypeMapper;
import com.ruoyi.predict.service.IWfStatTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * WfStatTypeService业务层处理
 *
 * @author hlf
 * @date 2022-01-10
 */
@Service
public class WfStatTypeServiceImpl implements IWfStatTypeService {
    @Autowired(required = false)
    private WfStatTypeMapper wfStatTypeMapper;

    /**
     * 查询WfStatType
     *
     * @param windplantNo WfStatTypeID
     * @return WfStatType
     */
    @Override
    public WfStatType selectWfStatTypeById(Long windplantNo) {
        return wfStatTypeMapper.selectWfStatTypeById(windplantNo);
    }

    /**
     * 查询WfStatType列表
     *
     * @param wfStatType WfStatType
     * @return WfStatType
     */
    @Override
    public List<WfStatType> selectWfStatTypeList(WfStatType wfStatType) {
        return wfStatTypeMapper.selectWfStatTypeList(wfStatType);
    }

    /**
     * 新增WfStatType
     *
     * @param wfStatType WfStatType
     * @return 结果
     */
    @Override
    public int insertWfStatType(WfStatType wfStatType) {
        return wfStatTypeMapper.insertWfStatType(wfStatType);
    }

    /**
     * 修改WfStatType
     *
     * @param wfStatType WfStatType
     * @return 结果
     */
    @Override
    public int updateWfStatType(WfStatType wfStatType) {
        return wfStatTypeMapper.updateWfStatType(wfStatType);
    }

    /**
     * 删除WfStatType信息
     *
     * @param windplantNo WfStatTypeID
     * @return 结果
     */
    @Override
    public int deleteWfStatTypeById(Long windplantNo) {
        return wfStatTypeMapper.deleteWfStatTypeById(windplantNo);
    }

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

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