package com.hdkj.lt.bf.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdkj.lt.base.exception.BusinessException;
import com.hdkj.lt.bf.entity.dto.FhzgFaultTransferSchemeFinalSwitchCurrentDetailDTO;
import com.hdkj.lt.bf.mapper.FhzgFaultTransferSchemeFinalSwitchCurrentDetailMapper;
import com.hdkj.lt.bf.service.FhzgFaultTransferSchemeFinalSwitchCurrentDetailService;
import com.hdkj.lt.core.bizms.modle.po.plan.FhzgFaultTransferSchemeFinalSwitchCurrentDetail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author luorui
 * @date 2025/5/16 20:13
 * 终态安全校验开关电流明细查询
 */
@Service
@Slf4j
public class FhzgFaultTransferSchemeFinalSwitchCurrentDetailServiceImpl implements FhzgFaultTransferSchemeFinalSwitchCurrentDetailService {

    @Autowired
    FhzgFaultTransferSchemeFinalSwitchCurrentDetailMapper faultTransferSchemeFinalSwitchCurrentDetailMapper;

    @Override
    public Page<FhzgFaultTransferSchemeFinalSwitchCurrentDetailDTO> getTransferSchemeFinalSwitchCurrentDetailByIdPage(FhzgFaultTransferSchemeFinalSwitchCurrentDetail fhzgFaultTransferSchemeFinalSwitchCurrentDetail) {
        if (Objects.isNull(fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getSwitchingId())) {
            throw new BusinessException("switchingId为空");
        }
        if (Objects.isNull(fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getPageNum())) {
            throw new BusinessException("分页页码为空");
        }
        if (Objects.isNull(fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getPageSize())) {
            throw new BusinessException("分页长度为空");
        }
        Page page = new Page(fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getPageNum(), fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getPageSize());
        Page<FhzgFaultTransferSchemeFinalSwitchCurrentDetailDTO> fhzgPlanTransferSchemeFinalSwitchCurrentDetailDTOIPage = faultTransferSchemeFinalSwitchCurrentDetailMapper.getTransferSchemeFinalSwitchCurrentDetailByIdPage(page,fhzgFaultTransferSchemeFinalSwitchCurrentDetail.getSwitchingId());
        return fhzgPlanTransferSchemeFinalSwitchCurrentDetailDTOIPage;
    }

}
