📄 goodsshelfidcode.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: GoodsShelfIDCode.java
package mediastore.dao;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import mediastore.common.DBConnection;
import mediastore.util.StrUtility;
// Referenced classes of package mediastore.dao:
// GoodsInfo
public class GoodsShelfIDCode
{
public GoodsShelfIDCode()
{
}
public String getGoodsShelfIDName(String goodsShelfId)
{
String tmpStr;
tmpStr = "";
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String strSQL = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
stmt = conn.createStatement();
strSQL = "SELECT GoodsShelfIDName FROM TabGoodsShelfIDCode WHERE GoodsShelfID='" + goodsShelfId + "'";
rs = stmt.executeQuery(strSQL);
if(rs.next())
tmpStr = rs.getString(1);
rs.close();
rs = null;
}
catch(Exception exception) { }
finally
{
try
{
if(rs != null)
rs.close();
if(stmt != null)
stmt.close();
if(conn != null)
dbc.closeDBConnection(conn);
}
catch(SQLException e) { }
}
return tmpStr;
}
public List getGoodsShelfIdList()
{
List tmpList;
tmpList = new ArrayList();
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String strSQL = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
stmt = conn.createStatement();
strSQL = "SELECT GoodsShelfID, GoodsShelfIDName FROM TabGoodsShelfIDCode ";
String tmp[];
for(rs = stmt.executeQuery(strSQL); rs.next(); tmpList.add(tmp))
{
tmp = new String[3];
tmp[0] = rs.getString(1);
tmp[1] = rs.getString(2);
GoodsInfo gi = new GoodsInfo();
if(gi.getGoodsShelfIdCount(rs.getString(1)) > 0)
tmp[2] = "0";
else
tmp[2] = "1";
}
rs.close();
rs = null;
}
catch(Exception exception) { }
finally
{
try
{
if(rs != null)
rs.close();
if(stmt != null)
stmt.close();
if(conn != null)
dbc.closeDBConnection(conn);
}
catch(SQLException e) { }
}
return tmpList;
}
public int insertNewGoodsShelfId(int max, String goodsShelfIdName)
{
int nRet;
nRet = 0;
String goodsShelfId = "";
goodsShelfId = String.valueOf(max);
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
String strSQL = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
strSQL = "insert into TabGoodsShelfIDCode( GoodsShelfID, GoodsShelfIDName) values ('" + goodsShelfId + "', '" + StrUtility.replaceString(goodsShelfIdName, "'", "''") + "')";
nRet = stmt.executeUpdate(strSQL);
if(nRet != 1)
{
nRet = -1;
throw new Exception("插入新记录错误");
}
conn.commit();
}
catch(Exception e)
{
nRet = -1;
}
finally
{
try
{
if(stmt != null)
stmt.close();
if(conn != null)
dbc.closeDBConnection(conn);
}
catch(SQLException ex) { }
}
return nRet;
}
public int updateGoodsShelf(String goodsShelfId, String newGoodsShelfIdName)
{
int nRet;
nRet = 0;
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
String strSQL = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
stmt = conn.createStatement();
strSQL = "UPDATE TabGoodsShelfIDCode SET GoodsShelfIDName = '" + StrUtility.replaceString(newGoodsShelfIdName, "'", "''") + "' WHERE GoodsShelfID = '" + goodsShelfId + "'";
stmt.executeUpdate(strSQL);
}
catch(Exception e)
{
nRet = -1;
}
finally
{
try
{
if(stmt != null)
stmt.close();
if(conn != null)
dbc.closeDBConnection(conn);
}
catch(SQLException e) { }
}
return nRet;
}
public int deleteGoodsShelfId(String goodsShelfId)
{
int nRet;
nRet = 0;
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
String strSQL = "DELETE FROM TabGoodsShelfIDCode WHERE GoodsShelfID='" + goodsShelfId + "' ";
stmt = conn.createStatement();
nRet = stmt.executeUpdate(strSQL);
if(nRet != 1)
nRet = -1;
}
catch(Exception e)
{
e.printStackTrace();
nRet = -1;
}
finally
{
try
{
if(stmt != null)
stmt.close();
if(conn != null)
dbc.closeDBConnection(conn);
}
catch(SQLException e) { }
}
return nRet;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -