package com.muyu.cloud.many.datasource.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.muyu.cloud.many.datasource.config.holder.DynamicDataSourceHolder;
import com.muyu.cloud.many.datasource.domain.Student;
import com.muyu.cloud.many.datasource.mapper.StudentMapper;
import com.muyu.common.core.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: DongZeLiang
 * @date: 2024/6/3
 * @Description: 学生控制层
 * @Version: 1.0
 */
@RestController
@RequestMapping("/student")
public class StudentController {


    @Autowired
    private StudentMapper studentMapper;

    @GetMapping("/list/all")
    public Result<List<Student>> findAll() {
        return Result.success(studentMapper.selectList(new QueryWrapper<>()));
    }
}
