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

import cn.com.ctop.report.mapper.TencentMaterialVideoReportDailyDwMapper;
import cn.com.ctop.report.service.ITencentMaterialVideoReportDailyDwService;
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 TencentMaterialVideoReportDailyDwServiceImpl implements ITencentMaterialVideoReportDailyDwService {
    @Resource
    private TencentMaterialVideoReportDailyDwMapper materialVideoReportDailyDwMapper;

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

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

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