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

📄 productprice.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
//Source file: D:\work\五洋\javaBean\src\ProductPrice.java

package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;


public class ProductPrice extends ShangObject
{
   
   /**
产品编号
   */
   private String productId;
   
   /**
销售价格
   */
   private float refPrice;
   
   /**
定价日期
   */
   private Timestamp priceDate;
   
  
   
   /**
* Access method for the productId property.
*
* @return   the current value of the productId property
   */
   public String getProductId() {
      return productId;}
   
   /**
* Sets the value of the productId property.
*
* @param aProductId the new value of the productId property
   */
   public void setProductId(String aProductId) {
      productId = aProductId;}
   
   /**
* Access method for the refPrice property.
*
* @return   the current value of the refPrice property
   */
   public float getRefPrice() {
      return refPrice;}
   
   /**
* Sets the value of the refPrice property.
*
* @param aRefPrice the new value of the refPrice property
   */
   public void setRefPrice(float aRefPrice) {
      refPrice = aRefPrice;}
   
   /**
* Access method for the priceDate property.
*
* @return   the current value of the priceDate property
   */
   public Timestamp getPriceDate() {
      return priceDate;}
   
   /**
* Sets the value of the priceDate property.
*
* @param aPriceDate the new value of the priceDate property
   */
   public void setPriceDate(Timestamp aPriceDate) {
      priceDate = aPriceDate;}
public  ProductPrice()
 {
	primarykey1Name="productId" ;
primarykey1Type=1;
tableName ="ProductPrice";
viewName="ProductPrice";
numInOnePager=10;}
 private String  priceDaten;
 private String  priceDatey;
 private String  priceDater;
 public String getPriceDaten() {
return priceDaten;}

 public void setPriceDaten(String astr) {
priceDaten = astr;}
 public String getPriceDatey() {
return priceDatey;}

 public void setPriceDatey(String astr) {
priceDatey = astr;}
 public String getPriceDater() {
return priceDater;}

 public void setPriceDater(String astr) {
priceDater = astr;}
public String getWhereClause(javax.servlet.ServletRequest request) {
String whereClause = "";
whereClause = addWhereClause(whereClause, "productId", "=", "'",request.getParameter("productId"));
whereClause = addWhereClause(whereClause, "refPrice", "like", "'",request.getParameter("refPrice"));
if((request.getParameter("priceDaten")!=null)&&(request.getParameter("priceDatey")!=null)&&(request.getParameter("priceDater")!=null)&&(!request.getParameter("priceDaten").equals(""))&&(!request.getParameter("priceDatey").equals(""))&&(!request.getParameter("priceDater").equals(""))){
priceDate=Timestamp.valueOf(priceDaten+"-"+priceDatey+"-"+priceDater+" 0:0:0.0");
whereClause = addWhereClause(whereClause, "priceDate", "like", "'",""+priceDate);
}
return whereClause;
}
public int loadAttr() {
 try { 
productId= getRsString(rs,"productId");
refPrice= rs.getFloat("refPrice");
priceDate= rs.getTimestamp("priceDate");
priceDaten=""+priceDate.getYear();
priceDatey=""+priceDate.getMonth();
priceDater=""+priceDate.getDate();
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
    return 1;
    }
public int update() {
 String sql= "{?=call sp_UpdateProductPrice(?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt,2,productId);
updStmt.setFloat(3,refPrice);
priceDate=Timestamp.valueOf(priceDaten+"-"+priceDatey+"-"+priceDater+" 0:0:0.0");
updStmt.setTimestamp(4,priceDate);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode; 
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
  }
}

  public int insert() {
 	String sql= "{?=call sp_InsertProductPrice(?,?)}";
	try	{
		CallableStatement updStmt=conn.prepareCall(sql);
		updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
		setStmtString(updStmt,2,productId);
		updStmt.setFloat(3,refPrice);
		updStmt.executeUpdate();
		int rtcode = updStmt.getInt(1);
		updStmt.close();
		return rtcode; 
	} catch(SQLException E) {
		System.out.println(E.getMessage());
		return -102;
  	}
  }

}

⌨️ 快捷键说明

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