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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdkj.lt.bf.entity.vo.FhzgFaultOppositeLineCarryCapacityVO;
import com.hdkj.lt.bf.mapper.FaultOppositeLineCarryCapacityMapper;
import com.hdkj.lt.bf.service.IFaultOppositeLineCarryCapacityService;
import com.hdkj.lt.core.bizms.modle.dto.FhzgFaultDistCustomerDTO;
import com.hdkj.lt.core.bizms.modle.po.fault.FaultOppositeLineCarryCapacity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 故障停电对侧线路承载能力信息表 服务实现类
 * </p>
 *
 * @author luorui
 * @since 2025-05-29
 */
@Service
public class FaultOppositeLineCarryCapacityServiceImpl extends ServiceImpl<FaultOppositeLineCarryCapacityMapper, FaultOppositeLineCarryCapacity> implements IFaultOppositeLineCarryCapacityService {

    @Override
    public Page<FhzgFaultOppositeLineCarryCapacityVO> getOppositeLineCarryCapacityList(FhzgFaultDistCustomerDTO dto) {
        Page<FhzgFaultOppositeLineCarryCapacityVO> page = new Page<>();
        page.setCurrent(dto.getPageNum());
        page.setSize(dto.getPageSize());
        QueryWrapper<Object> wrapper = new QueryWrapper<>();
        wrapper.eq("olcc.fault_id", dto.getFaultId())
                .like(StringUtils.isNotEmpty(dto.getLineName()), "olcc.line_name", dto.getLineName());
        List<FhzgFaultOppositeLineCarryCapacityVO> list = baseMapper.selectOppositeLineCarryCapacityList(page, wrapper);
        return page.setRecords(list);
    }
}
