package com.ruoyi.predict.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.predict.domain.WfFileConfig;
import com.ruoyi.predict.mapper.WfFileConfigMapper;
import com.ruoyi.predict.service.IWfFileConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * WfFileConfigService业务层处理
 *
 * @author hlf
 * @date 2021-08-04
 */
@Service
public class WfFileConfigServiceImpl implements IWfFileConfigService {
    @Autowired(required = false)
    private WfFileConfigMapper wfFileConfigMapper;

    /**
     * 查询WfFileConfig
     *
     * @param windplantNo WfFileConfigID
     * @return WfFileConfig
     */
    @Override
    public WfFileConfig selectWfFileConfigById(Long windplantNo) {
        return wfFileConfigMapper.selectWfFileConfigById(windplantNo);
    }

    /**
     * 查询WfFileConfig列表
     *
     * @param wfFileConfig WfFileConfig
     * @return WfFileConfig
     */
    @Override
    public List<WfFileConfig> selectWfFileConfigList(WfFileConfig wfFileConfig) {
        return wfFileConfigMapper.selectWfFileConfigList(wfFileConfig);
    }

    /**
     * 新增WfFileConfig
     *
     * @param wfFileConfig WfFileConfig
     * @return 结果
     */
    @Override
    public int insertWfFileConfig(WfFileConfig wfFileConfig) {
        return wfFileConfigMapper.insertWfFileConfig(wfFileConfig);
    }

    /**
     * 修改WfFileConfig
     *
     * @param wfFileConfig WfFileConfig
     * @return 结果
     */
    @Override
    public int updateWfFileConfig(WfFileConfig wfFileConfig) {
        return wfFileConfigMapper.updateWfFileConfig(wfFileConfig);
    }

    /**
     * 删除WfFileConfig信息
     *
     * @param windplantNo WfFileConfigID
     * @return 结果
     */
    @Override
    public int deleteWfFileConfigById(Long windplantNo) {
        return wfFileConfigMapper.deleteWfFileConfigById(windplantNo);
    }

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

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