package com.srs.web.controller.stureg;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.stureg.domain.SrsStuDorm;
import com.srs.stureg.service.ISrsStuDormService;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author srs
 * @date 2023-07-24
 */
@RestController
@RequestMapping("/system/dorm")
public class SrsStuDormController extends BaseController
{
    @Autowired
    private ISrsStuDormService srsStuDormService;

    /**
     * 查询【请填写功能名称】列表
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:list')")
    @GetMapping("/list")
    public TableDataInfo list(SrsStuDorm srsStuDorm)
    {
        startPage();
        List<SrsStuDorm> list = srsStuDormService.selectSrsStuDormList(srsStuDorm);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SrsStuDorm srsStuDorm)
    {
        List<SrsStuDorm> list = srsStuDormService.selectSrsStuDormList(srsStuDorm);
        ExcelUtil<SrsStuDorm> util = new ExcelUtil<SrsStuDorm>(SrsStuDorm.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(srsStuDormService.selectSrsStuDormById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SrsStuDorm srsStuDorm)
    {
        return toAjax(srsStuDormService.insertSrsStuDorm(srsStuDorm));
    }

    /**
     * 修改【请填写功能名称】
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody SrsStuDorm srsStuDorm)
    {
        return toAjax(srsStuDormService.updateSrsStuDorm(srsStuDorm));
    }

    /**
     * 删除【请填写功能名称】
     */
//    @PreAuthorize("@ss.hasPermi('system:dorm:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(srsStuDormService.deleteSrsStuDormByIds(ids));
    }
}
