1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package com.schoolinout.web.controller.system;
- import com.schoolinout.common.annotation.Log;
- import com.schoolinout.common.core.controller.BaseController;
- import com.schoolinout.common.core.domain.AjaxResult;
- import com.schoolinout.common.core.page.TableDataInfo;
- import com.schoolinout.common.enums.BusinessType;
- import com.schoolinout.common.utils.poi.ExcelUtil;
- import com.schoolinout.system.domain.Student;
- import com.schoolinout.system.service.IStudentService;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.util.List;
- @Tag(name = "学生管理接口")
- @RestController
- @RequestMapping("/system/student")
- public class StudentController extends BaseController {
- @Autowired
- private IStudentService studentService;
- @GetMapping("/list/all")
- public AjaxResult getAll(Student student) {
- return success(studentService.listAll(student));
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:list')")
- @GetMapping("/list")
- public TableDataInfo list(Student student) {
- startPage();
- List<Student> list = studentService.selectStudentList(student);
- return getDataTable(list);
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:export')")
- @Log(title = "学生管理", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, Student student) {
- List<Student> list = studentService.selectStudentList(student);
- ExcelUtil<Student> util = new ExcelUtil<Student>(Student.class);
- util.exportExcel(response, list, "学生管理数据");
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:query')")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(studentService.selectStudentById(id));
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:add')")
- @Log(title = "学生管理", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody Student student) {
- return toAjax(studentService.insertStudent(student));
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:edit')")
- @Log(title = "学生管理", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody Student student) {
- return toAjax(studentService.updateStudent(student));
- }
-
- @PreAuthorize("@ss.hasPermi('system:student:remove')")
- @Log(title = "学生管理", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids) {
- return toAjax(studentService.deleteStudentByIds(ids));
- }
- }
|