www.pudn.com > BeiJie.rar > ShouldGetCheckOper.java


package operation; 
 
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.util.ArrayList; 
import java.util.Collection; 
 
import entity.ShouldGetList; 
 
import dataBase.DataBase; 
 
public class ShouldGetCheckOper 
{ 
	private DataBase db=null; 
	private ResultSet rs = null; 
	public ShouldGetCheckOper() 
	{ 
		db = new DataBase(); 
	} 
	public Collection getShouldGetList(String starttime,String endtime) 
	{ 
		Collection ret = new ArrayList(); 
		String sql = "select * from shouldgetlist where ShouldGetDate between '"+starttime+"' and '"+endtime+"'"; 
		rs=db.getResult(sql);//执行SQL语句 
		try 
		{ 
			while(rs.next()) 
			{ 
				ShouldGetList sgl = new ShouldGetList(); 
				sgl.setShouldGetID(rs.getString("ShouldGetID")); 
				sgl.setSaleID(rs.getString("SaleID")); 
				sgl.setShouldGetSum(rs.getFloat("ShouldGetSum")); 
				sgl.setLeaveSum(rs.getFloat("LeaveSum")); 
				sgl.setShouldGetFlag(rs.getString("ShouldGetFlag")); 
				sgl.setChargeman(rs.getString("Chargeman")); 
				sgl.setShouldGetDate(rs.getDate("ShouldGetDate")); 
				sgl.setShouldGetNotice(rs.getString("ShouldGetNotice")); 
				ret.add(sgl); 
			} 
			rs.close(); 
			db.close(); 
		} catch (SQLException e) 
		{ 
			// TODO 自动生成 catch 块 
			e.printStackTrace(); 
		} 
		return ret; 
	} 
	 
	public Collection getShouldGetList(String saleID) 
	{ 
		Collection ret = new ArrayList(); 
		String sql = "select * from shouldgetlist where saleID = '"+saleID+"'"; 
		rs=db.getResult(sql);//执行SQL语句 
		try 
		{ 
			while(rs.next()) 
			{ 
				ShouldGetList sgl = new ShouldGetList(); 
				sgl.setShouldGetID(rs.getString("ShouldGetID")); 
				sgl.setSaleID(rs.getString("SaleID")); 
				sgl.setShouldGetSum(rs.getFloat("ShouldGetSum")); 
				sgl.setLeaveSum(rs.getFloat("LeaveSum")); 
				sgl.setShouldGetFlag(rs.getString("ShouldGetFlag")); 
				sgl.setChargeman(rs.getString("Chargeman")); 
				sgl.setShouldGetDate(rs.getDate("ShouldGetDate")); 
				sgl.setShouldGetNotice(rs.getString("ShouldGetNotice")); 
				ret.add(sgl); 
			} 
			rs.close(); 
			db.close(); 
		} catch (SQLException e) 
		{ 
			// TODO 自动生成 catch 块 
			e.printStackTrace(); 
		} 
		return ret; 
	} 
 
}