package com.fjhx.sale.service.serviceContract.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fjhx.sale.entity.serviceContract.po.ServiceContractPay;
import com.fjhx.sale.mapper.serviceContract.ServiceContractPayMapper;
import com.fjhx.sale.service.serviceContract.ServiceContractPayService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.serviceContract.vo.ServiceContractPayVo;
import com.fjhx.sale.entity.serviceContract.dto.ServiceContractPaySelectDto;


/**
 * <p>
 * 服务合同 -收费项目表 服务实现类
 * </p>
 *
 * @author
 * @since 2023-04-18
 */
@Service
public class ServiceContractPayServiceImpl extends ServiceImpl<ServiceContractPayMapper, ServiceContractPay> implements ServiceContractPayService {

    @Override
    public Page<ServiceContractPayVo> getPage(ServiceContractPaySelectDto dto) {
        LambdaQueryWrapper<ServiceContractPay> wrapper = Wrappers.<ServiceContractPay>lambdaQuery();
        wrapper.orderByDesc(ServiceContractPay::getCreateTime);
        wrapper.like(ObjectUtil.isNotEmpty(dto.getPayName()),ServiceContractPay::getPayName,dto.getPayName());
        Page<ServiceContractPayVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
        return page;
    }

}
