package cn.com.ty.lift.business.contract.service;

import cn.com.ty.lift.business.contract.dao.entity.PaymentHistory;
import cn.com.ty.lift.business.contract.dao.entity.model.request.PaymentRequest;
import cn.com.ty.lift.business.contract.dao.mapper.PaymentHistoryMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * @author bieao
 * @date 2020/2/26
 * @description 付款操作记录业务层
 */
@Service
public class PaymentHistoryService extends ServiceImpl<PaymentHistoryMapper, PaymentHistory> {

    /**
     * @param request 付款编号
     * @return IPage<PaymentHistory> 付款历史记录
     * @description 根据付款编号查询合同历史记录
     * @date 2020/2/26 5:24 下午
     */
    public IPage<PaymentHistory> list(PaymentRequest request) {
        QueryWrapper<PaymentHistory> queryWrapper = new QueryWrapper<>();
        LambdaQueryWrapper<PaymentHistory> lambdaQueryWrapper = queryWrapper.lambda();
        lambdaQueryWrapper.eq(PaymentHistory::getContractsId, request.getContractId());
        return page(request.getPage(), lambdaQueryWrapper);
    }
}
