package com.srs.web.controller.stureg;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.srs.stureg.domain.SrsTaskList;
import com.srs.stureg.service.ISrsTaskListService;
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.srs.common.annotation.Log;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.enums.BusinessType;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.core.page.TableDataInfo;

/**
 * 新生待办Controller
 * 
 * @author srs
 * @date 2023-08-18
 */
@RestController
@RequestMapping("/system/list")
public class SrsTaskListController extends BaseController
{
    @Autowired
    private ISrsTaskListService srsTaskListService;



    @GetMapping("/getList")
    public AjaxResult getList(SrsTaskList srsTaskList){
        List<SrsTaskList> list = srsTaskListService.selectSrsTaskListList(srsTaskList);
        return AjaxResult.success(list);
    }

    /**
     * 查询新生待办列表
     */
//    @PreAuthorize("@ss.hasPermi('system:list:list')")
    @GetMapping("/list")
    public TableDataInfo list(SrsTaskList srsTaskList)
    {
        startPage();
        List<SrsTaskList> list = srsTaskListService.selectSrsTaskListList(srsTaskList);
        return getDataTable(list);
    }

    /**
     * 导出新生待办列表
     */
//    @PreAuthorize("@ss.hasPermi('system:list:export')")
    @Log(title = "新生待办", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SrsTaskList srsTaskList)
    {
        List<SrsTaskList> list = srsTaskListService.selectSrsTaskListList(srsTaskList);
        ExcelUtil<SrsTaskList> util = new ExcelUtil<SrsTaskList>(SrsTaskList.class);
        util.exportExcel(response, list, "新生待办数据");
    }

    /**
     * 获取新生待办详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:list:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(srsTaskListService.selectSrsTaskListById(id));
    }

    /**
     * 新增新生待办
     */
//    @PreAuthorize("@ss.hasPermi('system:list:add')")
    @Log(title = "新生待办", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SrsTaskList srsTaskList)
    {
        return toAjax(srsTaskListService.insertSrsTaskList(srsTaskList));
    }

    /**
     * 修改新生待办
     */
//    @PreAuthorize("@ss.hasPermi('system:list:edit')")
    @Log(title = "新生待办", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody SrsTaskList srsTaskList)
    {
        return toAjax(srsTaskListService.updateSrsTaskList(srsTaskList));
    }

    /**
     * 删除新生待办
     */
//    @PreAuthorize("@ss.hasPermi('system:list:remove')")
    @Log(title = "新生待办", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(srsTaskListService.deleteSrsTaskListByIds(ids));
    }
}
