package com.bycrm.mapper; import com.bycrm.entity.Report; import com.bycrm.dto.PageQuery; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * 报备 Mapper */ @Mapper public interface ReportMapper { /** * 根据ID查询报备(含关联信息) */ Report selectById(@Param("id") Long id); /** * 查询学校+产品+项目类型的有效报备(根据学校ID) */ Report selectValidBySchoolAndProduct(@Param("schoolId") Long schoolId, @Param("product") String product, @Param("projectType") String projectType); /** * 查询学校名称+产品+项目类型的有效报备(根据学校名称) */ Report selectValidBySchoolNameAndProduct(@Param("schoolName") String schoolName, @Param("product") String product, @Param("projectType") String projectType); /** * 分页查询报备 */ List selectPage(@Param("query") PageQuery query, @Param("dealerId") Long dealerId, @Param("dealerName") String dealerName, @Param("customerName") String customerName, @Param("status") Integer status); /** * 查询报备总数 */ Long countPage(@Param("dealerId") Long dealerId, @Param("dealerName") String dealerName, @Param("customerName") String customerName, @Param("status") Integer status); /** * 插入报备 */ int insert(Report report); /** * 更新报备 */ int update(Report report); /** * 删除报备 */ int deleteById(@Param("id") Long id); /** * 查询即将过期的报备(定时任务使用) */ List selectExpiringReports(@Param("endDate") String endDate); /** * 批量更新报备状态为已失效 */ int batchUpdateExpired(@Param("ids") List ids); /** * 统计报备总数(根据经销商ID过滤) */ Long countByDealerId(@Param("dealerId") Long dealerId); /** * 统计待审核报备数量(根据经销商ID过滤) */ Long countPendingByDealerId(@Param("dealerId") Long dealerId); }