package com.jeethink.using.controller;

import com.jeethink.bean.vo.Approval;
import com.jeethink.common.core.controller.BaseController;
import com.jeethink.common.core.domain.AjaxResult;
import com.jeethink.common.core.page.TableDataInfo;
import com.jeethink.using.domain.ArchivesBorrow;
import com.jeethink.using.service.IBorrowApprovalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/using/approval")
public class BorrowApprovalController extends BaseController {

    @Autowired
    private IBorrowApprovalService approvalService;

    @GetMapping("/list")
    public TableDataInfo list(ArchivesBorrow borrow) {

        startPage();
        List<ArchivesBorrow> list = approvalService.selectApprovalList(borrow);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult check(@RequestBody Approval approval) {

        approvalService.checkApproval(approval);
        return AjaxResult.success();
    }
}
