package com.srs.web.controller.comprehensive;

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

import com.srs.comprehensive.domain.CphStuEvaTaskList;
import com.srs.comprehensive.service.ICphStuEvaTaskListService;
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-19
 */
@RestController
@RequestMapping("/system/evatasklist")
public class CphStuEvaTaskListController extends BaseController
{
    @Autowired
    private ICphStuEvaTaskListService cphStuEvaTaskListService;

    /**
     * 查询综合素质评定任务记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CphStuEvaTaskList cphStuEvaTaskList)
    {
        startPage();
        List<CphStuEvaTaskList> list = cphStuEvaTaskListService.selectCphStuEvaTaskListList(cphStuEvaTaskList);
        return getDataTable(list);
    }

    /**
     * 导出综合素质评定任务记录列表
     */
    @Log(title = "综合素质评定任务记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CphStuEvaTaskList cphStuEvaTaskList)
    {
        List<CphStuEvaTaskList> list = cphStuEvaTaskListService.selectCphStuEvaTaskListList(cphStuEvaTaskList);
        ExcelUtil<CphStuEvaTaskList> util = new ExcelUtil<CphStuEvaTaskList>(CphStuEvaTaskList.class);
        util.exportExcel(response, list, "综合素质评定任务记录数据");
    }

    /**
     * 获取综合素质评定任务记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(cphStuEvaTaskListService.selectCphStuEvaTaskListById(id));
    }

    /**
     * 新增综合素质评定任务记录
     */
    @Log(title = "综合素质评定任务记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CphStuEvaTaskList cphStuEvaTaskList)
    {
        return toAjax(cphStuEvaTaskListService.insertCphStuEvaTaskList(cphStuEvaTaskList));
    }

    /**
     * 修改综合素质评定任务记录
     */
    @Log(title = "综合素质评定任务记录", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody CphStuEvaTaskList cphStuEvaTaskList)
    {
        return toAjax(cphStuEvaTaskListService.updateCphStuEvaTaskList(cphStuEvaTaskList));
    }

    /**
     * 删除综合素质评定任务记录
     */
    @Log(title = "综合素质评定任务记录", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cphStuEvaTaskListService.deleteCphStuEvaTaskListByIds(ids));
    }
}
