package com.jeeplus.centrecareful.reportArchieve.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.centrecareful.reportArchieve.domain.ZsReportArchieve;
import com.jeeplus.centrecareful.reportArchieve.service.dto.ZsReportArchieveExport;
import com.jeeplus.sys.service.dto.OfficeDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ZsReportArchieveMapper extends BaseMapper<ZsReportArchieve> {

    IPage<ZsReportArchieve> findList(Page<ZsReportArchieve> page, @Param(Constants.WRAPPER) QueryWrapper<ZsReportArchieve> queryWrapper);
    @InterceptorIgnore(tenantLine = "true")
    IPage<ZsReportArchieveExport> exportList(Page<ZsReportArchieveExport> page, @Param(Constants.WRAPPER)QueryWrapper<ZsReportArchieveExport> queryWrapper);

    List<ZsReportArchieve> getOfficeNameList();
    @InterceptorIgnore(tenantLine = "true")
    OfficeDTO getOfficeDTOByName(@Param("name") String name);

    ZsReportArchieve findById(@Param("id")String id);
    //根据报告文号类型查询最新的报告号
    @InterceptorIgnore(tenantLine = "true")
    ZsReportArchieve findByReportNoType(@Param("reportNoType")String reportNoType);

    //根据报告文号类型查询最新的报告号
    @InterceptorIgnore(tenantLine = "true")
    ZsReportArchieve findByReportNoTypeAndPrefixYear(@Param("reportNoType")String reportNoType, @Param("prefixReportNo")String prefixReportNo);
    //根据盒号查询修改人
    @InterceptorIgnore(tenantLine = "true")
    List<ZsReportArchieve> findByFileBoxNumber(@Param("fileBoxNumber")String fileBoxNumber, @Param("reportNoType")String reportNoType);

    /**
     * 批量新增
     * @param batchList
     */
    void insertBatch(@Param("batchList") List<ZsReportArchieve> batchList);

    /**
     * 修改归档信息
     * @param zsReportArchieve
     */
    Integer updatePlaceByYear(ZsReportArchieve zsReportArchieve);

    /**
     * 逻辑删除，同时更新update_time和update_by
     * @param id 主键
     * @param updateById 更新人
     */
    void logicalDeleteById(@Param("id") String id, @Param("updateById") String updateById);
}
