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

📄 tpushimpl.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
          PreparedStatement stmt=null;
          String sql="";
          int cnt=0;
          try
          {
               sql="update tpush set frommdn=?,tomdn=?,title=?,url=?,status=?,result=?,channelid=?,systime=?,corporationid=? where id=?";
               stmt=con.prepareStatement(sql);
               stmt.setString(1, frommdn);
               stmt.setString(2, tomdn);
               stmt.setString(3, title);
               stmt.setString(4, url);
               stmt.setInt(5, status);
               stmt.setString(6, result);
               stmt.setString(7, channelid);
               stmt.setTimestamp(8, systime);
               stmt.setLong(9, corporationid);
               stmt.setInt(10, id);
               cnt=stmt.executeUpdate();
               stmt.close();
          }
          finally
          {
               if(stmt!=null) stmt=null;
          }
          return cnt;
     }
     /**
      * 删除一条数据
      */
     public static int delete(Connection con,int id) throws SQLException
     {
          PreparedStatement stmt=null;
          String sql="";
          int cnt=0;
          try{
               sql="delete from tpush where id=?";
               stmt=con.prepareStatement(sql);
               stmt.setInt(1,id);
               cnt=stmt.executeUpdate();
               stmt.close();
          }
          finally{
               if(stmt!=null) stmt.close();
          }
          return cnt;
     }
     /**
      * 删除多条数据
      */
     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 tpush 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;
     }
     public static String getChannelname(Connection con,long mycop) throws SQLException
{
     PreparedStatement stmt=null;
     ResultSet rs=null;
     String sql="";
     String str="";
     String str2="";
     int i=0;

     try {
          sql="select channelid,channel_name from tchannel where corporationid='"+mycop+"'";
          stmt=con.prepareStatement(sql);
          rs=stmt.executeQuery();
          str="<option value=\"0\">请选择</option>";

          while(rs.next())
          {

               str=str+
                   "<option value=\""+
                   rs.getString("channelid")+
                   "\">"+str2+
                   rs.getString("channel_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,String channelid) throws SQLException
{
     PreparedStatement stmt=null;
     ResultSet rs=null;
     String sql="";
     String str="";
     String str2="";
     int i=0;
     int level=0;
     try {
          sql="select channelid,channel_name from tchannel where corporationid in ("+channelid+")";
          stmt=con.prepareStatement(sql);
          rs=stmt.executeQuery();
          str="<option value=\"0\">请选择</option>";

          while(rs.next())
          {
/*
               if(rs.getString("channelid")==channelid){
                    str=str+
                        "<option selected value=\""+
                        rs.getInt("channelid")+
                        "\">"+str2+
                        rs.getString("channel_name")+
                        "</option>";
               }else{
                    str=str+
                        "<option value=\""+
                        rs.getInt("id")+
                        "\">"+str2+
                        rs.getString("channel_name")+
                        "</option>";
               }
 */
               str=str+
                     "<option value=\""+
                     rs.getInt("channelid")+
                     "\">"+str2+
                     rs.getString("channel_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;
}

}

⌨️ 快捷键说明

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