package cn.com.countrygarden.bi.main.service.wcx.impl;

import cn.com.countrygarden.bi.main.constant.wcx.WcxConstant;
import cn.com.countrygarden.bi.main.dao.wcx.WcxFileMapper;
import cn.com.countrygarden.bi.main.service.wcx.WcxFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ADMS on 2018/9/13.
 */
@Service
public class WcxFileServiceImpl implements WcxFileService{
    @Autowired
    private WcxFileMapper wcxFileMapper;


    @Override
    public String getVideoUrl(String innovationId) {
        List<String> videoUrls = wcxFileMapper.findFileUrlByInnoInfo(innovationId, WcxConstant.FILE_TYPE_VIDEO);
        if (videoUrls == null || videoUrls.size() <= 0) {
            return null;
        } else {
            if (videoUrls.size() > 1) {
                // todo 日志
            }
            return videoUrls.get(0);
        }
    }

    @Override
    public List<String> getPicUrls(String innovationId) {
        List<String> picUrls = wcxFileMapper.findFileUrlByInnoInfo(innovationId, WcxConstant.FILE_TYPE_PIC);
        return picUrls;
    }
}
