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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdkj.lt.base.model.response.PageVO;
import com.hdkj.lt.bf.entity.convert.EntityToVOConvertor;
import com.hdkj.lt.bf.entity.dto.SwitchProtectionRecommendRequest;
import com.hdkj.lt.bf.entity.vo.SwitchProtectionRecommendVO;
import com.hdkj.lt.bf.mapper.FhzgTransferSchemeSwitchProtectionRecommendMapper;
import com.hdkj.lt.bf.service.FhzgTransferSchemeSwitchProtectionRecommendService;
import com.hdkj.lt.core.bizms.modle.po.FhzgTransferSchemeSwitchProtectionRecommend;
import org.springframework.stereotype.Service;

/**
* @author Sunlit
* @description 针对表【fhzg_transfer_scheme_switch_protection_recommend(方案开关保护定值推荐表)】的数据库操作Service实现
* @createDate 2025-07-12 17:21:20
*/
@Service
public class FhzgTransferSchemeSwitchProtectionRecommendServiceImpl extends ServiceImpl<FhzgTransferSchemeSwitchProtectionRecommendMapper, FhzgTransferSchemeSwitchProtectionRecommend>
    implements FhzgTransferSchemeSwitchProtectionRecommendService{

    @Override
    public PageVO<SwitchProtectionRecommendVO> getSwitchProtectionRecommendBySchemeId(SwitchProtectionRecommendRequest request) {
        Page<FhzgTransferSchemeSwitchProtectionRecommend> page = new Page<>(request.getPageNum(), request.getPageSize());
        Page<FhzgTransferSchemeSwitchProtectionRecommend> result = this.page(page, new LambdaQueryWrapper<FhzgTransferSchemeSwitchProtectionRecommend>().eq(FhzgTransferSchemeSwitchProtectionRecommend::getSchemeId, request.getSchemeId()));
        PageVO<SwitchProtectionRecommendVO> pageVO = new PageVO<>();
        pageVO.setTotal(result.getTotal());
        pageVO.setRecords(EntityToVOConvertor.INSTANCE.toSwitchProtectionRecommendVOList(result.getRecords()));
        pageVO.setPageNum(result.getCurrent());
        pageVO.setPageSize(result.getSize());
        return pageVO;
    }
}




