|
@@ -0,0 +1,89 @@
|
|
|
+package com.koobietech.eas.controller;
|
|
|
+
|
|
|
+import com.koobietech.eas.common.result.JsonResult;
|
|
|
+import com.koobietech.eas.mbg.model.EasEduCategory;
|
|
|
+import com.koobietech.eas.service.EasEduCategoryService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Tag(name = "课程分类控制器")
|
|
|
+public class EasEduCategoryController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ EasEduCategoryService easEduCategoryService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ * @param easEduCategory
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/addEasEduCategory")
|
|
|
+ @Operation(summary = "添加课程" , description = "用于演示添加课程")
|
|
|
+ public JsonResult addEasEduCategory(@RequestBody EasEduCategory easEduCategory ){
|
|
|
+ int add = easEduCategoryService.addEasEduCategory( easEduCategory );
|
|
|
+ System.out.println( add );
|
|
|
+ return JsonResult.ok("添加成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新
|
|
|
+ * @param easEduCategory
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/updateEasEduCategory")
|
|
|
+ @Operation(summary = "课程更新" , description = "用于演示课程更新")
|
|
|
+ public JsonResult updateEasEduCategory(@RequestBody EasEduCategory easEduCategory){
|
|
|
+ int i = easEduCategoryService.updateEasEduCategory( easEduCategory );
|
|
|
+ if (i > 0){
|
|
|
+ return JsonResult.ok();
|
|
|
+ }else {
|
|
|
+ return JsonResult.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据 Id 删除
|
|
|
+ * @param easEduCategory
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/deleteById")
|
|
|
+ @Operation(summary = "根据Id删除课程" , description = "用于演示根据Id删除课程")
|
|
|
+ public JsonResult deleteById(@RequestBody EasEduCategory easEduCategory){
|
|
|
+ int i = easEduCategoryService.deleteById(easEduCategory.getId());
|
|
|
+ if (i > 0){
|
|
|
+ return JsonResult.ok();
|
|
|
+ }else {
|
|
|
+ return JsonResult.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * id 查询
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/selectById")
|
|
|
+ @Operation(summary = "根据Id查询对应课程" , description = "用于演示根据Id查询课程")
|
|
|
+ public JsonResult selectById(Integer id){
|
|
|
+ EasEduCategory easEduCategory = easEduCategoryService.selectById(id);
|
|
|
+ System.out.println(easEduCategory);
|
|
|
+ return JsonResult.data( easEduCategory );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询全部课程
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/selectAll")
|
|
|
+ @Operation(summary = "查询全部课程" , description = "用于演示查询全部课程")
|
|
|
+ public JsonResult selectAll(){
|
|
|
+ List<EasEduCategory> easEduCategories = easEduCategoryService.selectAll();
|
|
|
+ return JsonResult.data( easEduCategories );
|
|
|
+ }
|
|
|
+}
|