📄 production.java
字号:
//Source file: D:\work\五洋\javaBean\src\Production.java
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class Production extends ShangObject
{
/**
产品编号
*/
private String productId;
/**
产品名称
*/
private String productName;
/**
产品描述
*/
private String productDesc;
/**
产品产地
*/
private String productAddress;
/**
产品类别编号
*/
private String classId;
/**
产品单位
*/
private String unit;
/**
安全库存量
*/
private float attenQuantity;
/**
销售价格
*/
private float refPrice;
/**
产品英文名
*/
private String productEName;
/**
主营部门编号
*/
private String deptId;
public Production()
{
primarykey1Name = "productId";
primarykey1Type = 1;
tableName = "Production";
viewName = "Production";
numInOnePager = 10;
}
public int loadAttr() {
try {
productId = getRsString(rs,"productId");
productName = getRsString(rs,"productName");
productEName = getRsString(rs,"productEName");
productDesc = getRsString(rs,"productDesc");
productAddress = getRsString(rs,"productAddress");
classId = getRsString(rs,"classId");
unit = getRsString(rs,"unit");
attenQuantity = rs.getFloat("attenQuantity");
refPrice = rs.getFloat("refPrice");
deptId = getRsString(rs,"deptId");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
/* 新增
@loginName varchar(30)
,@ip varchar(20)
,@machineName varchar(30)
,@productId varchar(10)
,@productName varchar(30)
,@productEName varchar(30)
,@productDesc varchar(50)
,@productAddress varchar(50)
,@classId varchar(10)
,@unit varchar(30)
,@attenQuantity float
,@deptId varchar(30)
*/
public int insert() {
String sql= "{?=call sp_InsertProduction(?,?,?,?,?,?,?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注册OUT参数 */
setStmtString(updStmt, 2, theGlobal.loginName);
setStmtString(updStmt, 3, theGlobal.ip);
setStmtString(updStmt, 4, theGlobal.machineName);
setStmtString(updStmt,5,productId);
setStmtString(updStmt,6,productName);
setStmtString(updStmt,7,productEName);
setStmtString(updStmt,8,productDesc);
setStmtString(updStmt,9,productAddress);
setStmtString(updStmt,10,classId);
setStmtString(updStmt,11,unit);
updStmt.setFloat(12,attenQuantity);
setStmtString(updStmt,13,deptId);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
/*
修改
@loginName varchar(30)
,@ip varchar(20)
,@machineName varchar(30)
,@productId varchar(10)
,@productName varchar(50)
,@productEName varchar(50)
,@productDesc varchar(50)
,@productAddress varchar(50)
,@classId varchar(10)
,@unit varchar(30)
,@attenQuantity float
,@deptId varchar(30)
*/
public int update() {
String sql= "{?=call sp_UpdateProduction (?,?,?,?,?,?,?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注册OUT参数 */
setStmtString(updStmt, 2, theGlobal.loginName);
setStmtString(updStmt, 3, theGlobal.ip);
setStmtString(updStmt, 4, theGlobal.machineName);
setStmtString(updStmt,5,productId);
setStmtString(updStmt,6,productName);
setStmtString(updStmt,7,productEName);
setStmtString(updStmt,8,productDesc);
setStmtString(updStmt,9,productAddress);
setStmtString(updStmt,10,classId);
setStmtString(updStmt,11,unit);
updStmt.setFloat(12,attenQuantity);
setStmtString(updStmt,13,deptId);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
public int update(String productIdm,float refPricem) {
String sql= "{?=call sp_UpdateProductionprice (?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注册OUT参数 */
setStmtString(updStmt,2,productIdm);
updStmt.setFloat(3,refPricem);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
public String getWhereClause(javax.servlet.ServletRequest request) {
String whereClause = "";
String str;
int queryMode = (new Integer(request.getParameter("queryMode"))).intValue();
switch(queryMode)
{
case 1: // 综合查询
whereClause = addWhereClause(whereClause, "productId", "=", "'", request.getParameter("productId"));
whereClause = addWhereClause(whereClause, "productName", "like", "'", request.getParameter("productName"));
whereClause = addWhereClause(whereClause, "productEName", "=", "'", request.getParameter("productEName"));
whereClause = addWhereClause(whereClause, "classId", "=", "'", request.getParameter("classId"));
whereClause = addWhereClause(whereClause, "productAddress", "like", "'", request.getParameter("productAddress"));
whereClause = addWhereClause(whereClause, "deptId", "=", "'", request.getParameter("deptId"));
break;
case 2:
break;
}
return whereClause;
}
/**
* 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 = setChnString(aProductId);
}
/**
* Access method for the productName property.
*
* @return the current value of the productName property
*/
public String getProductName() {
return productName;}
/**
* Sets the value of the productName property.
*
* @param aProductName the new value of the productName property
*/
public void setProductName(String aProductName) {
productName = setChnString(aProductName);
}
/**
* Access method for the productEName property.
*
* @return the current value of the productEName property
*/
public String getProductEName()
{
return productEName;
}
/**
* Sets the value of the productEName property.
*
* @param aProductEName the new value of the productEName property
*/
public void setProductEName(String aProductEName)
{
productEName = setChnString(aProductEName);
}
/**
* Access method for the productDesc property.
*
* @return the current value of the productDesc property
*/
public String getProductDesc() {
return productDesc;}
/**
* Sets the value of the productDesc property.
*
* @param aProductDesc the new value of the productDesc property
*/
public void setProductDesc(String aProductDesc) {
productDesc = setChnString(aProductDesc);
}
/**
* Access method for the productAddress property.
*
* @return the current value of the productAddress property
*/
public String getProductAddress() {
return productAddress;}
/**
* Sets the value of the productAddress property.
*
* @param aProductAddress the new value of the productAddress property
*/
public void setProductAddress(String aProductAddress) {
productAddress = setChnString(aProductAddress);
}
/**
* Access method for the classId property.
*
* @return the current value of the classId property
*/
public String getClassId() {
return classId;}
/**
* Sets the value of the classId property.
*
* @param aClassId the new value of the classId property
*/
public void setClassId(String aClassId) {
classId = setChnString(aClassId);
}
/**
* Access method for the unit property.
*
* @return the current value of the unit property
*/
public String getUnit() {
return unit;}
/**
* Sets the value of the unit property.
*
* @param aUnit the new value of the unit property
*/
public void setUnit(String aUnit) {
unit = setChnString(aUnit);
}
/**
* Access method for the attenQuantity property.
*
* @return the current value of the attenQuantity property
*/
public float getAttenQuantity() {
return attenQuantity;}
/**
* Sets the value of the attenQuantity property.
*
* @param aAttenQuantity the new value of the attenQuantity property
*/
public void setAttenQuantity(float aAttenQuantity) {
attenQuantity = aAttenQuantity;}
/**
* Access method for the deptId property.
*
* @return the current value of the deptId property
*/
public String getDeptId() {
return deptId;}
/**
* Sets the value of the deptId property.
*
* @param aDeptId the new value of the deptId property
*/
public void setDeptId(String aDeptId) {
deptId =setChnString(aDeptId);
}
/**
* 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;}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -