package com.bonus.core.account.v3.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.core.account.v3.model.AccExceptionRecord;
import com.bonus.core.account.v3.web.dto.AccExceptionRecordDTO;
import com.bonus.core.account.v3.web.vo.AccExceptionRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AccExceptionRecordMapper extends BaseMapper<AccExceptionRecord> {
   List<AccExceptionRecord> selectAccExceptionRecordList(@Param("status") Integer status, @Param("startTime") LocalDateTime startTime);

   @Select({"SELECT SUM(amount) FROM acc_exception_record WHERE record_status = 3 AND cust_id = #{custId}"})
   Integer calculateAccArrears(@Param("custId") Long custId);

   Page<AccExceptionRecordVO> queryAccExceptionRecordPage(Page<AccExceptionRecord> pageVo, @Param("param") AccExceptionRecordDTO content);

   AccExceptionRecordVO queryAccExceptionRecordPageSum(@Param("param") AccExceptionRecordDTO content);
}
