⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goodsinfo.java

📁 用jsp,java写的在线购物系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public int updateGoodsClass(String goodsId, String newGoodsClass)
    {
        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 TabGoodsInfo SET GoodsClass = '" + StrUtility.replaceString(newGoodsClass, "'", "''") + "' WHERE GoodsID = '" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            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 updateGoodsShelfId(String goodsId, String newGoodsShelfId)
    {
        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 TabGoodsInfo SET GoodsShelfID = '" + newGoodsShelfId + "' WHERE GoodsID = '" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            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 updatePurchaseUnitPrice(String goodsId, float newPurchaseUnitPrice)
    {
        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 TabGoodsInfo SET PurchaseUnitPrice = " + newPurchaseUnitPrice + " WHERE GoodsID = '" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            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 updateSpecialUnitPrice(String goodsId, float newSpecialUnitPrice)
    {
        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 TabGoodsInfo SET SpecialUnitPrice = " + newSpecialUnitPrice + " WHERE GoodsID = '" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            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 List getGoodsTypeList()
    {
        List goodsTypeList;
        goodsTypeList = 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 DISTINCT TabGoodsTypeCode.GoodsType, TabGoodsTypeCode.GoodsTypeName FROM TabGoodsInfo,TabGoodsTypeCode WHERE TabGoodsInfo.GoodsType=TabGoodsTypeCode.GoodsType ";
            String tmp[];
            for(rs = stmt.executeQuery(strSQL); rs.next(); goodsTypeList.add(tmp))
            {
                tmp = new String[2];
                tmp[0] = rs.getString(1);
                tmp[1] = rs.getString(2);
            }

            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 goodsTypeList;
    }

    public List getGoodsClassList()
    {
        List goodsClassList;
        goodsClassList = 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 DISTINCT TabGoodsClassCode.GoodsClass, TabGoodsClassCode.GoodsClassName FROM TabGoodsInfo,TabGoodsClassCode WHERE TabGoodsInfo.GoodsClass=TabGoodsClassCode.GoodsClass ";
            String tmp[];
            for(rs = stmt.executeQuery(strSQL); rs.next(); goodsClassList.add(tmp))
            {
                tmp = new String[2];
                tmp[0] = rs.getString(1);
                tmp[1] = rs.getString(2);
            }

            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 goodsClassList;
    }

    public List getGoodsShelfList()
    {
        List goodsShelfList;
        goodsShelfList = 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 DISTINCT TabGoodsShelfIDCode.GoodsShelfID, TabGoodsShelfIDCode.GoodsShelfIDName FROM TabGoodsInfo,TabGoodsShelfIDCode WHERE TabGoodsInfo.GoodsShelfID=TabGoodsShelfIDCode.GoodsShelfID ";
            String tmp[];
            for(rs = stmt.executeQuery(strSQL); rs.next(); goodsShelfList.add(tmp))
            {
                tmp = new String[2];
                tmp[0] = rs.getString(1);
                tmp[1] = rs.getString(2);
            }

            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 goodsShelfList;
    }

    public List getGoodsCreatorsList()
    {
        List goodsCreatorsList;
        goodsCreatorsList = 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 DISTINCT Creators FROM TabGoodsInfo Order by Creators ";
            String tmp;
            for(rs = stmt.executeQuery(strSQL); rs.next(); goodsCreatorsList.add(tmp))
                tmp = 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 goodsCreatorsList;
    }

    public GoodsSearchResultInfo getGoodsListByRule(GoodsSearchRule gsr)
    {
        int totalRecNum;
        List GoodsList;
        GoodsSearchResultInfo gsri;
        int nRet = 0;
        totalRecNum = 0;
        GoodsList = new ArrayList();
        gsri = new GoodsSearchResultInfo();
        GoodsTypeCode gtc = new GoodsTypeCode();
        GoodsClassCode gcc = new GoodsClassCode();
        GoodsShelfIDCode gsic = new GoodsShelfIDCode();
        GoodsImportGoods gig = new GoodsImportGoods();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        String strSQLForCount = null;
        int startRecNum = gsr.getStartRecNum();
        int recNumOfPage = gsr.getRecNumOfPage();
        String orderStr = gsr.getOrderStr();
        String goodsId = gsr.getGoodsId();
        String goodsName = gsr.getGoodsName();
        String subjectPersons = gsr.getSubjectPersons();
        int repertoryAmount1 = gsr.getRepertoryAmount1();
        int repertoryAmount2 = gsr.getRepertoryAmount2();
        float importUnitPrice1 = gsr.getImportUnitPrice1();
        float importUnitPrice2 = gsr.getImportUnitPrice2();
        float purchaseUnitPrice1 = gsr.getPurchaseUnitPrice1();
        float purchaseUnitPrice2 = gsr.getPurchaseUnitPrice2();
        String goodsType = gsr.getGoodsType();
        String goodsClass = gsr.getGoodsClass();
        String goodsShelfId = gsr.getGoodsShelfId();
        String creators = gsr.getCreators();
        String confirmFlage = gsr.getConfirmFlage();
        String specialUnitPriceStatus = gsr.getSpecialUnitPriceStatus();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -