package com.bonus.canteen.core.supply.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.supply.domain.DrpInquiry;
import com.bonus.canteen.core.supply.dto.DrpInquiryPageDTO;
import com.bonus.canteen.core.supply.dto.DrpQuotePageDTO;
import com.bonus.canteen.core.supply.dto.DrpSupplyStatisticsPageDTO;
import com.bonus.canteen.core.supply.po.SupplierBidTimesAndAmountModel;
import com.bonus.canteen.core.supply.po.SupplierLastBidInfoModel;
import com.bonus.canteen.core.supply.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DrpInquiryMapper extends BaseMapper<DrpInquiry> {
   @Update({"update drp_inquiry A set A.del_flag = #{delFlag} where A.inquiry_id = #{inquiryId}"})
   void deleteByInquiryId(@Param("inquiryId") String inquiryId, @Param("delFlag") Integer delFlag);

   Page<DrpInquiryPageVO> selectAllList(Page<DrpInquiryPageVO> page, @Param("content") DrpInquiryPageDTO content);

   @Update({"update drp_inquiry A set A.status = #{status} where A.inquiry_id = #{inquiryId}"})
   void cancelInquiry(@Param("inquiryId") String inquiryId, @Param("status") Integer status);

   List<DrpQuotePageVO> selectByQuoteDTO(@Param("content") DrpQuotePageDTO content, @Param("supplierAuthority") Long supplierAuthority, @Param("notCommitStatus") List<Integer> notCommitStatus);

   DrpExcelInquiryVO selectExcelInquiry(String inquiryId);

   DrpExcelQuoteVO selectExcelQuote(String inquirySupplierId);

   DrpExcelFinalBidsVO selectExcelFinalBids(@Param("inquiryId") String inquiryId, @Param("supplierId") Long supplierId);

   SupplierBidTimesAndAmountModel selectBidTimesAndAmount(@Param("supplierId") Long supplierId, @Param("content") DrpSupplyStatisticsPageDTO content);

   SupplierLastBidInfoModel selectLastBidInfo(@Param("supplierId") Long supplierId, @Param("content") DrpSupplyStatisticsPageDTO content, @Param("bidStatus") Integer bidStatus);
}
