package me.zhengjie.serviceimpl;

import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.DkbscxDeploy;
import me.zhengjie.domain.XxgxsqsqDeploy;
import me.zhengjie.mapper.DkbscxMapper;
import me.zhengjie.mapper.XxgxsqsqMapper;
import me.zhengjie.repository.DkbscxDeployRepository;
import me.zhengjie.repository.XxgxsqsqDeployRepository;
import me.zhengjie.service.DkbscxService;
import me.zhengjie.service.XxgxsqsqService;
import me.zhengjie.service.dto.DkbscxDeployQueryCriteria;
import me.zhengjie.service.dto.XxgxsqsqDeployQueryCriteria;
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 XxgxsqsqServiceImpl implements XxgxsqsqService {

    private final XxgxsqsqDeployRepository xxgxsqsqDeployRepository;
    private final XxgxsqsqMapper xxgxsqsqMapper;
    @Override
    public Object queryAll(XxgxsqsqDeployQueryCriteria criteria, Pageable pageable){
        Page<XxgxsqsqDeploy> page = xxgxsqsqDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(xxgxsqsqMapper::toDto));
    }

}
