package com.dao;
import java. util. * ;
import java.sql. * ;
//import java.sql.DriverManager;
import com. demo. Student;
import org.apache.commons.lang3.ObjectUtils;
public class StudentDaoImpl extends BaseDao implements StudentDao{
    Connection conn = getConnection( );
    public Student listStudent (String password){

        String sql = "SELECT * FROM student WHERE Student_id=?";

        Student s = new Student();
        try {

            PreparedStatement pst = null;
            pst = conn.prepareStatement(sql);
            ResultSet rs = pst.executeQuery();

            while (rs.next()) {
                String password_ret=rs.getString("Student_password");
                //if(password_ret!= null&&password_ret.equals(password)){
                int id = rs.getInt("id");
                String name = rs.getString("Student_name");
                String sex = rs.getString("Student_sex");
                String domitory = rs.getString("Student_domitory");
                //Student s = new Student(id,name,sex,password,domitory);
                s.setId(id);
                s.setName(name);
                s.setSex(sex);
                s.setDomitory(domitory);
                System.out.print("exist");
            }
        } catch (SQLException sqle) {
            System.out.println(sqle);
            return s;
        }
        return s;
    }
}
