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

📄 shangrights.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
package src.com;

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

/**
权限表
*/
public class ShangRights extends ShangObject
{
   private int roleId;
   /**
操作号
(执行存储过程 + 查看某表)
   */
   private int operationId;

  
   public ShangRights() 
   {
	tableName = "ShangRights";  
	viewName = "ShangRights";
	numInOnePager = 10;
   }
   
   
   public int loadAttr() {
      try {
	         roleId = rs.getInt("roleId");
	         operationId = rs.getInt("operationId");
         
      } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
      return 1;
   }

   
    public int insert() {
    	
     String sql= "Insert into ShangRights (roleId,operationId) values (?,?)";
     	
	 try{
		PreparedStatement updStmt=conn.prepareStatement(sql);
		updStmt.setInt(1,roleId);
	        updStmt.setInt(2,operationId);
	        updStmt.executeUpdate();
	       	updStmt.close();
		return 1; 
      }catch(SQLException E){
      	System.out.println(E.getMessage());
      	return -102;
      }
     
     
  }
  
  
  public int deleteRole(int roleId){
  	
  	String sql="delete ShangRights where roleId=?";
    	try{
		PreparedStatement updStmt = conn.prepareStatement(sql);
		updStmt.setInt(1,roleId);
		updStmt.executeUpdate();
		updStmt.close();
		return 1; 
	
      }catch(SQLException E){
      	System.out.println(E.getMessage());
      	return -102;
      }
  	
  	
  	}
   /**
* Access method for the userId property.
*
* @return   the current value of the userId property
   */
   public int getRoleId() 
   {
      return roleId;
   }
   
   /**
* Sets the value of the userId property.
*
* @param aUserId the new value of the userId property
   */
   public void setRoleId(int aroleId) 
   {
      roleId = aroleId;
   }
   
   /**
* Access method for the operationId property.
*
* @return   the current value of the operationId property
   */
   public int getOperationId() 
   {
      return operationId;
   }
   
   /**
* Sets the value of the operationId property.
*
* @param aOperationId the new value of the operationId property
   */
   public void setOperationId(int aOperationId) 
   {
      operationId = aOperationId;
   }
   
  
}

⌨️ 快捷键说明

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