package com.dayou.controller;

import com.dayou.vo.WorkLogVO;
import com.dayou.vo.WorkflowLogVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RestController;
import com.dayou.service.workflow.IWorkFlowLogService;
import com.dayou.entity.WorkFlowLog;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 实例节点流水表
 *
 * @author wucl
 * @since 2023-10-17
 */
@RestController
@RequestMapping("workFlowLog")
@Slf4j
public class WorkFlowLogController extends BaseController {
    @Autowired
    private IWorkFlowLogService workFlowLogService;

    /**
    * 实例节点流水表列表
    */
    @GetMapping("")
    public RestResponse<List<WorkflowLogVO>> list(WorkFlowLog workFlowLog){
        List<WorkflowLogVO> pages=workFlowLogService.getList(workFlowLog);
        return RestResponse.data(pages);
    }

    /**
     * 实例节点流水表详情
     */
    @GetMapping("/{id}")
    public RestResponse<WorkFlowLog> detail(@PathVariable Long id){
        WorkFlowLog xWorkFlowLog =workFlowLogService.detail(id);
        return RestResponse.data(xWorkFlowLog);
     }

    /**
     * 查询退单记录
     * @param businessId
     * @param businessType
     * @return
     */
     @GetMapping("/refuse")
     public RestResponse<WorkFlowLog> getRefuse(Long businessId,String businessType){
         WorkFlowLog log = workFlowLogService.getRefuse(businessId,businessType);
         return RestResponse.data(log);
     }

}

