|
@@ -0,0 +1,112 @@
|
|
|
+package com.zhongzheng.controller.course;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+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.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.modules.course.vo.TeacherVo;
|
|
|
+import com.zhongzheng.modules.course.bo.TeacherQueryBo;
|
|
|
+import com.zhongzheng.modules.course.bo.TeacherAddBo;
|
|
|
+import com.zhongzheng.modules.course.bo.TeacherEditBo;
|
|
|
+import com.zhongzheng.modules.course.service.ITeacherService;
|
|
|
+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 ruoyi
|
|
|
+ * @date 2021-11-29
|
|
|
+ */
|
|
|
+@Api(value = "名师控制器", tags = {"名师管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/teacher")
|
|
|
+public class TeacherController extends BaseController {
|
|
|
+
|
|
|
+ private final ITeacherService iTeacherService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询名师列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询名师列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<TeacherVo> list(TeacherQueryBo bo) {
|
|
|
+ startPage();
|
|
|
+ List<TeacherVo> list = iTeacherService.queryList(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出名师列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出名师列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:export')")
|
|
|
+ @Log(title = "名师", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult<TeacherVo> export(TeacherQueryBo bo) {
|
|
|
+ List<TeacherVo> list = iTeacherService.queryList(bo);
|
|
|
+ ExcelUtil<TeacherVo> util = new ExcelUtil<TeacherVo>(TeacherVo.class);
|
|
|
+ return util.exportExcel(list, "名师");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取名师详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取名师详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:query')")
|
|
|
+ @GetMapping("/{teacherId}")
|
|
|
+ public AjaxResult<TeacherVo> getInfo(@PathVariable("teacherId" ) Long teacherId) {
|
|
|
+ return AjaxResult.success(iTeacherService.queryById(teacherId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增名师
|
|
|
+ */
|
|
|
+ @ApiOperation("新增名师")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:add')")
|
|
|
+ @Log(title = "名师", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@RequestBody TeacherAddBo bo) {
|
|
|
+ return toAjax(iTeacherService.insertByAddBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改名师
|
|
|
+ */
|
|
|
+ @ApiOperation("修改名师")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:edit')")
|
|
|
+ @Log(title = "名师", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping()
|
|
|
+ public AjaxResult<Void> edit(@RequestBody TeacherEditBo bo) {
|
|
|
+ return toAjax(iTeacherService.updateByEditBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除名师
|
|
|
+ */
|
|
|
+ @ApiOperation("删除名师")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:teacher:remove')")
|
|
|
+ @Log(title = "名师" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{teacherIds}")
|
|
|
+ public AjaxResult<Void> remove(@PathVariable Long[] teacherIds) {
|
|
|
+ return toAjax(iTeacherService.deleteWithValidByIds(Arrays.asList(teacherIds), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|