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.core.bizms.modle.po.plan.FhzgPlanTransferSchemeFinalSwitchCurrentDetail;
import com.hdkj.lt.bf.entity.dto.FhzgPlanTransferSchemeFinalSwitchCurrentDetailDTO;
import com.hdkj.lt.bf.mapper.FhzgPlanTransferSchemeFinalSwitchCurrentDetailMapper;
import com.hdkj.lt.bf.service.FhzgPlanTransferSchemeFinalSwitchCurrentDetailService;
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 FhzgPlanTransferSchemeFinalSwitchCurrentDetailServiceImpl implements FhzgPlanTransferSchemeFinalSwitchCurrentDetailService {

    @Autowired
    FhzgPlanTransferSchemeFinalSwitchCurrentDetailMapper fhzgPlanTransferSchemeFinalSwitchCurrentDetailMapper;

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

}
