package com.ruoyi.web.controller.system; 
 | 
  
 | 
import java.util.Arrays; 
 | 
import java.util.List; 
 | 
  
 | 
import com.ruoyi.common.annotation.RepeatSubmit; 
 | 
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.system.domain.SysGrade; 
 | 
import com.ruoyi.system.service.ISysGradeService; 
 | 
import com.ruoyi.common.utils.poi.ExcelUtil; 
 | 
import com.ruoyi.common.core.page.TableDataInfo; 
 | 
  
 | 
/** 
 | 
 * 年级信息Controller 
 | 
 *  
 | 
 * @author ruoyi 
 | 
 * @date 2021-10-26 
 | 
 */ 
 | 
@RestController 
 | 
@RequestMapping("/system/grade") 
 | 
public class SysGradeController extends BaseController 
 | 
{ 
 | 
    @Autowired 
 | 
    private ISysGradeService sysGradeService; 
 | 
  
 | 
    /** 
 | 
     * 查询年级信息列表 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:list')") 
 | 
    @GetMapping("/list") 
 | 
    public TableDataInfo list(SysGrade sysGrade) 
 | 
    { 
 | 
        startPage(); 
 | 
        List<SysGrade> list = sysGradeService.queryList(sysGrade); 
 | 
        return getDataTable(list); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 导出年级信息列表 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:export')") 
 | 
    @Log(title = "年级信息", businessType = BusinessType.EXPORT) 
 | 
    @GetMapping("/export") 
 | 
    public AjaxResult export(SysGrade sysGrade) 
 | 
    { 
 | 
        List<SysGrade> list = sysGradeService.queryList(sysGrade); 
 | 
        ExcelUtil<SysGrade> util = new ExcelUtil<SysGrade>(SysGrade.class); 
 | 
        return util.exportExcel(list, "年级信息数据"); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 获取年级信息详细信息 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:query')") 
 | 
    @GetMapping(value = "/{gradeId}") 
 | 
    public AjaxResult getInfo(@PathVariable("gradeId") Long gradeId) 
 | 
    { 
 | 
        return AjaxResult.success(sysGradeService.getById(gradeId)); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 新增年级信息 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:add')") 
 | 
    @Log(title = "年级信息", businessType = BusinessType.INSERT) 
 | 
    @PostMapping 
 | 
    @RepeatSubmit 
 | 
    public AjaxResult add(@RequestBody SysGrade sysGrade) 
 | 
    { 
 | 
        return toAjax(sysGradeService.save(sysGrade)); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 修改年级信息 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:edit')") 
 | 
    @Log(title = "年级信息", businessType = BusinessType.UPDATE) 
 | 
    @PostMapping("/edit") 
 | 
    @RepeatSubmit 
 | 
    public AjaxResult edit(@RequestBody SysGrade sysGrade) 
 | 
    { 
 | 
        return toAjax(sysGradeService.updateById(sysGrade)); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 删除年级信息 
 | 
     */ 
 | 
    // @PreAuthorize("@ss.hasPermi('system:grade:remove')") 
 | 
    @Log(title = "年级信息", businessType = BusinessType.DELETE) 
 | 
    @GetMapping("/remove/{gradeIds}") 
 | 
    public AjaxResult remove(@PathVariable Long[] gradeIds) 
 | 
    { 
 | 
        return toAjax(sysGradeService.removeByIds(Arrays.asList(gradeIds))); 
 | 
    } 
 | 
} 
 |