package com.jwipc.spe.logic.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.page.PageUtil;
import com.jwipc.page.PageView;
import com.jwipc.spe.convert.SupTemDimensionConvert;
import com.jwipc.spe.convert.SupTemQuotaConvert;
import com.jwipc.spe.entity.SupTemDimension;
import com.jwipc.spe.entity.SupTemQuota;
import com.jwipc.spe.logic.SupTemDimensionLogic;
import com.jwipc.spe.logic.SupTemQuotaLogic;
import com.jwipc.spe.model.po.SupTemDimensionPO;
import com.jwipc.spe.model.po.SupTemQuotaPO;
import com.jwipc.spe.model.query.SupAppraiseTemplateQuery;
import com.jwipc.spe.service.ISupTemDimensionService;
import com.jwipc.spe.service.ISupTemQuotaService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Al
 * @create 2024-02-29 19:24
 */
@Service
@RequiredArgsConstructor
public class SupTemDimensionLogicImpl implements SupTemDimensionLogic {
    private final ISupTemDimensionService supTemDimensionService;
    private final SupTemDimensionConvert supTemDimensionConvert;

    @Override
    public PageView selectDataByQuery(SupAppraiseTemplateQuery query) {
        //final Page<SupTemDimension> dbPage = PageUtil.toPage(query);

        List<SupTemDimensionPO> supTemDimensionPOS = supTemDimensionService.findPageByQuery(query);

        return PageUtil.getPV(supTemDimensionConvert.po2PageListDTO(supTemDimensionPOS), supTemDimensionPOS.size());
    }
}
