以下是引用片段:
Private Function GetSqlStr(iChannelID, arrClassID, IncludeChild, iSpecialID, IsHot, IsElite, Author, DateNum, OrderType, ShowClassName, IsPicUrl) Dim strSql, IDOrder iSpecialID = PE_CLng(iSpecialID) If iSpecialID > 0 Then strSql = strSql & \" from PE_InfoS I inner join (PE_Article A left join PE_Class C on A.ClassID=C.ClassID) on I.ItemID=A.ArticleID\" Else strSql = strSql & \" from PE_Article A left join PE_Class C on A.ClassID=C.ClassID\" End If strSql = strSql & \" where A.Deleted=\" & PE_False & \" and A.Status=3 and A.ReceiveType=0\" If iChannelID > 0 Then strSql = strSql & \" and A.ChannelID=\" & iChannelID End If If arrClassID <> \"0\" Then If InStr(arrClassID, \",\") = 0 And IncludeChild = True Then Dim trs Set trs = Conn.Execute(\"select arrChildID from PE_Class where ClassID=\" & PE_CLng(arrClassID) & \"\") If trs.BOF And trs.EOF Then arrClassID = \"0\" Else If IsNull(trs(0)) Or Trim(trs(0)) = \"\" Then arrClassID = \"0\" Else arrClassID = trs(0) End If End If Set trs = Nothing End If If InStr(arrClassID, \",\") > 0 Then strSql = strSql & \" and A.ClassID in (\" & FilterArrNull(arrClassID, \",\") & \")\" Else If PE_CLng(arrClassID) > 0 Then strSql = strSql & \" and A.ClassID=\" & PE_CLng(arrClassID) End If End If If iSpecialID > 0 Then strSql = strSql & \" and I.ModuleType=1 and I.SpecialID=\" & iSpecialID End If If IsHot = True Then strSql = strSql & \" and A.Hits>=\" & HitsOfHot End If If IsElite = True Then strSql = strSql & \" and A.Elite=\" & PE_True End If If Trim(Author) <> \"\" Then strSql = strSql & \" and A.Author='\" & Author & \"'\" End If If DateNum > 0 Then strSql = strSql & \" and DateDiff(\" & PE_DatePart_D & \",A.UpdateTime,\" & PE_Now & \")<\" & DateNum End If
If IsPicUrl = True Then strSql = strSql & \" and A.DefaultPicUrl<>'' \" End If
strSql = strSql & \" order by \" Select Case OrderType Case 1 strSql = strSql & \"A.OnTop \" & PE_OrderType & \",\" Case 2 strSql = strSql & \"\" Case 3 strSql = strSql & \"A.UpdateTime desc,\" Case 4 strSql = strSql & \"A.UpdateTime asc,\" Case 5 strSql = strSql & \"A.Hits desc,\" Case 6 strSql = strSql & \"A.Hits asc,\" Case 7 strSql = strSql & \"A.CommentCount desc,\" Case 8 strSql = strSql & \"A.CommentCount asc,\" Case Else strSql = strSql & \"A.OnTop \" & PE_OrderType & \",\" End Select If OrderType = 2 Then IDOrder = \"asc\" Else IDOrder = \"desc\" End If If iSpecialID > 0 Then strSql = strSql & \"I.InfoID \" & IDOrder Else strSql = strSql & \"A.ArticleID \" & IDOrder End If GetSqlStr = strSql End Function
相关动易CMS教程:
最新评论:
发表评论:不能超过250字节,请自觉遵守互联网相关政策法规.
|