package cn.qg.qaplatform.service.stools.impl;

import cn.qg.qaplatform.config.SwitchDataSource;
import cn.qg.qaplatform.mapper.stools.CommonMapper;
import cn.qg.qaplatform.service.stools.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommonServiceImpl implements CommonService {

    @Autowired
    CommonMapper commonMapper;

    @Override
    public boolean addLoginWhiteList(String namespace, String key, Integer keyType) {
        SwitchDataSource.dataSourceSwitch(namespace, "login_risk");
        boolean result;
        try {
            result =  commonMapper.addLoginWhiteList(key, keyType);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return result;
    }
}
