package com.fjhx.oa.controller.work;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.oa.entity.work.vo.WorkTasksVo;
import com.fjhx.oa.entity.work.dto.WorkTasksSelectDto;
import com.fjhx.oa.entity.work.dto.WorkTasksDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.oa.service.work.WorkTasksService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 工作任务 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-07
 */
@RestController
@RequestMapping("/workTasks")
public class WorkTasksController {

    @Autowired
    private WorkTasksService workTasksService;

    /**
     * 工作任务分页
     */
    @PostMapping("/page")
    public Page<WorkTasksVo> page(@RequestBody WorkTasksSelectDto dto) {
        return workTasksService.getPage(dto);
    }

    /**
     * 工作任务明细
     */
    @PostMapping("/detail")
    public WorkTasksVo detail(@RequestBody BaseSelectDto dto) {
        return workTasksService.detail(dto.getId());
    }

    /**
     * 工作任务新增
     */
    @PostMapping("/add")
    public void add(@RequestBody WorkTasksDto workTasksDto) {
        workTasksService.add(workTasksDto);
    }

    /**
     * 工作任务编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody WorkTasksDto workTasksDto) {
        workTasksService.edit(workTasksDto);
    }

    /**
     * 工作任务删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        workTasksService.delete(dto.getId());
    }

}
