package org.qinan.safetyeval.infrastructure.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.qinan.safetyeval.client.co.QualFilingChangeOrgCO;
import org.qinan.safetyeval.domain.query.QualFilingChangeQuery;
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingChangeCountDO;
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingChangeDO;

import java.util.Collection;
import java.util.List;

@Mapper
public interface QualFilingChangeMapper extends BaseMapper<QualFilingChangeDO> {

    /**
     * 机构端分页查询：每个filing_id只取最新一条变更记录，直接返回CO
     */
    IPage<QualFilingChangeOrgCO> orgPage(IPage<QualFilingChangeOrgCO> page, @Param("query") QualFilingChangeQuery query);

    /**
     * 按 filing_id 批量统计变更次数
     */
    List<QualFilingChangeCountDO> countByFilingIds(@Param("filingIds") Collection<Long> filingIds);
}
