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.FhzgOppositeLineCarryCapacityVO;
import com.hdkj.lt.bf.mapper.FhzgPlanOppositeLineCarryCapacityMapper;
import com.hdkj.lt.bf.service.FhzgPlanOppositeLineCarryCapacityService;
import com.hdkj.lt.core.bizms.modle.dto.FhzgDistCustomerDTO;
import com.hdkj.lt.core.bizms.modle.po.plan.FhzgPlanOppositeLineCarryCapacity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 计划停电对侧线路承载能力信息表 服务实现类
 *
 * @author zhousc
 * @since 2025-05-07
 */
@Service
public class FhzgPlanOppositeLineCarryCapacityServiceImpl extends ServiceImpl<FhzgPlanOppositeLineCarryCapacityMapper, FhzgPlanOppositeLineCarryCapacity> implements FhzgPlanOppositeLineCarryCapacityService {

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