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

import com.hc.business.service.ZccmUserTeacherService;
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/app/userTeacher")
public class AppUserTeacherController {

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

    public AppUserTeacherController(ZccmUserTeacherService userTeacherService) {
        this.userTeacherService = userTeacherService;
    }

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

    @GetMapping("/list")
    @ApiOperation(value = "获取 UserTeacher列表(分页)", response = Result.class)
    public Result listAppUserTeacher(@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));
    }


}