package com.xisc.pm.infra.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.xisc.pm.app.service.autoboard.dto.PmAutoPdCheckDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoPdContractSummaryDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoPdPublishedDetailDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoPdResultRequestDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoPdVersionDTO;
import com.xisc.pm.domain.entity.PmAutoPdResult;
import io.choerodon.mybatis.common.BaseMapper;

/**
 * 自动组板结果信息表Mapper
 *
 * @author jun.zeng 2024-11-21 11:05:36
 */
public interface PmAutoPdResultMapper extends BaseMapper<PmAutoPdResult> {

    /**
     * 
     * @param pmAutoPdResultRequestDTO
     * @param organizationId
     * @return
     */
    List<PmAutoPdResult> selectList(@Param("request") PmAutoPdResultRequestDTO pmAutoPdResultRequestDTO,@Param("organizationId") Long organizationId);

    List<PmAutoPdVersionDTO> selectExecVersion(@Param("requestId") Long requestId , @Param("tenantId") Long tenantId);

    /**
     * 
     * @param requestIds
     * @return 
     */
    int deleteByRequestId(@Param("requestIds") List<Long> requestIds);
    
    List<PmAutoPdPublishedDetailDTO> selectSummaryDetailList(@Param("requestId") Long requestId
            , @Param("version") Long version, @Param("tenantId") Long tenantId);

    /**
     * 更新
     * @param tenantId
     * @param resultIdList
     * @param targetStatus
     * @return
     */
    int updatePublishedStatus(@Param("tenantId") Long tenantId, @Param("resultIdList") List<Long> resultIdList, @Param("targetStatus") Integer targetStatus);

    /**
     * 初始化暂存记录表
     * @param virtualSlabNoList
     * @param requestId
     * @param version
     * @param tenantId
     * @return
     */
    int initContLock(@Param("virtualSlabNoList") List<String> virtualSlabNoList, @Param("requestId") Long requestId
            ,@Param("version") Long version,@Param("tenantId") Long tenantId);
    
    List<PmAutoPdCheckDTO> checkStockNum(@Param("virtualSlabNoList") List<String> virtualSlabNoList, @Param("requestId") Long requestId
            ,@Param("version") Long version,@Param("tenantId") Long tenantId);
    
    List<PmAutoPdContractSummaryDTO> selectPmAutoPdContractSummary(@Param("virtualSlabNoList") List<String> virtualSlabNoList, @Param("requestId") Long requestId
            ,@Param("version") Long version,@Param("tenantId") Long tenantId);
}
