package com.dayou.controller;

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.IWorkRecordTransferService;
import com.dayou.entity.WorkRecordTransfer;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;
/**
 * 任务转交表
 *
 * @author wucl
 * @since 2024-04-30
 */
@RestController
@RequestMapping("workRecordTransfer")
@Slf4j
public class WorkRecordTransferController extends BaseController {
    @Autowired
    private IWorkRecordTransferService workRecordTransferService;

    /**
    * 任务转交表列表
    */
    @GetMapping("")
    public RestResponse<Page<WorkRecordTransfer>> page(WorkRecordTransfer workRecordTransfer, Page page){
        Page<WorkRecordTransfer> pages=workRecordTransferService.selectPage(page,workRecordTransfer);
        return RestResponse.data(pages);
    }

    /**
     * 任务转交表详情
     */
    @GetMapping("/{id}")
    public RestResponse<WorkRecordTransfer> detail(@PathVariable Long id){
        WorkRecordTransfer xWorkRecordTransfer =workRecordTransferService.detail(id);
        return RestResponse.data(xWorkRecordTransfer);
     }

    /**
     * 任务转交表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody WorkRecordTransfer workRecordTransfer) {
        Boolean ret = workRecordTransferService.add(workRecordTransfer);
        return RestResponse.data(ret);
    }

    /**
     * 任务转交表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody WorkRecordTransfer workRecordTransfer) {
        Boolean ret = workRecordTransferService.update(workRecordTransfer);
        return RestResponse.data(ret);
    }

    /**
     * 任务转交表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = workRecordTransferService.delete(id);
        return RestResponse.data(ret);
    }


}

