import java.sql.Connection;

public class VoteDao {
    public void insert(){}
    public void delete(){}
    public void select(){}


    public void update( String [] vts){   //[1,2,4]
        String vt="0";
        for (String v:vts) {
            vt=vt+","+v;    //vt=0,1,2,4
        }
        //数据库需要执行的sql语句
        String sql ="update  vote set num=num+1  where vid in ("+vt+")";
       Connection conn=ConnDB.getConn();
       try{
           //执行sql
           conn.prepareStatement(sql).execute();
       }catch (Exception e){
           System.out.println("执行修改失败");
       }
       ConnDB.closeConn(conn);

    }

}
