package com.srs.web.controller.stureg;

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

import com.srs.common.annotation.Anonymous;
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.comprehensive.domain.SrsNotify;
import com.srs.comprehensive.service.ISrsNotifyService;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.core.page.TableDataInfo;

/**
 * 新生报到通知Controller
 * 
 * @author srs
 * @date 2023-07-18
 */
@RestController
@RequestMapping("/system/notify")
public class SrsNotifyController extends BaseController
{
    @Autowired
    private ISrsNotifyService srsNotifyService;

    /**
     * 查询新生报到通知列表
     */
    @GetMapping("/list")
    @Anonymous
    public TableDataInfo list(SrsNotify srsNotify)
    {
        startPage();
        List<SrsNotify> list = srsNotifyService.selectSrsNotifyList(srsNotify);
        return getDataTable(list);
    }

    /**
     * 导出新生报到通知列表
     */
//    @PreAuthorize("@ss.hasPermi('system:notify:export')")
    @Log(title = "新生报到通知", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SrsNotify srsNotify)
    {
        List<SrsNotify> list = srsNotifyService.selectSrsNotifyList(srsNotify);
        ExcelUtil<SrsNotify> util = new ExcelUtil<SrsNotify>(SrsNotify.class);
        util.exportExcel(response, list, "新生报到通知数据");
    }

    /**
     * 获取新生报到通知详细信息
     */
    @GetMapping(value = "/{id}")
    @Anonymous
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(srsNotifyService.selectSrsNotifyById(id));
    }

    /**
     * 新增新生报到通知
     */
//    @PreAuthorize("@ss.hasPermi('system:notify:add')")
    @Log(title = "新生报到通知", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SrsNotify srsNotify)
    {
        return toAjax(srsNotifyService.insertSrsNotify(srsNotify));
    }

    /**
     * 修改新生报到通知
     */
//    @PreAuthorize("@ss.hasPermi('system:notify:edit')")
    @Log(title = "新生报到通知", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody SrsNotify srsNotify)
    {
        return toAjax(srsNotifyService.updateSrsNotify(srsNotify));
    }

    /**
     * 删除新生报到通知
     */
//    @PreAuthorize("@ss.hasPermi('system:notify:remove')")
    @Log(title = "新生报到通知", businessType = BusinessType.DELETE)
	@PostMapping("/update/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(srsNotifyService.deleteSrsNotifyByIds(ids));
    }
}
