package com.huimv.environ.eco.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.environ.eco.entity.SysConfig;
import com.huimv.environ.eco.mapper.SysConfigMapper;
import com.huimv.environ.eco.service.SysConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zn
 * @since 2022-11-10
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {
    @Autowired
    private SysConfigMapper sysConfigMapper;

    @Override
    public String getUserId(Integer farmId, String cfgName) {
        QueryWrapper<SysConfig> queryWrapper = new QueryWrapper();
        queryWrapper.eq("farm_id",farmId);
        queryWrapper.eq("cfg_name",cfgName);
        SysConfig sysConfig = sysConfigMapper.selectOne(queryWrapper);
        if(sysConfig == null){
            return null;
        }else{
            return sysConfig.getCfgValue();
        }
    }
}
