| package com.wzy.serviceedu.controller;

    import com.wzy.commonutils.R;
    import com.wzy.serviceedu.entity.EduTeacher;
    import com.wzy.serviceedu.service.EduTeacherService;
    import io.swagger.annotations.Api;
    import io.swagger.annotations.ApiOperation;
    import io.swagger.annotations.ApiParam;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;

    import java.util.List;

    /


    讲师 前端控制器



    *
    @author wzy
    *
    @since 2021-09-10
    */
    @Api(description=
    “讲师管理”)
    @RestController
    @RequestMapping(
    “/serviceedu/teacher”)
    public class **EduTeacherController {

    1. @Autowired<br /> **private **EduTeacherService **eduTeacherService**;
    2. /*<br /> * @Description: 查询所有讲师信息<br /> * @Author: WangZiYao<br /> * @Date: 2021/9/10 13:49<br /> */<br /> //http://localhost:8001/serviceedu/teacher/findAll<br /> @ApiOperation(value = **"所有讲师列表"**)<br /> @GetMapping(value = **"/findAll"**)<br /> **public **R findAllTeacher(){<br /> //调用service中的list方法,传入null值查询所有的数据<br /> List<EduTeacher> list = **eduTeacherService**.list(**null**);<br /> **return **R.ok().data(**"items"**,list);<br /> }
    3. /*<br /> * @Description: 逻辑删除讲师的方法<br /> * @Author: WangZiYao<br /> * @Date: 2021/9/10 13:50<br /> * @ApiParam(name = "id", value = "讲师ID", required = true),swagger中的提示<br /> */<br /> @ApiOperation(value = **"根据ID逻辑删除讲师"**)<br /> @DeleteMapping(value = **"/{id}"**)<br /> **public **R removeTeacher(@ApiParam(name = **"id"**, value = **"讲师ID"**, required = **true**)<br /> @PathVariable(**"id"**) String id){<br /> **boolean **flag = **eduTeacherService**.removeById(id);<br /> **if **(flag) {<br /> **return **R.ok();<br /> } **else **{<br /> **return **R.error();<br /> }<br /> <br /> }

    }

    | | —- |