package org.jeecg.modules.dynamicStaticAnalysis.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.dynamicStaticAnalysis.dto.AnalysisBatchUnitDeviceDTO;
import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchUnitDevice;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceMapper;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceTransfiniteMapper;
import org.jeecg.modules.dynamicStaticAnalysis.service.IAnalysisBatchUnitDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchUnitDeviceTransfiniteVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchUnitDeviceVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 动静态分析-分析批次-单元设备 服务实现类
 * </p>
 *
 * @author hkl
 * @since 2023-08-03
 */
@Service
public class AnalysisBatchUnitDeviceServiceImpl extends ServiceImpl<AnalysisBatchUnitDeviceMapper, AnalysisBatchUnitDevice> implements IAnalysisBatchUnitDeviceService {
    @Resource
    private AnalysisBatchUnitDeviceTransfiniteMapper transfiniteMapper;


    @Override
    public Page<AnalysisBatchUnitDeviceVO> listRecord(Page<AnalysisBatchUnitDeviceVO> pageData, AnalysisBatchUnitDeviceDTO dto) {

        Page<AnalysisBatchUnitDeviceVO> page = this.baseMapper.listRecord(pageData, dto);
        for (AnalysisBatchUnitDeviceVO record : page.getRecords()) {
            List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteList = transfiniteMapper.getTransfiniteList(record.getId());
            record.setTransfiniteList(transfiniteList);
        }

        return page;
    }
}
