package com.casic.missiles.mapper.business;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.casic.missiles.dto.business.siteExecutive.SiteExecutiveApprovalListRequest;
import com.casic.missiles.model.business.BusinessSiteExecutiveInfo;
import com.casic.missiles.dto.business.siteExecutive.SiteExecutiveApprovalListResponse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 现场检测表 Mapper 接口
 * </p>
 *
 * @author wangpeng
 * @since 2023-03-23
 */
public interface BusinessSiteExecutiveInfoMapper extends BaseMapper<BusinessSiteExecutiveInfo> {

    List<SiteExecutiveApprovalListResponse> selectDraftListForApproval(Page<SiteExecutiveApprovalListResponse> page, @Param("request") SiteExecutiveApprovalListRequest request);

    List<SiteExecutiveApprovalListResponse> selectBatchForApproval(Page<SiteExecutiveApprovalListResponse> page, @Param("request") SiteExecutiveApprovalListRequest request, @Param("businessKeys") List<String> businessKeys);

    @Select("SELECT IFNULL(max(RIGHT(site_executive_no, 12)), 0) from  business_site_executive_info")
    Long selectMaxCode();
}
