|
@@ -0,0 +1,109 @@
|
|
|
+package com.ruoyi.sim.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+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.sim.domain.Major;
|
|
|
+import com.ruoyi.sim.service.IMajorService;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 专业Controller
|
|
|
+ *
|
|
|
+ * @author tom
|
|
|
+ * @date 2024-12-10
|
|
|
+ */
|
|
|
+@Api("专业Controller")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/sim/major")
|
|
|
+public class MajorController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private IMajorService majorService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询专业列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询专业列表")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(Major major) {
|
|
|
+ startPage();
|
|
|
+ List<Major> list = majorService.selectMajorList(major);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出专业列表
|
|
|
+ */
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:export')")
|
|
|
+ @Log(title = "专业", businessType = BusinessType.EXPORT)
|
|
|
+ // @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, Major major) {
|
|
|
+ List<Major> list = majorService.selectMajorList(major);
|
|
|
+ ExcelUtil<Major> util = new ExcelUtil<Major>(Major.class);
|
|
|
+ util.exportExcel(response, list, "专业数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取专业详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取专业详细信息")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:query')")
|
|
|
+ @GetMapping(value = "/{majorId}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("majorId") Long majorId) {
|
|
|
+ return success(majorService.selectMajorByMajorId(majorId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增专业
|
|
|
+ */
|
|
|
+ @ApiOperation("新增专业")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:add')")
|
|
|
+ @Log(title = "专业", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody Major major) {
|
|
|
+ return toAjax(majorService.insertMajor(major));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改专业
|
|
|
+ */
|
|
|
+ @ApiOperation("修改专业")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:edit')")
|
|
|
+ @Log(title = "专业", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody Major major) {
|
|
|
+ return toAjax(majorService.updateMajor(major));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除专业
|
|
|
+ */
|
|
|
+ @ApiOperation("修改专业")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:major:remove')")
|
|
|
+ @Log(title = "专业", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{majorIds}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] majorIds) {
|
|
|
+ return toAjax(majorService.deleteMajorByMajorIds(majorIds));
|
|
|
+ }
|
|
|
+
|
|
|
+ // -------------------------------- --------------------------------
|
|
|
+}
|