bollotbean.java

来自「spring+struts+hibernate做的银行系统」· Java 代码 · 共 116 行

JAVA
116
字号
/*
 * Created on 2006-3-26
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package cn.com.tym.newclass;

/**
 * @author jack_booth
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;


import cn.com.tym.pub.DB;
import cn.com.tym.util.text.DealText;
import cn.com.tym.util.text.ExchangeInput;


public class BollotBean {
	
	private int bollotId=0;
	private String bollotName=null;
	private int bollotSob=0;
	
	

	public int getBollotId() {
		return bollotId;
	}
	public void setBollotId(int bollotId) {
		this.bollotId = bollotId;
	}
	public String getBollotName() {
		return bollotName;
	}
	public void setBollotName(String bollotName) {
		this.bollotName = bollotName;
	}
 
	
	public int getBollotSob() {
		return bollotSob;
	}
	public void setBollotSob(int bollotSob) {
		this.bollotSob = bollotSob;
	}
	 public ArrayList bollotList(DB db)throws SQLException{
	    
	 
	     ArrayList list = new ArrayList();
		 	String strSql= "select bollot_id,bname,bollotSob from Mdh_bollot order by bollot_id desc"; 
		 	ResultSet rs = db.OpenSql(strSql);
		 	 
	     while(rs.next())
	     {
	         BollotBean bean=new BollotBean();
	         bean.setBollotId(rs.getInt("bollot_id"));
	         bean.setBollotName(rs.getString("bname"));
	         bean.setBollotSob(rs.getInt("bollotSob"));
	 
	         list.add(bean);
	         bean = null;
	     }
	 return list;
	 }
	
	 //ɾ���������
	    public boolean delete(String id,DB db)throws SQLException{
	    	int bid=ExchangeInput.StringToInt(id);
	   	 	String strSql= "delete from mdh_bollot  where bollot_id='"+bid+"'"; 
  
	        boolean check = false;
	         if(db.ExecSql(strSql)!= 0)
                check = true;
	     
        return check;
	    } 
		   //���ͶƱ
		     
		   public boolean addBollot(String name,DB db)
		    throws SQLException
		{
		    boolean bool=false;
		   	if(!name.equals("")){
		   	String names=ExchangeInput.StringToString(name);
		   			name=DealText.dealToSql(names);
		   
		   	 	String strSql= "insert into mdh_bollot values('"+names+"',0)"; 
		   	 	 if(db.ExecSql(strSql)!=0)
		   	 	 	bool=true;
		   	}
		    return bool; 
		}
		 
	//ͶƱ
		   public boolean goBollot(String id,DB db)
		    throws SQLException
		{
		 
		    boolean bool=false;
		    
		   	 	String strSql= "update mdh_bollot set bollotSob=bollotSob+1 where bollot_id='"+id+"'"; 
		   	 	 if(db.ExecSql(strSql)!=0){
		   	 	 	bool=true;
		   	}
		    return bool; 
		}	   
	
}

⌨️ 快捷键说明

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