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

📄 productclass.java

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

package src.wuyang;

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

public class ProductClass extends ShangObject
{
   
   /**
产品类别编号
   */
   private String classId;
   
   /**
产品类别描述
   */
   private String classDesc;
   
   public ProductClass() 
   {
        primarykey1Name = "classId"; 
	primarykey1Type = 1; 
	tableName = "ProductClass";  
	viewName = "ProductClass";
	numInOnePager = 10;
   }
   
 
    public int loadAttr(){
     
      classId = getRsString(rs,"classId");
      classDesc = getRsString(rs,"classDesc");
      return 1;
      
    }
  
   public int insert(){
 	String sql ="insert into ProductClass (classId,classDesc) values (?,?)";
 	try{	
	 	PreparedStatement updStmt = conn.prepareStatement(sql);
	 	setStmtString(updStmt,1,classId);
	 	setStmtString(updStmt,2,classDesc);
	 	updStmt.executeUpdate();
	 	updStmt.close(); 
	 	return 0;
	 }catch(SQLException e){
	 	 System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}		
   }	   


   public int update(){
   	String sql = "update ProductClass set classDesc=? where classId='"
   			+ classId +"'";
   	try{
   		PreparedStatement updStmt = conn.prepareStatement(sql);
	 	setStmtString(updStmt,1,classDesc);
	 	print("sql== " + sql );
	 	updStmt.executeUpdate();
   		updStmt.close(); 
   		return 0;
   	}catch(SQLException e){
   		 System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}		
   }	   		
 
 
   /**
* 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) {
      try{
      	classId = new String(aClassId.getBytes("8859_1"));
      }catch(UnsupportedEncodingException e) {
      	System.out.println("error in getbytes");
      }
      }
   
   /**
* Access method for the classDesc property.
*
* @return   the current value of the classDesc property
   */
   public String getClassDesc() {
      return classDesc;}
   
   /**
* Sets the value of the classDesc property.
*
* @param aClassDesc the new value of the classDesc property
   */
   public void setClassDesc(String aClassDesc) {
      try{
      	classDesc = new String(aClassDesc.getBytes("8859_1"));
      }catch(UnsupportedEncodingException e) {
      	System.out.println("error in getbytes");
      }
      }

}

⌨️ 快捷键说明

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