package com.fs.company.controller.store;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.framework.security.LoginUser;
import com.fs.his.domain.FsExportTask;
import com.fs.his.service.IFsExportTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 导出任务Controller
 *
 * @author fs
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/store/exportTask")
public class FsExportTaskController extends BaseController
{
    @Autowired
    private IFsExportTaskService fsExportTaskService;

    /**
     * 查询导出任务列表
     */
    @PreAuthorize("@ss.hasPermi('store:exportTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsExportTask fsExportTask)
    {
        startPage();
        LoginUser loginUser = com.fs.framework.security.SecurityUtils.getLoginUser();
        fsExportTask.setCompanyUserId(loginUser.getUser().getUserId());
        List<FsExportTask> list = fsExportTaskService.selectFsExportTaskList(fsExportTask);
        return getDataTable(list);
    }


    /**
     * 删除导出任务
     */
    @PreAuthorize("@ss.hasPermi('store:exportTask:remove')")
    @Log(title = "导出任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{taskIds}")
    public AjaxResult remove(@PathVariable Long[] taskIds)
    {
        return toAjax(fsExportTaskService.deleteFsExportTaskByTaskIds(taskIds));
    }
}
