📄 tpushlistimpl.java
字号:
package com.sxit.pim.push;
import com.sxit.common.ListImpl;
import java.util.*;
import java.sql.*;
/**
* <p>类名: TpushListImpl</p>
* <p>功能: push</p>
* <p>公司: 深讯信科</p>
* <p>版本: 1.0</p>
* @程序 sxit
* @日期 2005-12-15
* @修改纪录
*/
public class TpushListImpl extends ListImpl
{
public TpushListImpl()
{
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 id,frommdn,tomdn,title,url,status,result,channelid,systime,corporationid from tpush "+strSearch;
stmt=con.prepareStatement(sql);
rs=stmt.executeQuery();
i=0;
while(rs.next()){
Tpush tpush=new Tpush();
tpush.setId(rs.getInt("id"));
tpush.setFrommdn(rs.getString("frommdn"));
tpush.setTomdn(rs.getString("tomdn"));
tpush.setTitle(rs.getString("title"));
tpush.setUrl(rs.getString("url"));
tpush.setStatus(rs.getInt("status"));
tpush.setResult(rs.getString("result"));
tpush.setChannelid(rs.getString("channelid"));
tpush.setSystime(rs.getTimestamp("systime"));
tpush.setCorporationid(rs.getLong("corporationid"));
recList.add(tpush);
i++;
}
stmt.close();
}else{
this.pageNo=pageNo;
this.pageSize=pageSize;
recList=new ArrayList();
sql="select id,frommdn,tomdn,title,url,status,result,channelid,systime,corporationid from tpush "+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){
Tpush tpush=new Tpush();
tpush.setId(rs.getInt("id"));
tpush.setFrommdn(rs.getString("frommdn"));
tpush.setTomdn(rs.getString("tomdn"));
tpush.setTitle(rs.getString("title"));
tpush.setUrl(rs.getString("url"));
tpush.setStatus(rs.getInt("status"));
tpush.setResult(rs.getString("result"));
tpush.setChannelid(rs.getString("channelid"));
tpush.setSystime(rs.getTimestamp("systime"));
tpush.setCorporationid(rs.getLong("corporationid"));
recList.add(tpush);
i++;
}
stmt.close();
// this.pageNo=pageNo;
// this.pageSize=pageSize;
// strSearch=" where 1=1 "+strSearch;
// sql="select count(*) as cnt from tpush "+strSearch;
// stmt = con.prepareStatement(sql);
// rs = stmt.executeQuery();
// if(rs.next()){
// recCount=rs.getInt("cnt");
// }
// stmt.close();
// recList=new ArrayList();
// sql="select id,frommdn,tomdn,title,url,status,result,channelid,systime,corporationid from tpush "+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){
// Tpush tpush=new Tpush();
// tpush.setId(rs.getInt("id"));
// tpush.setFrommdn(rs.getString("frommdn"));
// tpush.setTomdn(rs.getString("tomdn"));
// tpush.setTitle(rs.getString("title"));
// tpush.setUrl(rs.getString("url"));
// tpush.setStatus(rs.getInt("status"));
// tpush.setResult(rs.getString("result"));
// tpush.setChannelid(rs.getInt("channelid"));
// tpush.setSystime(rs.getTimestamp("systime"));
// tpush.setCorporationid(rs.getInt("corporationid"));
// recList.add(tpush);
// 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.id,a.frommdn,a.tomdn,a.title,a.url,a.status,a.result,a.channelid,a.systime,a.corporationid,b.channel_name from tpush a,tchannel b where a.channelid=b.channelid and 1=1 "+strSearch;
stmt=con.prepareStatement(sql);
rs=stmt.executeQuery();
i=0;
while(rs.next()){
Tpush tpush=new Tpush();
tpush.setId(rs.getInt("id"));
tpush.setFrommdn(rs.getString("frommdn"));
tpush.setTomdn(rs.getString("tomdn"));
tpush.setTitle(rs.getString("title"));
tpush.setUrl(rs.getString("url"));
tpush.setStatus(rs.getInt("status"));
tpush.setResult(rs.getString("result"));
tpush.setChannelid(rs.getString("channelid"));
tpush.setSystime(rs.getTimestamp("systime"));
tpush.setCorporationid(rs.getLong("corporationid"));
tpush.setChannelname(rs.getString("channel_name"));
recList.add(tpush);
i++;
}
stmt.close();
}else{
this.pageNo=pageNo;
this.pageSize=pageSize;
recList=new ArrayList();
sql="select a.id,a.frommdn,a.tomdn,a.title,a.url,a.status,a.result,a.channelid,a.systime,a.corporationid,b.channel_name from tpush a,tchannel b where a.channelid=b.channelid and 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){
Tpush tpush=new Tpush();
tpush.setId(rs.getInt("id"));
tpush.setFrommdn(rs.getString("frommdn"));
tpush.setTomdn(rs.getString("tomdn"));
tpush.setTitle(rs.getString("title"));
tpush.setUrl(rs.getString("url"));
tpush.setStatus(rs.getInt("status"));
tpush.setResult(rs.getString("result"));
tpush.setChannelid(rs.getString("channelid"));
tpush.setSystime(rs.getTimestamp("systime"));
tpush.setCorporationid(rs.getLong("corporationid"));
tpush.setChannelname(rs.getString("channel_name"));
recList.add(tpush);
i++;
}
stmt.close();
// this.pageNo=pageNo;
// this.pageSize=pageSize;
// sql="select count(*) as cnt from tpush 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.id,a.frommdn,a.tomdn,a.title,a.url,a.status,a.result,a.channelid,a.systime,a.corporationid from tpush 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){
// Tpush tpush=new Tpush();
// tpush.setId(rs.getInt("id"));
// tpush.setFrommdn(rs.getString("frommdn"));
// tpush.setTomdn(rs.getString("tomdn"));
// tpush.setTitle(rs.getString("title"));
// tpush.setUrl(rs.getString("url"));
// tpush.setStatus(rs.getInt("status"));
// tpush.setResult(rs.getString("result"));
// tpush.setChannelid(rs.getInt("channelid"));
// tpush.setSystime(rs.getTimestamp("systime"));
// tpush.setCorporationid(rs.getInt("corporationid"));
// recList.add(tpush);
// i++;
// }
// stmt.close();
}
}
finally{
if(stmt!=null) stmt.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -