'新增PayBaseBakDB作为所有业务的查询,包括用车,高端用户,邮轮,套餐,高端旅游,主题旅游,钱包业务
'先通过CardInfoID在正式库和备份库的GatheringCreditCard表分二次找SubGatheringNo字段,再用逗号分隔拼接
'再通过SubGatheringNo在正式库和备份库中用之前的SQL(GatheringMain,GatheringSub,OrderType三表关联)查询即可
if ((cint(dbname) and 64) = 64 or (cint(dbname) and 128) = 128 or (cint(dbname) and 256) = 256 or (cint(dbname) and 512) = 512 or (cint(dbname) and 1024) = 1024 or (cint(dbname) and 2048) = 2048 or (cint(dbname) and 4096) = 4096 or (cint(dbname) and 8192) = 8192 or (cint(dbname) and 16384) = 16384) and sBusinessSearchType="Bak" then
dim SubGatheringNoString
Dim oDic,aItems,aKeys,count,i
count=0
Set oDic = Server.CreateObject("Scripting.Dictionary")
'主表
sql="select distinct gc.SubGatheringNo as SubGatheringNo from GatheringCreditCard(NOLOCK) gc where gc.cardinfoid in (" & cardinfoid & ")"
If session("eid") = "qil" or session("eid") = "shzhang" or session("eid") ="s25787" or session("eid")="s29925" Then
response.Write sql
end if
myrs.Source = sql
myrs.ActiveConnection = MyConnectionPayBase
myrs.Open
do while not myrs.EOF
SubGatheringNoString=SubGatheringNoString & myrs("SubGatheringNo") & ","
oDic.Add count,cstr(myrs("SubGatheringNo"))
count=count+1
myrs.MoveNext
loop
If Right(SubGatheringNoString, 1) = "," Then SubGatheringNoString = Mid(SubGatheringNoString, 1, Len(SubGatheringNoString) - 1) End if
myrs.Close
if SubGatheringNoString="" then
SubGatheringNoString="0"
end if
aKeys = oDic.Keys
aItems = oDic.Items
For i=0 To oDic.Count-1
sql = "select distinct (gm.OrderID) as orderid,gm.PaymentUid as uid, ot.OrderTypeName,gm.MerchantID as MerchantID,gm.OrderType as OrderType,convert(varchar,gm.CreateTime ,120) as createtime,gs.amount as amount,gm.PathType as PathType " &_
" FROM GatheringMain(NOLOCK) gm " &_
" inner JOIN GatheringSub(NOLOCK) gs ON gm.MainGatheringNo = gs.MainGatheringNo " &_
" left JOIN OrderType(NOLOCK) ot ON ot.OrderTypeID = gm.OrderType " &_
" where gs.SubGatheringNo in (" & aItems(i) & ")"
If session("eid") = "qil" or session("eid") = "shzhang" or session("eid") ="s25787" or session("eid")="s29925" Then
response.Write sql
end if
myrs.Source = sql
myrs.ActiveConnection = MyConnectionPayBaseBak
myrs.Open
do while not myrs.EOF
xml_ord = xml_ord & "<OrderItem>"
xml_ord = xml_ord & "<CardInfoID>" & aItems(i) & "</CardInfoID>"
xml_ord = xml_ord & "<OrderID>" & myrs("OrderId") & "</OrderID>"
xml_ord = xml_ord & "<UID>" & myrs("uid") & "</UID>"
xml_ord = xml_ord & "<OrderType>"& myrs("OrderType") &"</OrderType>"
xml_ord = xml_ord & "<OrderTypeName>"& myrs("OrderTypeName") &"</OrderTypeName>"
xml_ord = xml_ord & "<CreateTime>"& myrs("createtime") &"</CreateTime>"
xml_ord = xml_ord & "<Amount>"& myrs("amount") &"</Amount>"
xml_ord = xml_ord & "<PathType>"& myrs("pathtype") &"</PathType>"
xml_ord = xml_ord & "</OrderItem>"
myrs.MoveNext
loop
myrs.Close
Next
end if