package me.zhengjie.serviceimpl;

import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.XxgxsqsqDeploy;
import me.zhengjie.domain.XxgxsqyzDeploy;
import me.zhengjie.mapper.XxgxsqsqMapper;
import me.zhengjie.mapper.XxgxsqyzMapper;
import me.zhengjie.repository.XxgxsqsqDeployRepository;
import me.zhengjie.repository.XxgxsqyzDeployRepository;
import me.zhengjie.service.XxgxsqsqService;
import me.zhengjie.service.XxgxsqyzService;
import me.zhengjie.service.dto.XxgxsqsqDeployQueryCriteria;
import me.zhengjie.service.dto.XxgxsqyzDeployQueryCriteria;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

/**
 * @author Jing Xiduo
 * @date 2021-10-18
 */
@Service
@RequiredArgsConstructor
public class XxgxsqyzServiceImpl implements XxgxsqyzService {

    private final XxgxsqyzDeployRepository xxgxsqyzDeployRepository;
    private final XxgxsqyzMapper xxgxsqyzMapper;
    @Override
    public Object queryAll(XxgxsqyzDeployQueryCriteria criteria, Pageable pageable){
        Page<XxgxsqyzDeploy> page = xxgxsqyzDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(xxgxsqyzMapper::toDto));
    }


}
