package com.ruoyi.web.controller.formal;

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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.domain.entity.FormalParentsStudent;
import com.ruoyi.system.service.IFormalParentsStudentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 家长-学生(审核通过之后数据)Controller
 * 
 * @author ruoyi
 * @date 2023-05-30
 */
@RestController
@RequestMapping("/system/student")
public class FormalParentsStudentController extends BaseController
{
    @Autowired
    private IFormalParentsStudentService formalParentsStudentService;

    /**
     * 查询家长-学生(审核通过之后数据)列表
     */
    @PreAuthorize("@ss.hasPermi('system:student:list')")
    @GetMapping("/list")
    public TableDataInfo list(FormalParentsStudent formalParentsStudent)
    {
        startPage();
        List<FormalParentsStudent> list = formalParentsStudentService.selectFormalParentsStudentList(formalParentsStudent);
        return getDataTable(list);
    }

    /**
     * 导出家长-学生(审核通过之后数据)列表
     */
    @PreAuthorize("@ss.hasPermi('system:student:export')")
    @Log(title = "家长-学生(审核通过之后数据)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FormalParentsStudent formalParentsStudent)
    {
        List<FormalParentsStudent> list = formalParentsStudentService.selectFormalParentsStudentList(formalParentsStudent);
        ExcelUtil<FormalParentsStudent> util = new ExcelUtil<FormalParentsStudent>(FormalParentsStudent.class);
        util.exportExcel(response, list, "家长-学生(审核通过之后数据)数据");
    }

    /**
     * 获取家长-学生(审核通过之后数据)详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:student:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(formalParentsStudentService.selectFormalParentsStudentById(id));
    }

    /**
     * 新增家长-学生(审核通过之后数据)
     */
    @PreAuthorize("@ss.hasPermi('system:student:add')")
    @Log(title = "家长-学生(审核通过之后数据)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FormalParentsStudent formalParentsStudent)
    {
        return toAjax(formalParentsStudentService.insertFormalParentsStudent(formalParentsStudent));
    }

    /**
     * 修改家长-学生(审核通过之后数据)
     */
    @PreAuthorize("@ss.hasPermi('system:student:edit')")
    @Log(title = "家长-学生(审核通过之后数据)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FormalParentsStudent formalParentsStudent)
    {
        return toAjax(formalParentsStudentService.updateFormalParentsStudent(formalParentsStudent));
    }

    /**
     * 删除家长-学生(审核通过之后数据)
     */
    @PreAuthorize("@ss.hasPermi('system:student:remove')")
    @Log(title = "家长-学生(审核通过之后数据)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(formalParentsStudentService.deleteFormalParentsStudentByIds(ids));
    }
}
