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

import cn.com.ctop.report.entity.KuaishouMaterialVideoReportDailyDw;
import cn.com.ctop.report.mapper.KuaishouMaterialVideoReportDailyDwMapper;
import cn.com.ctop.report.service.IKuaishouMaterialVideoReportDailyDwService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class KuaishouMaterialVideoReportDailyDwServiceImpl extends ServiceImpl<KuaishouMaterialVideoReportDailyDwMapper, KuaishouMaterialVideoReportDailyDw> implements IKuaishouMaterialVideoReportDailyDwService {
    @Resource
    private KuaishouMaterialVideoReportDailyDwMapper materialVideoReportDailyDwMapper;

    @Override
    public PageInfo<JSONObject> getKuaiShouVideoPageReportByMap(Map<String, Object> requestMap, int pageSize, int pageNo) {
        Long total = materialVideoReportDailyDwMapper.getTotalByMap(requestMap);
        PageHelper.startPage(pageNo, pageSize, false);
        PageInfo pageInfo = new PageInfo(materialVideoReportDailyDwMapper.getKuaiShouVideoReportByMap(requestMap));
        pageInfo.setTotal(total);
        return pageInfo;
    }

    @Override
    public List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filedAll, String signature) {
        return materialVideoReportDailyDwMapper.queryVideoDetailBy(accountIds, startDate, endDate, filedAll, signature);
    }
}
