-
Notifications
You must be signed in to change notification settings - Fork 0
/
Command.cs
182 lines (174 loc) · 4.74 KB
/
Command.cs
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Snow
{
public class Direction
{
string _field;
System.Data.ParameterDirection _direction;
/// <summary>
/// 存储过程的参数
/// </summary>
/// <param name="field">字段名</param>
/// <param name="direction">参数方向</param>
public Direction(string field, System.Data.ParameterDirection direction)
{
this._field = field;
this._direction = direction;
}
/// <summary>
/// 字段名
/// </summary>
public string field { set { _field = value; } get { return _field; } }
/// <summary>
/// 参数方向
/// </summary>
public System.Data.ParameterDirection direction { set { _direction = value; } get { return _direction; } }
}
public class Page
{
/// <summary>
/// 总记录数
/// </summary>
public long rowsCount { set; get; }
/// <summary>
/// 总页数
/// </summary>
public int pages { set; get; }
/// <summary>
/// 页码
/// </summary>
public int pageIndex { set; get; }
/// <summary>
/// 每页记录数
/// </summary>
public int pageSize { set; get; }
/// <summary>
/// 起始序号
/// </summary>
public int startIndex { set; get; }
/// <summary>
/// 终止序号
/// </summary>
public int endIndex { set; get; }
}
public class Result
{
int _status = 200;
/// <summary>
/// 返回成功与否
/// </summary>
public int status
{
set
{
_status = value;
}
get
{
return _status;
}
}
/// <summary>
/// 返回的消息
/// </summary>
public object data { set; get; }
}
/// <summary>
/// Sql Command
/// </summary>
class Command
{
public static string Insert = "insert";
public static string Update = "update";
public static string Delete = "delete";
public static string Select = "select";
}
class Sql
{
/// <summary>
/// 命令
/// </summary>
public string Command { set; get; }
/// <summary>
/// 表名
/// </summary>
public string TableName { set; get; }
/// <summary>
/// 返回的记录数
/// </summary>
public Int64 Top { set; get; }
/// <summary>
/// 包含的字段
/// </summary>
public List<string> Fields = new List<string>();
/// <summary>
/// 排除的字段
/// </summary>
public List<string> ExcludeFields = new List<string>();
/// <summary>
/// 查询主键
/// </summary>
public string Id { set; get; }
/// <summary>
/// 联结
/// </summary>
public List<string> Join = new List<string>();
/// <summary>
/// 查询条件
/// </summary>
public List<string> Where = new List<string>();
/// <summary>
/// 排序
/// </summary>
public List<string> OrderBy = new List<string>();
/// <summary>
/// 分组
/// </summary>
public string GroupBy = string.Empty;
/// <summary>
/// 分组筛选
/// </summary>
public string Having = string.Empty;
/// <summary>
/// 分页
/// </summary>
public Page Page = new Page();
/// <summary>
/// 是否主键查询
/// </summary>
public bool IsKey = false;
/// <summary>
/// 是否分页查询
/// </summary>
public bool IsPage = false;
/// <summary>
/// 是否原生查询
/// </summary>
public bool IsNative = false;
/// <summary>
/// 数据库操作命令字符串
/// </summary>
public List<string> SqlString = new List<string>();
/// <summary>
/// 查询参数
/// </summary>
public List<SqlParameter> Params = new List<SqlParameter>();
/// <summary>
/// 缓存键
/// </summary>
public List<string> CacheKey = new List<string>();
}
class StaticSql
{
public string command { set; get; }
public SqlParameter[] parameters { set; get; }
public PropertyInfo[] properties { set; get; }
}
}