package com.union.ai.api.service.impl;

import com.alibaba.fastjson.JSON;
import com.union.ai.api.dao.mapper.ext.AppApiMapperExt;
import com.union.ai.api.dao.model.AppApi;
import com.union.ai.api.service.AppApiService;
import com.union.ai.api.util.CheckUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2019/4/5
 * Time: 下午8:14
 */
@Slf4j
@Service
public class AppApiServiceImpl implements AppApiService {

    @Autowired
    private AppApiMapperExt appApiMapperExt;
    @Override
    public AppApi queryByAppAndUrl(Integer appId, String url)
    {
        List<AppApi> appApis = appApiMapperExt.queryByAppAndUrl(appId, url);
        if (CheckUtil.isNull(appApis)) {
            return null;
        }
        log.info("appId={},url={},结果为:{}", appId, url, JSON.toJSONString(appApis));
        return appApis.get(0);
    }
}
