📄 wpxx.java
字号:
package JXC.web;
import JXC.Com.DBConnect;
import JXC.util.StrFun;
import java.lang.String;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Title: 物品信息
* Description:
* Copyright: Copyright (c) 2003
* Company: torch
* @author: wind
* @version 1.0
*/
public class WPXX {
private int Id; //ID序列号
private String type; //物品类别
private String bh; //物品编号
private String name;
private String xh;
private String dw;
private float dj;
private String cd;
public WPXX() {
Id = 0;
type = "";
name = "";
bh = "";
xh = "";
dw = "";
dj = 0 ;
cd = "";
}
public WPXX(int newId,String newtype,String newbh, String newname,String newxh,String newdw,float newdj,String newcd ) {
Id = newId;
type = newtype;
name = newname;
bh = newbh;
xh = newxh;
dw = newdw;
dj = newdj;
cd = newcd;
}
public int getId() {
return Id;
}
public void setId (int newId) {
this.Id = newId;
}
public void setId(String newId){
if (newId!=null)
this.Id = Integer.parseInt(newId);;
}
public String gettype() {
return type;
}
public void settype(String newtype){
this.type = newtype;
}
public String getbh() {
return bh;
}
public void setbh (String newbh) {
this.bh = newbh;
}
public String getname() {
return name;
}
public void setname (String newname) {
this.name = newname;
}
public String getxh() {
return xh;
}
public void setxh (String newxh) {
this.xh = newxh;
}
public String getdw() {
return dw;
}
public void setdw (String newdw) {
this.dw = newdw;
}
public float getdj() {
return dj;
}
public void setdj (float newdj) {
this.dj = newdj;
}
public void setdj (String newdj) {
if (newdj==null)
dj=0;
else
this.dj = Float.parseFloat(newdj);
// this.dj = new Float(newdj).floatValue();
}
public String getcd() {
return cd;
}
public void setcd (String newcd) {
this.cd = newcd;
}
public boolean excute() throws Exception {
String Str="Select * From wp where ID="+Id;
try {
DBConnect dbc = new DBConnect(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = dbc.executeQuery(Str);
if (rs.next()){
bh = rs.getString("bh");
type=rs.getString("type");
name=rs.getString("name");
xh=rs.getString("xh");
dw=rs.getString("dw");
dj=rs.getFloat("dj");
cd=rs.getString("cd");
}
rs.close();
dbc.close();
return true;
}
catch (SQLException sqle){
return false;
}
}
public void Del() throws Exception {
String Str="Delete From wp where ID="+Id;
DBConnect dbc = new DBConnect();
dbc.executeUpdate(Str);
dbc.close();
}
public void Edit(HttpServletRequest request) throws Exception {
String id=StrFun.getString(request,"id");
bh =StrFun.getString(request,"bh");
name=StrFun.getString(request,"name");
type=StrFun.getString(request,"type");
xh =StrFun.getString(request,"xh");
dw =StrFun.getString(request,"dw");
dj =StrFun.getFloat(request,"dj");
cd =StrFun.getString(request,"cd");
String Str="Update wp set bh='"+bh+"',name='"+name+"',type='"+type+"',xh='"+xh
+"',dw='"+dw+"',cd='"+cd+"',dj="+dj+" where ID="+id;
DBConnect dbc = new DBConnect();
dbc.executeUpdate(Str);
dbc.close();
}
public void Add(HttpServletRequest request) throws Exception {
bh =StrFun.getString(request,"bh");
name=StrFun.getString(request,"name");
type=StrFun.getString(request,"type");
xh =StrFun.getString(request,"xh");
dw =StrFun.getString(request,"dw");
dj =StrFun.getFloat(request,"dj");
cd =StrFun.getString(request,"cd");
String Str="insert into wp (bh,name,type,xh,dw,cd,dj) values('"+bh+"','"+name+"','"+type+"','"+xh
+"','"+dw+"','"+cd+"',"+dj+")";
DBConnect dbc = new DBConnect();
dbc.executeUpdate(Str);
dbc.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -