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

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdkj.lt.base.exception.BusinessException;
import com.hdkj.lt.bf.entity.dto.FhzgLimitTransferSchemeFinalSegmentCurrentDetailDTO;
import com.hdkj.lt.bf.mapper.FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailMapper;
import com.hdkj.lt.bf.service.voltageLimitViolation.FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailService;
import com.hdkj.lt.core.bizms.modle.po.voltageLimitViolation.FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetail;
import com.hdkj.lt.core.bizms.modle.po.voltageLimitViolation.FhzgVoltageLimitViolationPowerCut;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
* @author userlrk
* @description 针对表【fhzg_limit_transfer_scheme_switching_final_seg_current_detail(成片电压越限转供方案开关动作终态检验导线电流明细信息表)】的数据库操作Service实现
* @createDate 2025-09-24 15:24:10
*/
@Service
public class FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailServiceImpl extends ServiceImpl<FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailMapper, FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetail>
    implements FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailService {

    @Override
    public Page<FhzgLimitTransferSchemeFinalSegmentCurrentDetailDTO> getTransferSchemeFinalSegmentCurrentDetailByIdPage(FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetail limitTransferSchemeSwitchingFinalSegCurrentDetail) {
        if (Objects.isNull(limitTransferSchemeSwitchingFinalSegCurrentDetail.getSwitchingId())) {
            throw new BusinessException("switchingId为空");
        }
        if (Objects.isNull(limitTransferSchemeSwitchingFinalSegCurrentDetail.getPageNum())) {
            throw new BusinessException("分页页码为空");
        }
        if (Objects.isNull(limitTransferSchemeSwitchingFinalSegCurrentDetail.getPageSize())) {
            throw new BusinessException("分页长度为空");
        }
        Page page = new Page(limitTransferSchemeSwitchingFinalSegCurrentDetail.getPageNum(), limitTransferSchemeSwitchingFinalSegCurrentDetail.getPageSize());
        Page<FhzgLimitTransferSchemeFinalSegmentCurrentDetailDTO> fhzgPlanTransferSchemeFinalSegmentCurrentDetailDTOIPage = this.baseMapper.getTransferSchemeFinalSegmentCurrentDetailByIdPage(page,limitTransferSchemeSwitchingFinalSegCurrentDetail.getSwitchingId());
        return fhzgPlanTransferSchemeFinalSegmentCurrentDetailDTOIPage;
    }

    @Override
    public FhzgVoltageLimitViolationPowerCut getLimitInfoBySwitchingId(Long switchingId) {
        return this.baseMapper.getLimitInfoBySwitchingId(switchingId);
    }

    @Override
    public List<Map<String, Object>> getListBySwitchingId(Long switchingId) {
        return this.baseMapper.getPlanInfoBySwitchingId(switchingId);
    }
}




