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

📄 tchannelimpl.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
          return cnt;
     }
     /**
      * 删除多条数据
      */
     public static String getChannelname(Connection con,String mycorp) throws SQLException
   {
        PreparedStatement stmt=null;
        ResultSet rs=null;
        String sql="";
        String str="";
        String str2="";
        int i=0;

        try {
             sql="select id,cp_name from tcp where corporationid in ("+mycorp+")";
             stmt=con.prepareStatement(sql);
             rs=stmt.executeQuery();
             str="<option value=\"0\">请选择</option>";

             while(rs.next())
             {

                  str=str+
                      "<option value=\""+
                      rs.getInt("id")+
                      "\">"+str2+
                      rs.getString("cp_name")+
                      "</option>";
             }
             stmt.close();
//               sql="select typeid,typename,parentid,isleaf,isactual,level from tsmstype where statusid=2 start with parentid=0 connect by prior typeid=parentid";
//               stmt=con.prepareStatement(sql);
//               rs=stmt.executeQuery();
//               str="<option value=\"0\">请选择</option>";
//
//               while(rs.next())
//               {
//                    level=rs.getInt("level");
//                    str2="┠-";
//                    for(i=0;i<level;i++) {
//                         str2="&nbsp;&nbsp;"+str2;
//                    }
//                    if(rs.getInt("isleaf")==2) {
//                         if(rs.getInt("isactual")==2) {
//                              str=str+
//                                  "<option value=\""+
//                                  rs.getInt("typeid")+
//                                  "\">"+str2+
//                                  rs.getString("typename")+
//                                  "</option>";
//                         } else {
//                              str=str+
//                                  "<option value=\""+
//                                  "-1"+
//                                  "\">"+str2+
//                                  rs.getString("typename")+
//                                  "</option>";
//                         }
//                    } else {
//                         if(rs.getInt("isactual")==2) {
//                              str=str+
//                                  "<option value=\""+
//                                  "-2"+
//                                  "\">"+str2+
//                                  rs.getString("typename")+
//                                  "</option>";
//                         } else {
//                              str=str+
//                                  "<option value=\""+
//                                  "-3"+
//                                  "\">"+str2+
//                                  rs.getString("typename")+
//                                  "</option>";
//                         }
//                    }
//               }
//               stmt.close();
        }
        finally {
             if(stmt!=null) stmt.close();
        }
        return str;
   }
   public static String getChannelname(Connection con,int cpid,String mycorp) throws SQLException
   {
        PreparedStatement stmt=null;
        ResultSet rs=null;
        String sql="";
        String str="";
        String str2="";
        int i=0;
        int level=0;
        try {
             sql="select id,cp_name from tcp where corporationid in ("+mycorp+")";
             stmt=con.prepareStatement(sql);
             rs=stmt.executeQuery();
             str="<option value=\"0\">请选择</option>";

             while(rs.next())
             {

                  if(rs.getInt("id")==cpid){
                       str=str+
                           "<option selected value=\""+
                           rs.getInt("id")+
                           "\">"+str2+
                           rs.getString("cp_name")+
                           "</option>";
                  }else{
                       str=str+
                           "<option value=\""+
                           rs.getInt("id")+
                           "\">"+str2+
                           rs.getString("cp_name")+
                           "</option>";
                  }
             }
             stmt.close();
//               sql="select typeid,typename,parentid,isleaf,isactual,level from tsmstype where statusid=2 start with parentid=0 connect by prior typeid=parentid";
//               stmt=con.prepareStatement(sql);
//               rs=stmt.executeQuery();
//               str="<option value=\"0\">请选择</option>";
//
//               while(rs.next())
//               {
//                    level=rs.getInt("level");
//                    str2="┠-";
//                    for(i=0;i<level;i++) {
//                         str2="&nbsp;&nbsp;"+str2;
//                    }
//                    if(rs.getInt("typeid")==typeid){
//                         if(rs.getInt("isleaf")==2) {
//                              if(rs.getInt("isactual")==2) {
//                                   str=str+
//                                       "<option selected value=\""+
//                                       rs.getInt("typeid")+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              } else {
//                                   str=str+
//                                       "<option selected value=\""+
//                                       "-1"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              }
//                         } else {
//                              if(rs.getInt("isactual")==2) {
//                                   str=str+
//                                       "<option selected value=\""+
//                                       "-2"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              } else {
//                                   str=str+
//                                       "<option selected value=\""+
//                                       "-3"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              }
//                         }
//                    }else{
//                         if(rs.getInt("isleaf")==2) {
//                              if(rs.getInt("isactual")==2) {
//                                   str=str+
//                                       "<option value=\""+
//                                       rs.getInt("typeid")+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              } else {
//                                   str=str+
//                                       "<option value=\""+
//                                       "-1"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              }
//                         } else {
//                              if(rs.getInt("isactual")==2) {
//                                   str=str+
//                                       "<option value=\""+
//                                       "-2"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              } else {
//                                   str=str+
//                                       "<option value=\""+
//                                       "-3"+
//                                       "\">"+str2+
//                                       rs.getString("typename")+
//                                       "</option>";
//                              }
//                         }
//                    }
//               }
//               stmt.close();
        }
        finally {
             if(stmt!=null) stmt.close();
        }
        return str;
   }


     public static int delete(Connection con, String id[]) throws SQLException
     {
          PreparedStatement stmt=null;
          String sql="";
          int cnt=0;
          int i=0;
          try{
               sql="delete from tchannel where id in (";
               for (i=0;i<id.length;i++ ) {
                    if(i==0) sql=sql+id[i];
                    else sql=sql+","+id[i];
               }
               sql=sql+")";
               stmt = con.prepareStatement(sql);
               cnt=stmt.executeUpdate();
               stmt.close();
          }
          finally{
               if(stmt!=null) stmt.close();
          }
          return cnt;
     }
}

⌨️ 快捷键说明

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