package cn.com.ctop.toutiao.modules.report.mapper;

import cn.com.ctop.common.module.vo.ByteDanceReportAccountDailyDTOEntity;
import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BytedanceAccountReportMapper {

    //今日汇总数据
    JSONObject queryTodaySumReportBy(@Param("statDate") String statDate,@Param("accountIds")  JSONArray accountIds);

    JSONObject queryTodayReportByAccount(@Param("statDate") String statDate,@Param("accountId")  Long accountId);

    //根据小时区间查询今日汇总数据
    List<JSONObject> queryTodaySumByHourGroupAccount(@Param("filed") String filed,@Param("statDate") String statDate,@Param("hour") int hour,@Param("accountIds") JSONArray accountIds, String target, String order);

    //根据小时区间查询今日汇总数据
    JSONObject queryTodaySumByHour(@Param("statDate") String statDate,@Param("hour") int hour,@Param("accountIds") JSONArray accountIds);

    //根据小时区间查询今日汇总数据
    JSONObject querySumByHour(@Param("filed") String filed,@Param("statDate") String statDate,@Param("hour") int hour,@Param("accountIds") JSONArray accountIds);

    //今日明细数据
    List<JSONObject> queryTodayDetailReportBy(@Param("filed") String filed,@Param("statDate") String statDate,@Param("accountIds") JSONArray accountIds);

    //根据开始、结束时间 查询汇总数据
    JSONObject querySumByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds);

    //根据开始、结束时间 查询汇总数据
    JSONObject queryAllSumByStartEndDate(@Param("filed") String filed,@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds);

    //根据时间查询数据按账户分组
    List<JSONObject> querySumByDateGroupAccount(@Param("filed") String filed,@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds,String target, String order);

    //根据时间查询数据按账户时间分组
    List<JSONObject> querySumByDateGroupAccountAndDate(@Param("filed") String filed,@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds,String target, String order);

    //根据开始、结束时间 查询明细数据
    List<JSONObject> queryDetailByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds);

    //按月分组查询明细数据
    List<JSONObject> queryDetailGroupMonthByDate(@Param("endDate") String endDate, @Param("startDate") String startDate,@Param("accountIds") JSONArray accountIds);

    //查询固定月的明细数据
    List<JSONObject> queryDetailGroupDayByMonth(@Param("month") String month);

    List<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);

    List<ByteDanceReportAccountDailyDTO> getBytedanceProjectInfo(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);

    String getRoleCodeByUserId(@Param("userId")String userId);

    List<Long> getSaleProjects(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);

    List<Long> queryProjectInfoByAdmin(@Param("mediaIds")List<Long> mediaIds);

    List<ByteDanceReportAccountDailyDTO> queryProjectMemberByIds(@Param("projectIds")List<Long> projectIds);

    List<Long> getUserProjectAccountIds(@Param("userId")String userId);

    List<Long> getSaleProjectAccountIds(@Param("userId")String userId);

    List<Long> getUserProjectAccountIdsByAdmin();

    List<ByteDanceReportAccountDailyDTOEntity> getBytedanceProjectInfoEntity(@Param("startDate")String startDate, @Param("endDate")String endDate,@Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
}
