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

import cn.com.ctop.report.mapper.BytedanceMaterialVideoReportDailyDwMapper;
import cn.com.ctop.report.service.IBytedanceMaterialVideoReportDailyDwService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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 BytedanceMaterialVideoReportDailyDwServiceImpl implements IBytedanceMaterialVideoReportDailyDwService {
    @Resource
    private BytedanceMaterialVideoReportDailyDwMapper materialVideoReportDailyDwMapper;

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

    @Override
    public List<JSONObject> getBytedanceVideoPageReportByMap(Map<String, Object> requestMap) {
        return materialVideoReportDailyDwMapper.getBytedanceVideoReportByMap(requestMap);
    }

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