软件图书管理系统+CDM图+PDM图+表间关系图 第7页
return false;
else
return true;
}
//判断某书是否可以被借
public boolean ifCanBorrow(String sqh)
{
String sql="";
sql="select * from KJB2_KJXX_STORE where ZT='可借'";
Vector vect=(Vector)searchData(sql);
if(vect.isEmpty())
return false;
else
return true;
}
//还书,参数为索取号
public int[] backBorrow(String sqh)
{
System.out.println("批量处理还书。。。。。");
String sql="";
String strBOOKID=ds.toString((String)toName("KJB2_KJXX_STORE","SQH","BOOKID",sqh));
String strNow = ds.getDateTime();
strNow = strNow.substring(0,10);
createStatement();
clearBatch();
sql="update KJB2_KJXX_JYB set ZT='"+strOne+"',GHRQ='"+strNow+"' where BOOKID="+strBOOKID+" and ZT='"+strZero+"'";
System.out.println("sql1:"+sql);
addBatch(sql);
sql="update KJB2_KJXX_STORE set ZT='可借' where BOOKID="+strBOOKID;
System.out.println("sql2:"+sql);
addBatch(sql);
int result[]=executeBatch();
closeStm();
return result;
}
//根据所还书的索取号取得,此书的信息和是否过期等信息
public Hashtable checkBook(String sqh)
{
String sql="";
String strBOOKID=ds.toString((String)toName("KJB2_KJXX_STORE","SQH","BOOKID",sqh));
if(strBOOKID.equals("")) strBOOKID="-1";
String strBOOKCLASSID=ds.toString((String)toName("KJB2_KJXX_STORE","SQH","BOOKCLASSID",sqh));
if(strBOOKCLASSID.equals("")) strBOOKCLASSID="-1";
sql="select TITLE,AUTHOR,ISBN,CBSJ,DJ,PCJE,READERID,JYSJ,DQSJ "
+" from KJB2_KJXX_BOOK,KJB2_KJXX_JYB "
+" where KJB2_KJXX_BOOK.BOOKCLASSID="+strBOOKCLASSID+" and KJB2_KJXX_JYB.BOOKID="+strBOOKID+" and KJB2_KJXX_JYB.ZT='"+strZero+"'";
return searchOneData(sql);
}
//............................................................................................//
//个人信息
//取得书籍
public Vector getBorBooks(String zgbh,String type)
{
String sql="";
String strNow = ds.getDateTime();
strNow = strNow.substring(0,10);
sql="select READERID from KJB2_KJXX_READER where GH='"+zgbh+"' and(ZT='注册' or ZT='挂失')";
Hashtable hash = (Hashtable)searchOneData(sql);
String strREADERID=ds.toString((String)hash.get("READERID"));
//在借的所有书籍
if(type.equals("0"))
{
sql="select * from KJB2_KJXX_JYB where READERID="+strREADERID+" and ZT='"+strZero+"'";
}
//借阅历史
if(type.equals("1"))
{
sql="select * from KJB2_KJXX_JYB where READERID="+strREADERID+" and ZT='"+strOne+"'";
}
//所有有效预约书
if(type.equals("2"))
{
sql=" select * from KJB2_KJXX_YYB "
+" where READERID="+strREADERID+" and ZT='生效' and DQSJ>='"+strNow+"'";
}
return searchData(sql);
}
//分页取得书籍
public Vector getPageBorBooks(String zgbh,String type,int page)
{
String sql="";
String strNow = ds.getDateTime();
strNow = strNow.substring(0,10);
sql="select READERID from KJB2_KJXX_READER where GH='"+zgbh+"' and(ZT='注册' or ZT='挂失')";
Hashtable hash = (Hashtable)searchOneData(sql);
String strREADERID=ds.toString((String)hash.get("READERID"));
if(strREADERID.equals("")) strREADERID="-1";
//在借的所有书籍
if(type.equals("0"))
{
sql="select * from KJB2_KJXX_JYB where READERID="+strREADERID+" and ZT='"+strZero+"' order by JYSJ";
System.out.println(sql);
}
//借阅历史
if(type.equals("1"))
{
sql="select * from KJB2_KJXX_JYB where READERID="+strREADERID+" and ZT='"+strOne+"' order by GHRQ";
}
//所有有效预约书
if(type.equals("2"))
{
sql=" select * from KJB2_KJXX_YYB "
+" where READERID="+strREADERID+" and ZT='生效' and DQSJ>='"+strNow+"'";
}
return getOnePage(sql,page,20);
}
//续借
public int[] setContinue(String zgbh,String jyid)
{
String sql="";
sql="select KXJSJ from KJB2_KJXX_RULE,KJB2_KJXX_READER "
+" where KJB2_KJXX_READER.GH='"+zgbh+"' and KJB2_KJXX_READER.RULEID=KJB2_KJXX_RULE.RULEID ";
Hashtable hash = (Hashtable)searchOneData(sql);
String strKXJSJ=ds.toString((String)hash.get("KXJSJ"));
sql=" update KJB2_KJXX_JYB set XJCS=XJCS+1,DQSJ=to_char((to_date(DQSJ,'yyyy-MM-dd')+"+strKXJSJ+"),'yyyy-MM-dd') "
+" where JYID="+jyid+"";
System.out.println("sqlsql:"+sql);
/*return deleteRecord(sql);*/
createStatement();
clearBatch();
addBatch(sql);
int result[]=executeBatch();
closeStm();
return result;
}
//取消预约
public int setConcel(String yyid)
{
String sql="";
sql="update KJB2_KJXX_YYB set ZT='取消' where YYID="+yyid;
return deleteRecord(sql);
}
//查找所有的统一函数
private Vector searchData(String sql)
{
Vector vect = new Vector();
ResultSet rs = selectRecord(sql);
//取得列数和列名
Statement stmt = null;
try{
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
需要完整内容的请联系QQ3249114,本文免费,转发请注明源于www.751com.cn
}
vect.add(hash);
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vect;
}
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>