|
|
@@ -0,0 +1,113 @@
|
|
|
+package com.zhongzheng.controller.course;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
+import com.zhongzheng.modules.course.bo.MajorCategoryAddBo;
|
|
|
+import com.zhongzheng.modules.course.bo.MajorCategoryEditBo;
|
|
|
+import com.zhongzheng.modules.course.bo.MajorCategoryQueryBo;
|
|
|
+import com.zhongzheng.modules.course.service.IMajorCategoryService;
|
|
|
+import com.zhongzheng.modules.course.vo.MajorCategoryVo;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+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.zhongzheng.common.annotation.Log;
|
|
|
+import com.zhongzheng.common.core.controller.BaseController;
|
|
|
+import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
+import com.zhongzheng.common.enums.BusinessType;
|
|
|
+import com.zhongzheng.common.utils.poi.ExcelUtil;
|
|
|
+import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 【专业分类】Controller
|
|
|
+ *
|
|
|
+ * @author hjl
|
|
|
+ * @date 2021-05-13
|
|
|
+ */
|
|
|
+@Api(value = "【专业分类】控制器", tags = {"专业分类"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/course/category")
|
|
|
+public class MajorCategoryController extends BaseController {
|
|
|
+
|
|
|
+ private final IMajorCategoryService iMajorCategoryService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询【专业分类】列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询【专业分类】列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<MajorCategoryVo> list(MajorCategoryQueryBo bo) {
|
|
|
+ startPage();
|
|
|
+ List<MajorCategoryVo> list = iMajorCategoryService.queryList(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出【专业分类】列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出【专业分类】列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:export')")
|
|
|
+ @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult<MajorCategoryVo> export(MajorCategoryQueryBo bo) {
|
|
|
+ List<MajorCategoryVo> list = iMajorCategoryService.queryList(bo);
|
|
|
+ ExcelUtil<MajorCategoryVo> util = new ExcelUtil<MajorCategoryVo>(MajorCategoryVo.class);
|
|
|
+ return util.exportExcel(list, "【专业分类】");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取【专业分类】详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取【专业分类】详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:query')")
|
|
|
+ @GetMapping("/{categoryId}")
|
|
|
+ public AjaxResult<MajorCategoryVo> getInfo(@PathVariable("categoryId" ) Long categoryId) {
|
|
|
+ return AjaxResult.success(iMajorCategoryService.queryById(categoryId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增【专业分类】
|
|
|
+ */
|
|
|
+ @ApiOperation("新增【专业分类】")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:add')")
|
|
|
+ @Log(title = "【专业分类】", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@Validated @RequestBody MajorCategoryAddBo bo) {
|
|
|
+ return toAjax(iMajorCategoryService.insertByAddBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改【专业分类】
|
|
|
+ */
|
|
|
+ @ApiOperation("修改【专业分类】")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:edit')")
|
|
|
+ @Log(title = "【专业分类】", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping()
|
|
|
+ public AjaxResult<Void> edit(@Validated @RequestBody MajorCategoryEditBo bo) {
|
|
|
+ return toAjax(iMajorCategoryService.updateByEditBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除【专业分类】
|
|
|
+ */
|
|
|
+ @ApiOperation("删除【专业分类】")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:category:remove')")
|
|
|
+ @Log(title = "【专业分类】" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{categoryIds}")
|
|
|
+ public AjaxResult<Void> remove(@PathVariable Long[] categoryIds) {
|
|
|
+ return toAjax(iMajorCategoryService.deleteWithValidByIds(Arrays.asList(categoryIds), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|