package com.zhangmeng.oauth.service.impl;

import com.zhangmeng.model.base.baseService.impl.AbstractBaseServiceImpl;
import com.zhangmeng.model.entity.OauthConfig;
import com.zhangmeng.oauth.service.OauthConfigService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class OauthConfigServiceImpl extends AbstractBaseServiceImpl<OauthConfig> implements OauthConfigService {

    public OauthConfig oauthConfig(){
        Condition condition = new Condition(OauthConfig.class);
        Example.Criteria criteria = condition.createCriteria();
        condition.setOrderByClause("addTime desc");
        List<OauthConfig> oauthConfigs = this.findByCondition(condition);
        if (oauthConfigs.size() > 0 ){
            return oauthConfigs.get(0);
        }
        return null;
    }
}
