yzh
2022-06-20 97aa542d1a1cdcb46b2942026d28b7e5dca6c6c0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using Common;
using Oracle.DataAccess.Client;
using System.Data.Common;
 
namespace Dao
{
    /// <summary>
    /// 数据库事件通知表操作
    /// </summary>
    public class GwEventLogDao : IDisposable
    {
        public void Dispose()
        {
        }
 
        private static GwEventLogDao _instance;
        public static GwEventLogDao Instance
        {
            get {
                if (_instance == null)
                {
                    _instance = new GwEventLogDao();
                }
                return _instance;
            }
        }
 
        //通道状态
        public List<Dictionary<string, object>> GetOpStatus(string permissionsSQL)
        {
            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
            StringBuilder builder = new StringBuilder();
            builder.Append(" SELECT GEL.*, GWO.OP_NAME FROM GW_EVENT_LOG GEL ");
            builder.Append(" LEFT JOIN GW_OP GWO ON GWO.OP_ID = GEL.OP_ID ");
            builder.Append(" WHERE 1=1 ");
            //builder.Append(" AND EVENT_TYPE = 'OPWARING' AND ASSIGNED_TO = 'WEB' ");
            builder.Append(permissionsSQL);
            builder.Append(" ORDER BY HANDLE_FLAG, HANDLE_TIME DESC ");
 
            using (OracleDataReader reader = OracleHelper.ExecuteReader(builder.ToString(), OracleHelper.Connection))
            {
                while (reader != null && ((DbDataReader)reader).Read())
                {
                    OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader);
                    int opId = oracleReaderWrapper.GetInt("OP_ID", 0); 
                    string opName = oracleReaderWrapper.GetString("OP_NAME", "");
                    int apId = oracleReaderWrapper.GetInt("AP_ID", 0);
                    string clientId = oracleReaderWrapper.GetString("CLIENT_ID", "");
                    string spId = oracleReaderWrapper.GetString("SP_ID", "");
                    DateTime eventTime = oracleReaderWrapper.GetDateTime("EVENT_TIME");
                    string eventType = oracleReaderWrapper.GetString("EVENT_TYPE", "");
                    string content = oracleReaderWrapper.GetString("CONTENT", "");
                    int handleFlag = oracleReaderWrapper.GetInt("HANDLE_FLAG", 0);
                    DateTime handleTime = oracleReaderWrapper.GetDateTime("HANDLE_TIME");
 
                    Dictionary<string, object> map = new Dictionary<string, object>();
                    map.Add("opId", opId); 
                    map.Add("opName", opName);
                    map.Add("apId", apId);
                    map.Add("clientId", clientId);
                    map.Add("spId", spId);
                    map.Add("eventTime", eventTime);
                    map.Add("eventType", eventType);
                    map.Add("content", content);
                    map.Add("handleFlag", handleFlag);
                    map.Add("handleTime", handleTime);
                    list.Add(map);
                }
            }
            return list;
        }
 
    }
 
}