package com.clx.performance.controller.pc.loan.carrier;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerRepaymentParam;
import com.clx.performance.param.pc.loan.carrier.PageOwnerRepaymentOfOwner;
import com.clx.performance.service.loan.OwnerRepaymentService;
import com.clx.performance.vo.pc.loan.carrier.OwnerRepaymentVO;
import com.msl.common.base.PageData;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping(value="/pc/carrier/ownerRepayment")
@Validated
@Api(tags = "承运端-借款管理")
@AllArgsConstructor
public class CarrierOwnerRepaymentController {

    private final OwnerRepaymentService ownerRepaymentService;


    @ApiOperation(value = "还款列表",notes = "<br>By:刘海泉")
    @PostMapping("/pageOwnerRepayment")
    public Result<PageData<OwnerRepaymentVO>> pageOwnerRepayment(@RequestBody @Validated PageCarrierOwnerRepaymentParam param) {
        IPage<OwnerRepaymentVO> page  = ownerRepaymentService.pageOwnerRepayment(param);
        return Result.page(page.getRecords(),page.getTotal(),page.getPages());
    }

    @ApiOperation(value = "分页搜索货主还款列表",notes = "<br>By:艾庆国")
    @PostMapping("/pageOwnerRepaymentOfOwner")
    public Result<PageData<OwnerRepaymentVO>> pageOwnerRepaymentOfOwner(@RequestBody @Validated PageOwnerRepaymentOfOwner param) {
        IPage<OwnerRepaymentVO> page = ownerRepaymentService.pageOwnerRepaymentOfOwner(param);
        return Result.page(page.getRecords(), page.getTotal(), page.getPages());
    }

}
