package com.ruixuan.isc.mapper;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruixuan.isc.entity.KuaishouRuleSettlementData;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 【请填写功能名称】Mapper接口
 *
 * @author ruoyi
 * @date 2023-05-16
 */
public interface KuaishouRuleSettlementDataMapper {
    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    public KuaishouRuleSettlementData selectKuaishouRuleSettlementDataById(Long id);

    /**
     * 查询【请填写功能名称】列表
     *
     * @param kuaishouRuleSettlementData 【请填写功能名称】
     * @return 【请填写功能名称】集合
     */
    public List<KuaishouRuleSettlementData> selectKuaishouRuleSettlementDataList(KuaishouRuleSettlementData kuaishouRuleSettlementData);

    /**
     * 新增【请填写功能名称】
     *
     * @param kuaishouRuleSettlementData 【请填写功能名称】
     * @return 结果
     */
    public int insertKuaishouRuleSettlementData(KuaishouRuleSettlementData kuaishouRuleSettlementData);

    /**
     * 修改【请填写功能名称】
     *
     * @param kuaishouRuleSettlementData 【请填写功能名称】
     * @return 结果
     */
    public int updateKuaishouRuleSettlementData(KuaishouRuleSettlementData kuaishouRuleSettlementData);

    /**
     * 删除【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    public int deleteKuaishouRuleSettlementDataById(Long id);

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteKuaishouRuleSettlementDataByIds(Long[] ids);

    List<JSONObject> data(@Param("statDate") Long statDate);

    List<JSONObject> getRuleList(@Param("ruleId") Long ruleId);

    JSONObject lastRule(@Param("relateId") Long relateId, @Param("promoterId") Long promoterId, @Param("ruleId") Long ruleId);

    JSONObject getTotalAmount(@Param("ruleId") Long ruleId, @Param("lastSortCount") Integer lastSortCount, @Param("currentSortCount") Integer currentSortCount);

    Integer selectIncentiveLog(@Param("relateId") Long relateId, @Param("promoterId") Long promoterId);

    void replaceIncentiveLog(@Param("relateId") Long relateId, @Param("promoterId") Long promoterId, @Param("ruleId") Long ruleId, @Param("incentivizedCount") Integer incentivizedCount, @Param("lastIncentivizedCount") Integer lastIncentivizedCount);

    JSONObject getTotalByCountAndRuleId(@Param("incentivizedCount") Integer incentivizedCount, @Param("ruleId") Long ruleId);

    Integer getMaxRuleCountByRuleId(@Param("ruleId") Long ruleId);

    void replaceDatas(@Param("adds") List<KuaishouRuleSettlementData> adds);

    List<JSONObject> getSettlementDate(@Param("statDate") Long statDate, @Param("promoterId") Long promoterId, @Param("promoterName") String promoterName);

    void updatePromoterStatus(@Param("statDate") Long statDate, @Param("promoterId") Long promoterId, @Param("status") Integer status);

    List<JSONObject> getPromoterSettlementDetail(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("settlementStatus") Integer settlementStatus);

    JSONObject getRuleJson(Long ruleId);

    JSONObject getData();


    Integer selectPromoterIncentiveLog(Long promoterId);

    void replacePromoterIncentiveLog(@Param("promoterId") Long promoterId, @Param("ruleId") Long ruleId, @Param("incentivizedCount") Integer incentivizedCount, @Param("lastIncentivizedCount") Integer lastIncentivizedCount);
}
