package cn.com.ctop.common.module.mapper;

import cn.com.ctop.common.module.entity.UserAllocation;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Description: 用户分配
 * @Author: jeecg-boot
 * @Date: 2019-08-08
 * @Version: V1.0
 */
public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
    List<UserAllocation> selectAccountListByProjectId(@Param("projectId") Long projectId);

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

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

    List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);

    List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);

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

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

    List<JSONObject> getAllAccountIdsByMediaId(@Param("mediaId") String mediaId);

    Long getProjectIdByAccountId(@Param("accountId") Long accountId);

    UserAllocation getUserAllocation(@Param("accountId") Long accountId);

    JSONObject getSwitchStatusByAccount(@Param("accountId") Long accountId);

    List<Long> queryAccountsByDeleteComment();

    String getCompanyNameByUserId(@Param("planId") String planId);

    List<UserAllocation> listByMediaId(@Param("mediaId") String mediaId, @Param("accountStatus") Integer accountStatus);

    List<JSONObject> getAccountListByProjectList(@Param("list") List list);

    List<Long> getValidProjectIds(@Param("mediaId") Integer mediaId);

    List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId") String userId, @Param("projectId") Long projectId, @Param("productId") Long productId,@Param("authName") String authName);

    List<JSONObject> getUserIdListByProductId(@Param("productId") Long productId, @Param("userId") String userId);

    List<JSONObject> getByAccountIds(@Param("accountIds") JSONArray accountIds);

    List<Long> getKuaiShouUserIdListByProjectId(@Param("projectId") Long projectId);

    List<JSONObject> selectAccountsByKuaishouUserId(@Param("userId") Long userId);

    int updateProjectStrategyStatus(@Param("accountId") Long accountId, @Param("projectStrategy") Integer projectStrategy);

    List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);


    Map<String, Object> getCwjsSettlementByAccountId(String accountId);

    void updCwjsSettlementStatus(@Param("id") String id, @Param("status") Integer status);

    List<UserAllocation> getAccountInfoBySalesId(@Param("sales") Set<String> sales, @Param("mediaId") String mediaId, @Param("advertiserId") String advertiserId, @Param("productId") String productId, @io.lettuce.core.dynamic.annotation.Param("projectId") String projectId);

    List<JSONObject> getAccountListByProjectListV2(@Param("list") List list);

    List<JSONObject> getAccountListByProjectAndUserId(@Param("projectId") Long projectId, @Param("userId") String userId);

    List<Long> getAccountListByProjectId(@Param("projectId") Long projectId);

    JSONObject getProductInfo(@Param("accountId") Long accountId);

    List<JSONObject> getAccountInfoByProjectId(@Param("projectId") Long projectId);

    JSONObject getAccountInfoByAccountId(@Param("accountId") Long accountId);
}
