package com.yida.data.user.controller.h5;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.user.dto.ListStudentDTO;
import com.yida.data.user.dto.h5.BindStudentDTO;
import com.yida.data.user.service.EduStudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "学生-前台")
@RequiredArgsConstructor
@RestController
@RequestMapping("/h5/student")
public class H5EduStudentController {

    private final EduStudentService eduStudentService;

    @ApiOperation("查询学生列表")
    @PostMapping("/listStudent")
    public ResultBean<List<EduStudent>> listStudent(@RequestBody ListStudentDTO dto) {
        return ResultBean.buildSuccess(eduStudentService.listStudent(dto));
    }

    @ApiOperation("易达app绑定学生")
    @PostMapping("/bindStudent")
    public ResultBean<List<EduStudent>> bindStudent(@RequestBody BindStudentDTO dto) {
       return ResultBean.buildSuccess(eduStudentService.bindStudent(dto));
    }
}
