⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tphmmodelistimpl.java

📁 HW-中国移动企业信息机,请查看
💻 JAVA
字号:
package com.sxit.phonemanager;
import com.sxit.common.ListImpl;
import java.util.*;
import java.sql.*;
/**
 * <p>类名: TphmmodeListImpl</p>
 * <p>功能: 规格</p>
 * <p>公司: 深讯信科</p>
 * <p>版本: 1.0</p>
 * @程序 sxit
 * @日期 2005-03-22
 * @修改纪录
 */
public class TphmmodeListImpl extends ListImpl
{
     public TphmmodeListImpl()
     {
          super();
     }
     /**
      * 创建全部列表
      */
     public void createList(Connection con) throws SQLException
     {
          createList(con,0,0,"");
     }
     /**
      * 有条件创建全部列表
      */
     public void createList(Connection con,String strSearch) throws SQLException
     {
          createList(con,0,0,strSearch);
     }
     /**
      * 创建分页列表
      */
     public void createList(Connection con,int pageNo,int pageSize) throws SQLException
     {
          createList(con,pageNo,pageSize,"");
     }
     /**
      * 有条件创建分页列表
      */
     public void createList(Connection con,int pageNo,int pageSize,String strSearch) throws SQLException
     {
          PreparedStatement stmt=null;
          ResultSet rs=null;
          String sql="";
          int i=0;
          try{
               if(pageNo==0 && pageSize==0){
                    strSearch=" where 1=1 "+strSearch;
                    recList=new ArrayList();
                    sql="select modeid,modename,screenlength,screenwidth,ringmode,colormode from tphmmode "+strSearch;
                    stmt=con.prepareStatement(sql);
                    rs=stmt.executeQuery();
                    i=0;
                    while(rs.next()){
                         Tphmmode tphmmode=new Tphmmode();
                         tphmmode.setModeid(rs.getLong("modeid"));
                         tphmmode.setModename(rs.getString("modename"));
                         tphmmode.setScreenlength(rs.getInt("screenlength"));
                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
                         tphmmode.setRingmode(rs.getString("ringmode"));
                         tphmmode.setColormode(rs.getString("colormode"));
                         recList.add(tphmmode);
                         i++;
                    }
                    stmt.close();
               }else{
                    this.pageNo=pageNo;
                    this.pageSize=pageSize;
                    recList=new ArrayList();
                    sql="select modeid,modename,screenlength,screenwidth,ringmode,colormode from tphmmode "+strSearch;
                    stmt=con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                    rs=stmt.executeQuery();
                    rs.last();
                    recCount=rs.getRow();
                    if(pageSize*(pageNo-1)==0){
                         rs.beforeFirst();
                    }else{
                         rs.absolute(pageSize*(pageNo-1));
                    }
                    i=0;
                    while(rs.next() && i<pageSize){
                         Tphmmode tphmmode=new Tphmmode();
                         tphmmode.setModeid(rs.getLong("modeid"));
                         tphmmode.setModename(rs.getString("modename"));
                         tphmmode.setScreenlength(rs.getInt("screenlength"));
                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
                         tphmmode.setRingmode(rs.getString("ringmode"));
                         tphmmode.setColormode(rs.getString("colormode"));
                         recList.add(tphmmode);
                         i++;
                    }
                    stmt.close();
//                    this.pageNo=pageNo;
//                    this.pageSize=pageSize;
//                    strSearch=" where 1=1 "+strSearch;
//                    sql="select count(*) as cnt from tphmmode "+strSearch;
//                    stmt = con.prepareStatement(sql);
//                    rs = stmt.executeQuery();
//                    if(rs.next()){
//                         recCount=rs.getInt("cnt");
//                    }
//                    stmt.close();
//                    recList=new ArrayList();
//                    sql="select modeid,modename,screenlength,screenwidth,ringmode,colormode from tphmmode "+strSearch;
//                    stmt=con.prepareStatement(sql);
//                    rs=stmt.executeQuery();
//                    i=0;
//                    while(i<pageSize*(pageNo-1)){
//                         rs.next();
//                         i++;
//                    }
//                    i=0;
//                    while(rs.next() && i<pageSize){
//                         Tphmmode tphmmode=new Tphmmode();
//                         tphmmode.setModeid(rs.getLong("modeid"));
//                         tphmmode.setModename(rs.getString("modename"));
//                         tphmmode.setScreenlength(rs.getInt("screenlength"));
//                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
//                         tphmmode.setRingmode(rs.getString("ringmode"));
//                         tphmmode.setColormode(rs.getString("colormode"));
//                         recList.add(tphmmode);
//                         i++;
//                    }
//                    stmt.close();
               }
          }
          finally{
               if(stmt!=null) stmt.close();
          }
     }
     /**
      * 有条件创建分页列表(含关联的表字段)
      */
     public void createList1(Connection con,int pageNo,int pageSize,String strSearch) throws SQLException
     {
          PreparedStatement stmt=null;
          ResultSet rs=null;
          String sql="";
          int i=0;
          try{
               if(pageNo==0 && pageSize==0){
                    recList=new ArrayList();
                    sql="select a.modeid,a.modename,a.screenlength,a.screenwidth,a.ringmode,a.colormode from tphmmode a where 1=1  "+strSearch;
                    stmt=con.prepareStatement(sql);
                    rs=stmt.executeQuery();
                    i=0;
                    while(rs.next()){
                         Tphmmode tphmmode=new Tphmmode();
                         tphmmode.setModeid(rs.getLong("modeid"));
                         tphmmode.setModename(rs.getString("modename"));
                         tphmmode.setScreenlength(rs.getInt("screenlength"));
                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
                         tphmmode.setRingmode(rs.getString("ringmode"));
                         tphmmode.setColormode(rs.getString("colormode"));
                         recList.add(tphmmode);
                         i++;
                    }
                    stmt.close();
               }else{
                    this.pageNo=pageNo;
                    this.pageSize=pageSize;
                    recList=new ArrayList();
                    sql="select a.modeid,a.modename,a.screenlength,a.screenwidth,a.ringmode,a.colormode from tphmmode a where 1=1  "+strSearch;
                    stmt=con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                    rs=stmt.executeQuery();
                    rs.last();
                    recCount=rs.getRow();
                    if(pageSize*(pageNo-1)==0){
                         rs.beforeFirst();
                    }else{
                         rs.absolute(pageSize*(pageNo-1));
                    }
                    i=0;
                    while(rs.next() && i<pageSize){
                         Tphmmode tphmmode=new Tphmmode();
                         tphmmode.setModeid(rs.getLong("modeid"));
                         tphmmode.setModename(rs.getString("modename"));
                         tphmmode.setScreenlength(rs.getInt("screenlength"));
                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
                         tphmmode.setRingmode(rs.getString("ringmode"));
                         tphmmode.setColormode(rs.getString("colormode"));
                         recList.add(tphmmode);
                         i++;
                    }
                    stmt.close();
//                    this.pageNo=pageNo;
//                    this.pageSize=pageSize;
//                    sql="select count(*) as cnt from tphmmode a where 1=1  "+strSearch;
//                    stmt = con.prepareStatement(sql);
//                    rs = stmt.executeQuery();
//                    if(rs.next()){
//                         recCount=rs.getInt("cnt");
//                    }
//                    stmt.close();
//                    recList=new ArrayList();
//                    sql="select a.modeid,a.modename,a.screenlength,a.screenwidth,a.ringmode,a.colormode from tphmmode a where 1=1  "+strSearch;
//                    stmt=con.prepareStatement(sql);
//                    rs=stmt.executeQuery();
//                    i=0;
//                    while(i<pageSize*(pageNo-1)){
//                         rs.next();
//                         i++;
//                    }
//                    i=0;
//                    while(rs.next() && i<pageSize){
//                         Tphmmode tphmmode=new Tphmmode();
//                         tphmmode.setModeid(rs.getLong("modeid"));
//                         tphmmode.setModename(rs.getString("modename"));
//                         tphmmode.setScreenlength(rs.getInt("screenlength"));
//                         tphmmode.setScreenwidth(rs.getInt("screenwidth"));
//                         tphmmode.setRingmode(rs.getString("ringmode"));
//                         tphmmode.setColormode(rs.getString("colormode"));
//                         recList.add(tphmmode);
//                         i++;
//                    }
//                    stmt.close();
               }
          }
          finally{
               if(stmt!=null) stmt.close();
          }
     }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -