package com.xxl.job.executor.batch.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxl.job.executor.batch.entity.KuaiShouImageGet;
import com.xxl.job.executor.batch.mapper.KuaiShouImageGetMapper;
import com.xxl.job.executor.batch.service.IKuaiShouImageGetService;
import com.xxl.job.executor.utils.Check;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 快手-获取图片接口
 * @Author: jeecg-boot
 * @Date: 2019-12-03
 * @Version: V1.0
 */
@Service
public class KuaiShouImageGetServiceImpl extends ServiceImpl<KuaiShouImageGetMapper, KuaiShouImageGet> implements IKuaiShouImageGetService {
    @Autowired
    private KuaiShouImageGetMapper imageGetMapper;

    @Override
    public void replaceBatch(List<KuaiShouImageGet> imageGets) {
        imageGetMapper.replaceBatch(imageGets);
    }

    @Override
    public String getUrlByCode(String signature) {
        String url = imageGetMapper.getUrlByCode(signature);
        if (!Check.isNull(url)) {
            return url;
        } else {
            return imageGetMapper.getCutFrameUrlByCode(signature);
        }


    }

}
