package com.fjhx.account.controller.loan;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.account.entity.loan.dto.LoanInfoDto;
import com.fjhx.account.entity.loan.dto.LoanInfoSelectDto;
import com.fjhx.account.entity.loan.po.LoanInfo;
import com.fjhx.account.entity.loan.vo.LoanInfoVo;
import com.fjhx.account.service.loan.LoanInfoService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 * 借款信息 前端控制器
 * </p>
 *
 * @author
 * @since 2023-09-15
 */
@RestController
@RequestMapping("/loanInfo")
public class LoanInfoController {

    @Autowired
    private LoanInfoService loanInfoService;

    /**
     * 借款信息分页
     */
    @PostMapping("/page")
    public Page<LoanInfoVo> page(@RequestBody LoanInfoSelectDto dto) {
        return loanInfoService.getPage(dto);
    }

    /**
     * 借款人列表
     */
    @GetMapping("/getLoanUserList")
    public List<LoanInfo> getLoanUserList() {
        return loanInfoService.getLoanUserList();
    }

    /**
     * 借款信息明细
     */
    @PostMapping("/detail")
    public LoanInfoVo detail(@RequestBody BaseSelectDto dto) {
        return loanInfoService.detail(dto.getId());
    }

    /**
     * 借款信息新增
     */
    @PostMapping("/add")
    public void add(@RequestBody LoanInfoDto loanInfoDto) {
        loanInfoService.add(loanInfoDto);
    }

}
