package com.fs.newAdv.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.newAdv.domain.Lead;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 线索Mapper
 *
 * @author zhangqin
 * @date 2025-11-05
 */
@Mapper
public interface LeadMapper extends BaseMapper<Lead> {
    /**
     * 查询当日加群的数量
     *
     * @return
     */
    @Select("SELECT * FROM adv_lead WHERE add_contact_qw_group = 1 AND DATE(create_time) = CURDATE()")
    List<Lead> getToDayGroupNum();

    @Select("SELECT * FROM adv_lead WHERE add_contact_qw_group = 1 AND DATE(create_time) = CURDATE() - INTERVAL 1 DAY")
    List<Lead> getYesterdayGroupNum();

    @Select("SELECT * FROM adv_lead WHERE qw_assign_rule_user_id is not null AND DATE(create_time) = CURDATE()")
    List<Lead> getToDayWeiChatNum();

    @Select("SELECT * FROM adv_lead WHERE qw_assign_rule_user_id is not null AND DATE(create_time) = CURDATE() - INTERVAL 1 DAY")
    List<Lead> getYesterdayWeiChatNum();
}

