package com.csnf.service;

import com.csnf.entity.Student;
import com.csnf.mapper.StudentMapper;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import java.util.List;

public class StudentService implements IStudentService{
    private StudentMapper studentMapper;
    private StudentService(StudentMapper studentMapper){
        this.studentMapper = studentMapper;
    }
    public StudentService(HttpServlet servlet) {
        ServletContext application = servlet.getServletContext();
        SqlSession sqlSession = (SqlSession) application.getAttribute("sqlSession");
        studentMapper = sqlSession.getMapper(StudentMapper.class);

    }
    @Override
    public void addStudent(String name, int age) {

    }

    @Override
    public void deleteStudent(int id) {

    }

    @Override
    public void updateStudent(int id, String name, int age) {

    }

    @Override
    public Student queryStudent(int id) {
        return null;
    }

    @Override
    public Student queryStudentByName(String name) {
        return null;
    }

    @Override
    public Student queryStudentByPhone(String phone) {
        return null;
    }

    @Override
    public List<Student> queryStudentByNameAndPhone(String name, String phone) {
        return null;
    }
}
