package com.www.dao;
import java.util.List;
import com.www.dto.Student;
import com.www.util.JdbcUtils;
import com.www.util.PageUtils;
public class StudentDao {
public Integer getStudentCount(String mohu) {
String sql = "select count(*) from t_student ";
if(mohu != null){
sql += " where name like '%"+mohu+"%' ";
}
return JdbcUtils.getListCount(sql);
}
public List<Student> getStudentList(PageUtils pu, String mohu) {
String sql = "select s.*,c.name from t_student s left join t_dept c on s.cid=c.cid ";
if(mohu != null){
sql += " where name like '%"+mohu+"%' ";
}
sql += " limit "+pu.getStartIndex()+","+pu.getPageSize();
return JdbcUtils.getList(Student.class, sql);
}
}
“不要把没教养当成有气场”