package com.hc.web.controller.browser.front;

import com.hc.business.service.UserTeacherService;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * (UserTeacher)表控制层
 *
 * @author java
 * @since 2020-11-20 11:08:21
 */

@RestController
@RequestMapping("/new/api/front/userTeacher")
public class FrontUserTeacherController {

    /**
     * 服务对象
     */
    private final UserTeacherService userTeacherService;

    public FrontUserTeacherController(UserTeacherService userTeacherService) {
        this.userTeacherService = userTeacherService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "依据主键获取 UserTeacher", response = Result.class)
    public Result selectFrontDetail(@PathVariable("id") Integer id) {
        return Result.success(this.userTeacherService.queryById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取 UserTeacher列表(分页)", response = Result.class)
    public Result listFrontUserTeacher(@RequestParam(defaultValue = "0") Integer page,
                                       @RequestParam(defaultValue = "0") Integer size) {
        return Result.success(userTeacherService.queryAllByLimit(page, size));
    }

    @GetMapping("/list/name")
    @ApiOperation(value = "依据老师名称 获取 UserTeacher列表", response = Result.class)
    public Result listUserTeacherByName(@RequestParam String name) {
        return Result.success(userTeacherService.queryByName(name));
    }


}