📄 lendlist.java
字号:
package device;
import java.sql.ResultSet;
import java.util.Vector;
import devicecomm.DBOper;
import devicecomm.StringOper;
public class LendList {
private String DevId; // 设备编号
private int LendId; // 领用编号
private int Listid; // 列表编号
private int LCount; // 领用数量
StringOper so = new StringOper();
public boolean getLendList()throws Exception
{
// int conditionNo = 0;
DBOper o_DBOper = new DBOper();
ResultSet rs = null;
String sql = "Select * from Dev_LendList where Listid="+Listid;
try
{
rs = o_DBOper.getResultSet(sql);
if(rs.next())
{
setListId(rs.getInt("Listid"));
setLendId(rs.getInt("LendId"));
setDevId(so.ReplaceNull(rs.getString("DevId")));
setLCount(rs.getInt("LCount"));
return true;
}
}
catch(Exception e)
{
throw new Exception(e.getMessage());
}
finally
{
try {o_DBOper.close();} catch (Exception e) { System.out.print(e.toString());}
}
return false;
}
public Vector getMoreLendList() throws Exception
{
Vector v_list = new Vector();
int conditionNo = 0;
DBOper o_DBOper = new DBOper();
ResultSet rs = null;
String sql = "Select * from Dev_LendList";
String condition = " where ";
try
{
if(LendId != 0)
{
condition += " LendId="+LendId;
conditionNo++;
}
if(Listid != 0)
{
if(conditionNo > 0)
{
condition += " and";
}
condition += " Listid="+Listid;
conditionNo++;
}
if(DevId != null)
{
if(conditionNo > 0)
{
condition += " and ";
}
condition += " DevId='"+DevId+"'";
conditionNo++;
}
if(conditionNo > 0)
{
sql += condition;
}
sql += " order by Listid desc";
rs = o_DBOper.getResultSet(sql);
//System.out.println(sql);
while(rs.next())
{
LendList o_list2 = new LendList();
o_list2.setListId(rs.getInt("Listid"));
o_list2.setLendId(rs.getInt("LendId"));
o_list2.setDevId(so.ReplaceNull(rs.getString("DevId")));
o_list2.setLCount(rs.getInt("LCount"));
v_list.add(o_list2);
}
}
catch(Exception e)
{
throw new Exception(e.getMessage());
}
finally
{
try {o_DBOper.close();} catch (Exception e) { System.out.print(e.toString());}
}
return v_list;
}
//删除领用记录
public void DeleteLendList(String Listid) throws Exception
{
DBOper o_DBOper = new DBOper();
//ResultSet rs = null;
String sql_dlt = "delete from Dev_LendList where Listid in(" + Listid+")";
try
{
// System.out.println(sql_dlt);
o_DBOper.DataUpdate(sql_dlt);
}
catch(Exception e)
{
throw new Exception(e.getMessage());
}
finally
{
try {o_DBOper.close();} catch (Exception e) { System.out.print(e.toString());}
}
}
//插入领用记录
public void CreateLendList() throws Exception
{
DBOper o_DBOper = new DBOper();
// ResultSet rs = null;
String sql = "insert into Dev_LendList(LendId,DevId,LCount) ";
sql =sql+"values("+LendId+",'"+DevId+"',"+LCount+")";
try
{
o_DBOper.DataUpdate(sql);
}
catch(Exception e)
{
throw new Exception(e.getMessage());
}
finally
{
try {o_DBOper.close();} catch (Exception e) { System.out.print(e.toString());}
}
}
//更新领用记录
public void UpdateLendList() throws Exception
{
DBOper o_DBOper = new DBOper();
// ResultSet rs = null;
String sql = "update Dev_LendList set LCount="+LCount+" where Listid="+Listid;
// System.out.println("UPDATE SQL :"+sql);
try
{
o_DBOper.DataUpdate(sql);
}
catch(Exception e)
{
throw new Exception(e.getMessage());
}
finally
{
try {o_DBOper.close();} catch (Exception e) { System.out.print(e.toString());}
}
}
public void setListId(int Listid){
this.Listid = Listid;
}
public int getListId(){
return this.Listid;
}
public void setLendId(int LendId){
this.LendId = LendId;
}
public int getLendId(){
return this.LendId;
}
public void setDevId(String DevId){
this.DevId = DevId;
}
public String getDevId(){
return this.DevId;
}
public void setLCount(int iCount){
this.LCount = iCount;
}
public int getLCount(){
return this.LCount;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -