-
public SublistStudentServiceImpl(){ //创建service实现类时,初始化dao对象 studentDao=new SublistStudentDaoImpl(); }查看全部
-
private StudentDao studentDao; //getter and setter查看全部
-
public Pager<Student> findStudent(Student searchModel,int pageNum,int pageSize){ List<Student> allStudent=getAllStudent(searchModel); Pager<Student> pager=new Pager<Student>(pageNum,pageSize,allStudentList); return pager; }查看全部
-
this.currentPage=this.totalPage<pageNum?this.totalPage:pageNum;查看全部
-
//结束索引 int toIndex=this.pageSize*this.currentPage>this.totalRecord?this.totalRecord:this.pageSize*this.currentPage; this.dataList=sourceList.subList(fromIndex,toIndex);查看全部
-
//起始索引 int fromIndex=this.pageSize*(this.currentPage-1); //结束索引 int toIndex; if(this.pageSize*this.currentPage>this.totalRecord){ toIndex=this.totalRecord; }else{ toIndex=this.pageSize*this.currentPage; }查看全部
-
//获取总页数 this.totalPage=this.totalRecord/this.pageSize; if(this.totalRecord%this.pageSize!=0){ this.totalPage=this.totalPage+1; } //当前第几页数据 if(this.totalPage<pageNum){ this.currentPage=this.totalPage; }else{ this.currentPage=pageNum; }查看全部
-
public Pager(int pageNum,int pageSize,List<T> sourceList){ if(sourceList==null){ return; } }查看全部
-
List<Student> allStudentList=getAllStudent(searchModel); Pager<Student> pager=new Pager<Student>(); pager.setPageSize(pageSize);查看全部
-
if(mapList!=null){ for(Map<String,Object> map:mapList){ Student s=new Student(map); result.add(s); } }查看全部
-
public Student(Map<String,Object> map){ this.id=(int)map.get("id"); this.stuName=(String)map.get("stu_name"); this.age=(int)map.get("age"); this.gender=(int)map.get("gender"); this.address=(String)map.get("address"); }查看全部
-
public Student(int id,String stuName,int age,int gender,String address){ super(); this.id=id; this.stuName=stuName; this.age=age; this.gender=gender; this.address=address; } public Student(){ super(); }查看全部
-
JdbcUtil jdbcUtil=null; try{ jdbcUtil=new JdbcUtil(); jdbcUtil.getConnection();//获取数据库链接 List<Map<String,Object>> mapList=jdbcUtil.findResult(sql.toString(),paramList); }catch(SQLException e){ throw new RuntimeException("查询所有数据异常!",e); }finally{ if(jdbcUtil!=null){ jdbcUtil.releaseConn();//释放资源 } }查看全部
-
if(gender==Constant.GENDER_FEMALE||gender==Constant.GENDER_MALE){ sql.append("and gender=?"); paramList.add(gender); }查看全部
-
public class Constant{ /** *男性 / public static final int GENDER_MALE=0; /** *女性 / public static final int GENDER_FEMALE=1; }查看全部
举报
0/150
提交
取消