diff --git a/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj b/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj
index 982e808..66d75af 100644
--- a/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj
+++ b/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj
@@ -2,6 +2,8 @@
netstandard2.0
+ 0.0.1
+ 通用查询组件
diff --git a/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.csproj b/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.csproj
new file mode 100644
index 0000000..ef2a11b
--- /dev/null
+++ b/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.csproj
@@ -0,0 +1,97 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {DC07586E-7241-4BB5-9200-CE57A81C5E27}
+ Library
+ Properties
+ APIJSON.NET
+ ApiJson.Common
+ v4.6.1
+ 512
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+ packages\AspectCore.Extensions.Reflection.1.2.0\lib\net45\AspectCore.Extensions.Reflection.dll
+
+
+
+ packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
+
+
+ packages\Microsoft.Extensions.Options.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Options.dll
+
+
+ packages\Microsoft.Extensions.Primitives.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll
+
+
+ packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
+
+
+ packages\sqlSugar.4.9.9.10\lib\SqlSugar.dll
+
+
+
+ packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
+
+
+ packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll
+
+
+
+
+ packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll
+
+
+
+ packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ packages\System.Runtime.CompilerServices.Unsafe.4.5.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.sln b/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.sln
new file mode 100644
index 0000000..9689606
--- /dev/null
+++ b/APIJSON.NET/APIJSONCommon/ApiJson.Common_461.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.202
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiJson.Common_461", "ApiJson.Common_461.csproj", "{DC07586E-7241-4BB5-9200-CE57A81C5E27}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIJSON.NET.Test", "..\APIJSON.NET.Test\APIJSON.NET.Test.csproj", "{3F99B6A8-3A58-4714-A0FF-186BE2874A68}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DC07586E-7241-4BB5-9200-CE57A81C5E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DC07586E-7241-4BB5-9200-CE57A81C5E27}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DC07586E-7241-4BB5-9200-CE57A81C5E27}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DC07586E-7241-4BB5-9200-CE57A81C5E27}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3F99B6A8-3A58-4714-A0FF-186BE2874A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3F99B6A8-3A58-4714-A0FF-186BE2874A68}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3F99B6A8-3A58-4714-A0FF-186BE2874A68}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3F99B6A8-3A58-4714-A0FF-186BE2874A68}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {53F36702-3FD9-4AF5-A4C3-E3C30C943492}
+ EndGlobalSection
+EndGlobal
diff --git a/APIJSON.NET/APIJSONCommon/FuncList.cs b/APIJSON.NET/APIJSONCommon/FuncList.cs
index 59d5a45..a92f653 100644
--- a/APIJSON.NET/APIJSONCommon/FuncList.cs
+++ b/APIJSON.NET/APIJSONCommon/FuncList.cs
@@ -8,14 +8,34 @@ namespace APIJSON.NET
///
public class FuncList
{
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public string Merge(object a, object b)
{
return a.ToString() + b.ToString();
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public object MergeObj(object a, object b)
{
return new { a, b };
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public bool isContain(object a, object b)
{
return a.ToString().Split(',').Contains(b);
diff --git a/APIJSON.NET/APIJSONCommon/Infrastructure/StringExtensions.cs b/APIJSON.NET/APIJSONCommon/Infrastructure/StringExtensions.cs
index ee7d149..e806081 100644
--- a/APIJSON.NET/APIJSONCommon/Infrastructure/StringExtensions.cs
+++ b/APIJSON.NET/APIJSONCommon/Infrastructure/StringExtensions.cs
@@ -14,6 +14,12 @@ public static bool IsValue(this object str)
{
return str != null && !string.IsNullOrEmpty(str.ToString());
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
public static string GetParamName(this string param)
{
return param + new Random().Next(1, 100);
diff --git a/APIJSON.NET/APIJSONCommon/Models/DbOptions.cs b/APIJSON.NET/APIJSONCommon/Models/DbOptions.cs
index 0fe7840..8d4c3a3 100644
--- a/APIJSON.NET/APIJSONCommon/Models/DbOptions.cs
+++ b/APIJSON.NET/APIJSONCommon/Models/DbOptions.cs
@@ -3,7 +3,14 @@
using SqlSugar;
public class DbOptions
{
+ ///
+ ///
+ ///
public DbType DbType { get; set; }
+
+ ///
+ ///
+ ///
public string ConnectionString { get; set; }
}
}
diff --git a/APIJSON.NET/APIJSONCommon/Properties/AssemblyInfo.cs b/APIJSON.NET/APIJSONCommon/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..b890e44
--- /dev/null
+++ b/APIJSON.NET/APIJSONCommon/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ApiJson.Common")]
+[assembly: AssemblyDescription("单表查询的返回节点指定为Infos")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ApiJson.Common")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("dc07586e-7241-4bb5-9200-ce57a81c5e27")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.0.4.0")]
+[assembly: AssemblyFileVersion("0.0.4.0")]
diff --git a/APIJSON.NET/APIJSONCommon/SelectTable.cs b/APIJSON.NET/APIJSONCommon/SelectTable.cs
index 502e687..4e76118 100644
--- a/APIJSON.NET/APIJSONCommon/SelectTable.cs
+++ b/APIJSON.NET/APIJSONCommon/SelectTable.cs
@@ -1,22 +1,30 @@
namespace APIJSON.NET
{
using APIJSON.NET.Services;
- using Microsoft.Extensions.Options;
+ using AspectCore.Extensions.Reflection;
using Newtonsoft.Json.Linq;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
- using AspectCore.Extensions.Reflection;
using System.Text.RegularExpressions;
+ ///
+ ///
+ ///
public class SelectTable
{
private readonly IIdentityService _identitySvc;
private readonly ITableMapper _tableMapper;
private readonly SqlSugarClient db;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public SelectTable(IIdentityService identityService, ITableMapper tableMapper, SqlSugarClient dbClient)
{
_identitySvc = identityService;
@@ -49,18 +57,27 @@ public bool IsCol(string table, string col)
///
///
///
- public object ExecFunc(string funcname,object[] param, Type[] types)
+ public object ExecFunc(string funcname, object[] param, Type[] types)
{
var method = typeof(FuncList).GetMethod(funcname);
-
+
var reflector = method.GetReflector();
var result = reflector.Invoke(new FuncList(), param);
return result;
}
- public (dynamic,int) GetTableData(string subtable, int page, int count, string json, JObject dd)
- {
-
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Tuple GetTableData(string subtable, int page, int count, int query, string json, JObject dd)
+ {
+
var role = _identitySvc.GetSelectRole(subtable);
if (!role.Item1)//没有权限返回异常
{
@@ -68,26 +85,48 @@ public object ExecFunc(string funcname,object[] param, Type[] types)
}
string selectrole = role.Item2;
subtable = _tableMapper.GetTableName(subtable);
-
+
JObject values = JObject.Parse(json);
page = values["page"] == null ? page : int.Parse(values["page"].ToString());
count = values["count"] == null ? count : int.Parse(values["count"].ToString());
+ query = values["query"] == null ? query : int.Parse(values["query"].ToString());
values.Remove("page");
values.Remove("count");
var tb = sugarQueryable(subtable, selectrole, values, dd);
- if (count > 0)
- {
- int total = 0;
- return (tb.ToPageList(page, count,ref total),total);
- }
+ if (query == 1)//1-总数
+ return new Tuple(new List