package com.sqx.modules.invite.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sqx.modules.invite.entity.Invite;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author fang
 * @date 2020/7/9
 */
@Mapper
public interface InviteDao extends BaseMapper<Invite> {

    List<Invite> selectInviteList(@Param("state") Integer state, @Param("userId") Long userId);

    Integer selectInviteCount(@Param("state") Integer state, @Param("userId") Long userId);
    Integer selectInviteCount2(@Param("code") String code);
    Integer selectInviteSignCount(@Param("code") String code);

    List<Long> selectInviteSignByUser(@Param("code") String code);

    Double selectInviteSum(@Param("state") Integer state, @Param("userId") Long userId);

    List<Map<String,Object>> selectInviteUser(@Param("code") String code);

    Invite selectInviteByUser(@Param("userId")Long userId,@Param("inviteeUserId") Long inviteeUserId,@Param("userType") Integer userType);

    Integer selectInviteByUserIdCountNotTime(@Param("userId")Long userId);

    Integer selectInviteByUserIdCount(@Param("userId") Long userId, @Param("startTime")Date startTime,@Param("endTime")Date endTime);

    Double selectInviteByUserIdSum(@Param("userId") Long userId, @Param("startTime")Date startTime,@Param("endTime")Date endTime);

    Double sumInviteMoney(@Param("time")String time,@Param("flag")Integer flag);

    List<Map<String,Object>> inviteAnalysis(@Param("time")String time,@Param("flag")Integer flag);


}
