package cn.com.ctop.kuaishou.modules.report.service.impl;

import cn.com.ctop.kuaishou.modules.report.entity.KuaishouProjectVideoEtlInfo;
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouProjectVideoEtlInfoMapper;
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouProjectVideoEtlInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 快手视频项目消耗数据清洗
 * @author jeecg-boot
 * @date   2021-01-08
 * @version V1.0
 */
@Service
public class KuaishouProjectVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouProjectVideoEtlInfoMapper, KuaishouProjectVideoEtlInfo> implements IKuaishouProjectVideoEtlInfoService {

    @Override
    public KuaishouProjectVideoEtlInfo getByProjectVideoEtlInfoByParams(String signature, Long projectId) {
        QueryWrapper<KuaishouProjectVideoEtlInfo>queryWrapper = new QueryWrapper<>();
        if(null!=signature&&!"".equals(signature.trim())){
            queryWrapper.eq("video_code",signature);
        }
        if(null!=projectId&&projectId!=0){
            queryWrapper.eq("project_id",projectId);
        }
        queryWrapper.last("limit 1");
        return this.getOne(queryWrapper);
    }
}
