package com.fs.his.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.his.domain.FsUserNewTask;
import com.fs.his.service.IFsUserNewTaskService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 用户新手任务Controller
 * 
 * @author fs
 * @date 2024-08-27
 */
@RestController
@RequestMapping("/his/userNewTask")
public class FsUserNewTaskController extends BaseController
{
    @Autowired
    private IFsUserNewTaskService fsUserNewTaskService;

    /**
     * 查询用户新手任务列表
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsUserNewTask fsUserNewTask)
    {
        startPage();
        List<FsUserNewTask> list = fsUserNewTaskService.selectFsUserNewTaskList(fsUserNewTask);
        return getDataTable(list);
    }

    /**
     * 导出用户新手任务列表
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:export')")
    @Log(title = "用户新手任务", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsUserNewTask fsUserNewTask)
    {
        List<FsUserNewTask> list = fsUserNewTaskService.selectFsUserNewTaskList(fsUserNewTask);
        ExcelUtil<FsUserNewTask> util = new ExcelUtil<FsUserNewTask>(FsUserNewTask.class);
        return util.exportExcel(list, "用户新手任务数据");
    }

    /**
     * 获取用户新手任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:query')")
    @GetMapping(value = "/{taskId}")
    public AjaxResult getInfo(@PathVariable("taskId") Long taskId)
    {
        return AjaxResult.success(fsUserNewTaskService.selectFsUserNewTaskByTaskId(taskId));
    }

    /**
     * 新增用户新手任务
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:add')")
    @Log(title = "用户新手任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsUserNewTask fsUserNewTask)
    {
        return toAjax(fsUserNewTaskService.insertFsUserNewTask(fsUserNewTask));
    }

    /**
     * 修改用户新手任务
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:edit')")
    @Log(title = "用户新手任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsUserNewTask fsUserNewTask)
    {
        return toAjax(fsUserNewTaskService.updateFsUserNewTask(fsUserNewTask));
    }

    /**
     * 删除用户新手任务
     */
    @PreAuthorize("@ss.hasPermi('his:userNewTask:remove')")
    @Log(title = "用户新手任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{taskIds}")
    public AjaxResult remove(@PathVariable Long[] taskIds)
    {
        return toAjax(fsUserNewTaskService.deleteFsUserNewTaskByTaskIds(taskIds));
    }
}
