• 待办消息查询sql



    select tsm.TMsgID,tsm.TMID,tsm.FNRID,tm.MainComID, tsm.TMsgName,fb.FBDataTbale, tsm.REMARK,fb.FlowType, tsm.CreateTime, fb.FBID,tsm.BranchID from TTransMessage as tsm
    left join TTransMain as tm on tsm.TMID = tm.TMID
    left join TFlowBase fb on tm.FBID = fb.FBID
    where tsm.TMsgState =0 and tsm.RecvUser = 1400


    exec sp_executesql N'SELECT [tm].[MainComID], [n].[TMsgID], [n].[TMID], [n].[FNRID], CONVERT(int, CONVERT(int, [tm].[MainComID])) AS [MainComID], [n].[TMsgName], [t1].[Item_no], [t1].[Contract_i_no], [t4].[CompanyName], [t5].[CustomerName], [t1].[Pro_name], [t1].[Pro_model], [t1].[Plat_number], [t6].[AreaName] AS [regionName], [t7].[AreaName], [n].[CreateTime], [t3].[FNStateName], [t1].[Contract_o_no], [t1].[Delivered_time], [n].[REMARK], [t1].[Project_name], CASE
    WHEN [n].[EWFlag] IS NULL
    THEN N'''' ELSE [n].[EWFlag]
    END AS [EWFlag], [t1].[rowguid] AS [OrderID], [t5].[CusClassifyName], [t].[FBDataTbale]
    FROM [TTransMessage] AS [n]
    LEFT JOIN [TTransMain] AS [tm] ON [n].[TMID] = [tm].[TMID]
    LEFT JOIN (
    SELECT [n0].*
    FROM [TFlowBase] AS [n0]
    WHERE ([n0].[DELETE_FLAG] <> 1) OR [n0].[DELETE_FLAG] IS NULL
    ) AS [t] ON [tm].[FBID] = [t].[FBID]
    LEFT JOIN (
    SELECT [n1].*
    FROM [SFSaleAfter] AS [n1]
    WHERE ([n1].[DELETE_FLAG] <> N''1'') OR [n1].[DELETE_FLAG] IS NULL
    ) AS [t0] ON CONVERT(int, [tm].[MainComID]) = [t0].[SaleAfterID]
    LEFT JOIN (
    SELECT [n2].*
    FROM [TOrders] AS [n2]
    WHERE ([n2].[DELETE_FLAG] <> N''1'') OR [n2].[DELETE_FLAG] IS NULL
    ) AS [t1] ON [t0].[TOrderID] = [t1].[rowguid]
    LEFT JOIN (
    SELECT [n3].*
    FROM [TFlowNodeRoperty] AS [n3]
    WHERE ([n3].[DELETE_FLAG] <> 1) OR [n3].[DELETE_FLAG] IS NULL
    ) AS [t2] ON [n].[FNRID] = [t2].[FNRID]
    LEFT JOIN (
    SELECT [n4].*
    FROM [TFlowNodes] AS [n4]
    WHERE ([n4].[DELETE_FLAG] <> 1) OR [n4].[DELETE_FLAG] IS NULL
    ) AS [t3] ON [t2].[FNID] = [t3].[FNID]
    LEFT JOIN (
    SELECT [n5].*
    FROM [TCompany] AS [n5]
    WHERE ([n5].[DELETE_FLAG] <> 1) OR [n5].[DELETE_FLAG] IS NULL
    ) AS [t4] ON [t1].[Produce_company] = [t4].[CompanyID]
    LEFT JOIN (
    SELECT [n6].*
    FROM [Customer] AS [n6]
    WHERE ([n6].[DELETE_FLAG] <> N''1'') OR [n6].[DELETE_FLAG] IS NULL
    ) AS [t5] ON [t1].[Custom_no] = [t5].[CustomerID]
    LEFT JOIN (
    SELECT [n7].*
    FROM [PubArea] AS [n7]
    WHERE ([n7].[DELETE_FLAG] <> N''1'') OR [n7].[DELETE_FLAG] IS NULL
    ) AS [t6] ON [t1].[Slice_no] = [t6].[AreaID]
    LEFT JOIN (
    SELECT [n8].*
    FROM [PubArea] AS [n8]
    WHERE ([n8].[DELETE_FLAG] <> N''1'') OR [n8].[DELETE_FLAG] IS NULL
    ) AS [t7] ON [t1].[Area_no] = [t7].[AreaID]
    WHERE ((([n].[DELETE_FLAG] <> N''1'') OR [n].[DELETE_FLAG] IS NULL) AND (([n].[TMsgState] = 0) AND ([n].[RecvUser] = @__UserInfo_ROWGUID_0))) AND ((([t1].[Order_type] = N''2'') OR ([t].[FBID] = 38)) AND ([t].[FBDataTbale] = N''SFSaleAfter''))',N'@__UserInfo_ROWGUID_0 int',@__UserInfo_ROWGUID_0=1400

  • 相关阅读:
    对模拟器虚假设备识别能力提升15%!每日清理大师App集成系统完整性检测
    教你实现华为快应用深色主题适配
    如何实现一个malloc
    如何提高团队管理能力?
    大型网站架构演变和知识体系
    call_user_func 和 call_user_func_array用法
    源码研究:php变量
    http协议简介
    用c语言实现http请求
    用socket写一个简单的客户端和服务端程序
  • 原文地址:https://www.cnblogs.com/jiangyunfeng/p/12066690.html
Copyright © 2020-2023  润新知