package com.fs.company.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.company.domain.CompanyDetectionPhoneDailyStatistics;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

/**
 * 机型检测日统计Mapper接口
 * 
 * @author fs
 * @date 2025-12-17
 */
public interface CompanyDetectionPhoneDailyStatisticsMapper extends BaseMapper<CompanyDetectionPhoneDailyStatistics> {
    /**
     * 查询机型检测日统计
     * 
     * @param id 机型检测日统计主键
     * @return 机型检测日统计
     */
    CompanyDetectionPhoneDailyStatistics selectCompanyDetectionPhoneDailyStatisticsById(Long id);

    /**
     * 查询机型检测日统计列表
     * 
     * @param companyDetectionPhoneDailyStatistics 机型检测日统计
     * @return 机型检测日统计集合
     */
    List<CompanyDetectionPhoneDailyStatistics> selectCompanyDetectionPhoneDailyStatisticsList(CompanyDetectionPhoneDailyStatistics companyDetectionPhoneDailyStatistics);

    /**
     * 新增机型检测日统计
     * 
     * @param companyDetectionPhoneDailyStatistics 机型检测日统计
     * @return 结果
     */
    int insertCompanyDetectionPhoneDailyStatistics(CompanyDetectionPhoneDailyStatistics companyDetectionPhoneDailyStatistics);

    /**
     * 修改机型检测日统计
     * 
     * @param companyDetectionPhoneDailyStatistics 机型检测日统计
     * @return 结果
     */
    int updateCompanyDetectionPhoneDailyStatistics(CompanyDetectionPhoneDailyStatistics companyDetectionPhoneDailyStatistics);

    /**
     * 删除机型检测日统计
     * 
     * @param id 机型检测日统计主键
     * @return 结果
     */
    int deleteCompanyDetectionPhoneDailyStatisticsById(Long id);

    /**
     * 批量删除机型检测日统计
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteCompanyDetectionPhoneDailyStatisticsByIds(Long[] ids);
    /**
     * 根据销售id和创建时间查询公司用户
     * @param companyUserId 销售id
     * @param startDate 起始时间
     * @return 结果
     */
    @Select("select * from company_detection_phone_daily_statistics where company_user_id=#{companyUserId} and DATE(create_time) =DATE(#{startDate})")
    CompanyDetectionPhoneDailyStatistics selectByCompanyUserAndDate(@Param("companyUserId")Long companyUserId, @Param("startDate")Date startDate);
}
