📄 goodsclasscode.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: GoodsClassCode.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 GoodsClassCode
{
public GoodsClassCode()
{
}
public String getGoodsClassName(String goodsClass)
{
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 GoodsClassName FROM TabGoodsClassCode WHERE GoodsClass='" + StrUtility.replaceString(goodsClass, "'", "''") + "'";
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 getGoodsClassList()
{
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 GoodsClass, GoodsClassName FROM TabGoodsClassCode ";
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.getGoodsClassCount(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 insertNewGoodsClass(int max, String goodsClassName)
{
int nRet;
nRet = 0;
String goodsClass = "";
goodsClass = 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 TabGoodsClassCode( GoodsClass, GoodsClassName) values ('" + StrUtility.replaceString(goodsClass, "'", "''") + "', '" + StrUtility.replaceString(goodsClassName, "'", "''") + "')";
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 updateGoodsClass(String goodsClass, String newGoodsClassName)
{
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 TabGoodsClassCode SET GoodsClassName = '" + StrUtility.replaceString(newGoodsClassName, "'", "''") + "' WHERE GoodsClass = '" + StrUtility.replaceString(goodsClass, "'", "''") + "'";
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 deleteGoodsClass(String goodsClass)
{
int nRet;
nRet = 0;
DBConnection dbc = null;
Connection conn = null;
Statement stmt = null;
try
{
dbc = new DBConnection();
conn = dbc.getDBConnection();
String strSQL = "DELETE FROM TabGoodsClassCode WHERE GoodsClass='" + StrUtility.replaceString(goodsClass, "'", "''") + "' ";
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 + -