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

import cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO;
import cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 视频按时间段统计
 * @author: jeecg-boot
 * @date:   2020-05-13
 * @cersion: V1.0
 */
public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVideoReportDaily> {

    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId") Long accountId);

    String getCompanyIdByAccountId(@Param("accountId") Long accountId);

    BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);

    void updateHuanbiByDateAndSignature(@Param("date") Date date, @Param("signature") String signature, @Param("huanbi") BigDecimal huanbi);

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

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

    String getJsonByUserIdAndColumnType(@Param("columnType") Integer columnType, @Param("userId") String userId);

    String getJsonByAccountIdAndColumnType(@Param("accountId") Long accountId,@Param("columnType") Integer columnType);

    void insertColumnLoad(@Param("json") String json, @Param("userId") String userId, @Param("columnType") Integer columnType,@Param("accountId") Long accountId);

    void updateJsonByUserIdAndType(@Param("json") String json, @Param("userId") String userId, @Param("columnType") Integer columnType,@Param("accountId") Long accountId);

    List<ByteDanceVideoReportDaily> videoInfoListDetail(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);

    List<ByteDanceVideoReportDaily> videoInfoListDetailDesign(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);

    List<ByteDanceVideoReportDaily> videoInfoListDetailOperator(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);

    List<ByteDanceVideoReportDaily> videoInfoListDetailOtherRoles(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);

    List<AccountVideoDTO> accountVideoMap();

    void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList") List<AccountVideoDTO> accountVideoDTOList);

    //admin角色查询视频报表
    List<ByteDanceVideoReportDaily> videoInfoListGroupAdmin(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //teamLeader角色查询视频报表
    List<ByteDanceVideoReportDaily> videoInfoListGroupdesignTeamLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //平面设计角色查询视频报表
    List<ByteDanceVideoReportDaily> videoInfoListGroupPlaneAndPlaneLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //编导角色查询视频报表
    List<ByteDanceVideoReportDaily> videoInfoListGroupPlan(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //剪辑角色查询视频报表
    List<ByteDanceVideoReportDaily> videoInfoListGroupClip(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //拍摄
    List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    //运营
    List<ByteDanceVideoReportDaily> videoInfoListGroupOperator(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    List<ByteDanceVideoReportDaily> videoInfoListGroupOtherRoles(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);

    List<Long> getAccountIdByprojectIds(@Param("projectIds") List<Long> projectIds);

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

    List<Long> getAccountIds(@Param("companyId") String companyId, @Param("signature") String signature);

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

    void insertBatch(@Param("mlist")List<ByteDanceVideoReportDaily> mList);
}
