package org.qinan.safetyeval.infrastructure.persistence.queryservice.impl;

import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.common.PageHelper;
import lombok.AllArgsConstructor;
import org.qinan.safetyeval.client.change.request.QualFilingPersonnelCertChangePageQry;
import org.qinan.safetyeval.client.change.response.QualFilingPersonnelCertChangeCo;
import org.qinan.safetyeval.infrastructure.convertor.QualFilingPersonnelCertChangeDoConvertor;
import org.qinan.safetyeval.infrastructure.persistence.domainobject.QualFilingPersonnelCertChangeDO;
import org.qinan.safetyeval.infrastructure.persistence.queryservice.QualFilingPersonnelCertChangeQueryService;
import org.qinan.safetyeval.infrastructure.persistence.repository.QualFilingPersonnelCertChangeRepository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 备案申请人员证书
 *
 * @Author: ltq
 * @date 2026-07-02 10:04:23
 */
@Service
@AllArgsConstructor
public class QualFilingPersonnelCertChangeQueryServiceImpl implements QualFilingPersonnelCertChangeQueryService {

    private final QualFilingPersonnelCertChangeRepository qualFilingPersonnelCertChangeRepository;
    private final QualFilingPersonnelCertChangeDoConvertor qualFilingPersonnelCertChangeDoConvertor;

    @Override
    public QualFilingPersonnelCertChangeDO getById(Long id) {
        return qualFilingPersonnelCertChangeRepository.getById(id);
    }

    @Override
    public PageResponse<QualFilingPersonnelCertChangeCo> listQualFilingPersonnelCertChangePage(QualFilingPersonnelCertChangePageQry qualFilingPersonnelCertChangePageQry) {
        IPage<QualFilingPersonnelCertChangeDO> qualFilingPersonnelCertChangeDoPage = qualFilingPersonnelCertChangeRepository.listQualFilingPersonnelCertChangePage(PageHelper.queryToPage(qualFilingPersonnelCertChangePageQry), qualFilingPersonnelCertChangePageQry);
        List<QualFilingPersonnelCertChangeCo> qualFilingPersonnelCertChangeCoS = qualFilingPersonnelCertChangeDoConvertor.converDosToCos(qualFilingPersonnelCertChangeDoPage.getRecords());
        return PageHelper.pageToResponse(qualFilingPersonnelCertChangeDoPage, qualFilingPersonnelCertChangeCoS);
    }

}
