package org.jeecg.ctop.material.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.ctop.material.entity.ManagerSaleValue;

import java.util.List;

/**
 * 分公司总经理&销售总监阶段性目标值
 *
 * @author jeecg-boot
 * 2022-04-14
 * @version V1.0
 */
public interface ManagerSaleValueMapper extends BaseMapper<ManagerSaleValue> {


    /**
     * =----------------------------------------------------------------------------------------------------------------=
     */
    String getRoleCodeByUserId(@Param("userId") String userId);

    List<JSONObject> queryUserCompany(@Param("userId") String userId);

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

    List<JSONObject> queryList();

    List<String> querySaleDirctorItsTeamMember(@Param("userId") String userId);

    List<Long> getCompanyAccountIds(@Param("companyId") String companyId, @Param("mediaId") String mediaId);

    /**
     * -----------------------------------------------------
     */

    JSONObject queryTtTodayCharge(@Param("statDay") String statDay, @Param("hour") Integer hour, @Param("accountIds") List<Long> accountIds);

    String queryTtManydaysTotalCharge(@Param("startDay") String startDay, @Param("endDay") String endDay, @Param("accountIds") List<Long> accountIds);

    JSONObject queryTtRealCharged(@Param("lastMonthFirstday") String lastMonthFirstday, @Param("monthFirstday") String monthFirstday, @Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds);


    JSONObject queryKsTodayCharge(@Param("statDay") String statDay, @Param("hour") Integer hour, @Param("accountIds") List<Long> accountIds);

    String queryKsManydaysTotalCharge(@Param("startDay") String startDay, @Param("endDay") String endDay, @Param("accountIds") List<Long> accountIds);

    JSONObject queryKsRealCharged(@Param("lastMonthFirstday") String lastMonthFirstday, @Param("monthFirstday") String monthFirstday, @Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds);

    Long getWeekly(@Param("userId") String userId, @Param("companyId") String companyId, @Param("mediaId") String mediaId);

    Long getMonthly(@Param("userId") String userId, @Param("companyId") String companyId, @Param("mediaId") String mediaId);

    List<Long> querySalesDirectorAccountIds(@Param("companyId") String companyId, @Param("mediaId") String mediaId, @Param("userIds") List<String> saleTeaMber);

    List<JSONObject> queryKsHourList(@Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds);

    List<JSONObject> queryTtHourList(@Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds);

    JSONObject queryTtManydaysChargeAndRoi(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lastTimeStart") String lastTimeStart, @Param("lastTimeEnd") String lastTimeEnd, @Param("accountIds") List<Long> accountIds);

    List<JSONObject> queryTtManydaysCharge(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("accountIds") List<Long> accountIds);

    JSONObject queryKsManydaysChargeAndRoi(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lastTimeStart") String lastTimeStart, @Param("lastTimeEnd") String lastTimeEnd, @Param("accountIds") List<Long> accountIds);

    List<JSONObject> queryKsManydaysCharge(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("accountIds") List<Long> accountIds);

    List<Long> querySalesDirectorProjectIds(@Param("companyId") String companyId, @Param("mediaId") String mediaId, @Param("userIds") List<String> saleTeaMber);

    Long queryKsHourProjectTopTotal(@Param("projectIds") List<Long> projectIds, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<JSONObject> queryKsHourProjectTop(@Param("projectIds") List<Long> projectIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("days") Long days);

    Long queryTtHourProjectTopTotal(@Param("projectIds") List<Long> projectIds, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<JSONObject> queryTtHourProjectTop(@Param("projectIds") List<Long> projectIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("days") Long days);

}
