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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdkj.lt.base.exception.BusinessException;
import com.hdkj.lt.bf.entity.convert.EntityToVOConvertor;
import com.hdkj.lt.bf.entity.vo.FhzgPowerTransferInfoVO;
import com.hdkj.lt.bf.mapper.FhzgPlanTransferSchemePowerTransferInfoMapper;
import com.hdkj.lt.bf.service.FhzgPlanTransferSchemePowerTransferInfoService;
import com.hdkj.lt.core.bizms.modle.po.plan.FhzgPlanTransferSchemeOppositeLineLoadFactor;
import com.hdkj.lt.core.bizms.modle.po.plan.FhzgPlanTransferSchemePowerTransferInfo;
import org.springframework.stereotype.Service;

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

/**
 * @author Sunlit
 * @description 针对表【fhzg_plan_transfer_scheme_power_transfer_info(方案主变负载率)】的数据库操作Service实现
 * @createDate 2025-08-23 18:03:13
 */
@Service
public class FhzgPlanTransferSchemePowerTransferInfoServiceImpl extends ServiceImpl<FhzgPlanTransferSchemePowerTransferInfoMapper, FhzgPlanTransferSchemePowerTransferInfo>
        implements FhzgPlanTransferSchemePowerTransferInfoService {

    @Override
    public List<FhzgPowerTransferInfoVO> getPowerTransferInfo(FhzgPlanTransferSchemeOppositeLineLoadFactor fhzgPlanTransferSchemeOppositeLineLoadFactor) {
        if (Objects.isNull(fhzgPlanTransferSchemeOppositeLineLoadFactor.getId())) {
            throw new BusinessException("组合方案id为空");
        }
        List<FhzgPlanTransferSchemePowerTransferInfo> list = this.list(new LambdaQueryWrapper<FhzgPlanTransferSchemePowerTransferInfo>().eq(FhzgPlanTransferSchemePowerTransferInfo::getSchemeId, fhzgPlanTransferSchemeOppositeLineLoadFactor.getId()));
        return EntityToVOConvertor.INSTANCE.toFhzgPowerTransferInfoVOList(list);


    }
}




