diff --git a/APIJSON.NET/APIJSON.Data/APIJSON.Data.csproj b/APIJSON.NET/APIJSON.Data/APIJSON.Data.csproj
new file mode 100644
index 0000000..8a515d4
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/APIJSON.Data.csproj
@@ -0,0 +1,31 @@
+
+
+
+ net8.0
+ 0.0.11
+
+ 0.0.11 升级sqlSugarCore版本 解决如果查找字段是关键字(例如:key)时出错的问题
+ 0.0.10 处理别名如果为关键字的缺陷
+ 0.0.8 清理SelectTable 支持重载
+ 0.0.7 修复not in的缺陷,增加~ 不等于的支持
+ 0.0.6 增加ToSql接口,处理sql注入的情况
+ 通用查询组件
+ ApiJson.Common.Core
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APIJSON.NET/APIJSON.Data/ApiJsonNetDataModule.cs b/APIJSON.NET/APIJSON.Data/ApiJsonNetDataModule.cs
new file mode 100644
index 0000000..8dbe0dc
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/ApiJsonNetDataModule.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp.Autofac;
+using Volo.Abp.Modularity;
+
+namespace APIJSON.Data;
+[DependsOn(
+ typeof(AbpAutofacModule))]
+public class ApiJsonNetDataModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+
+ }
+}
diff --git a/APIJSON.NET/APIJSON.Data/Data/DbContext.cs b/APIJSON.NET/APIJSON.Data/Data/DbContext.cs
new file mode 100644
index 0000000..1f2ab40
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Data/DbContext.cs
@@ -0,0 +1,41 @@
+using APIJSON.Data.Models;
+using Microsoft.Extensions.Configuration;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using Volo.Abp.DependencyInjection;
+namespace APIJSON.Data;
+
+public class DbContext:ISingletonDependency
+{
+ public DbContext(IConfiguration options)
+ {
+ Db = new SqlSugarClient(new ConnectionConfig()
+ {
+ ConnectionString = options.GetConnectionString("ConnectionString"),
+ DbType = (DbType)Enum.Parse(typeof(DbType), options.GetConnectionString("DbType")), InitKeyType= InitKeyType.Attribute,
+ IsAutoCloseConnection = true
+ });
+ Db.Aop.OnLogExecuted = (sql, pars) => //SQL执行完事件
+ {
+
+ };
+ Db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前事件
+ {
+
+ };
+ }
+ public SqlSugarClient Db;
+ public DbSet LoginDb { get { return new DbSet(Db); } }
+}
+public class DbSet : SimpleClient where T : class, new()
+{
+ public DbSet(SqlSugarClient context) : base(context)
+ {
+
+ }
+ public List GetByIds(dynamic[] ids)
+ {
+ return Context.Queryable().In(ids).ToList(); ;
+ }
+}
diff --git a/APIJSON.NET/APIJSON.Data/FuncList.cs b/APIJSON.NET/APIJSON.Data/FuncList.cs
new file mode 100644
index 0000000..7acc119
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/FuncList.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Linq;
+
+namespace APIJSON.Data;
+
+///
+/// 自定义方法
+///
+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/APIJSON.Data/Infrastructure/SimpleStringCipher.cs b/APIJSON.NET/APIJSON.Data/Infrastructure/SimpleStringCipher.cs
new file mode 100644
index 0000000..43b09bc
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Infrastructure/SimpleStringCipher.cs
@@ -0,0 +1,134 @@
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace APIJSON.Data;
+
+public class SimpleStringCipher
+{
+ public static SimpleStringCipher Instance { get; }
+
+ ///
+ /// This constant string is used as a "salt" value for the PasswordDeriveBytes function calls.
+ /// This size of the IV (in bytes) must = (keysize / 8). Default keysize is 256, so the IV must be
+ /// 32 bytes long. Using a 16 character string here gives us 32 bytes when converted to a byte array.
+ ///
+ public byte[] InitVectorBytes;
+
+ ///
+ /// Default password to encrypt/decrypt texts.
+ /// It's recommented to set to another value for security.
+ /// Default value: "gsKnGZ041HLL4IM8"
+ ///
+ public static string DefaultPassPhrase { get; set; }
+
+ ///
+ /// Default value: Encoding.ASCII.GetBytes("jkE49230Tf093b42")
+ ///
+ public static byte[] DefaultInitVectorBytes { get; set; }
+
+ ///
+ /// Default value: Encoding.ASCII.GetBytes("hgt!16kl")
+ ///
+ public static byte[] DefaultSalt { get; set; }
+
+ ///
+ /// This constant is used to determine the keysize of the encryption algorithm.
+ ///
+ public const int Keysize = 256;
+
+ static SimpleStringCipher()
+ {
+ DefaultPassPhrase = "gsKnGZ041HLL4IM9";
+ DefaultInitVectorBytes = Encoding.ASCII.GetBytes("jkE49230Tf093b42");
+ DefaultSalt = Encoding.ASCII.GetBytes("hgt!11kl");
+ Instance = new SimpleStringCipher();
+ }
+
+ public SimpleStringCipher()
+ {
+ InitVectorBytes = DefaultInitVectorBytes;
+ }
+
+ public string Encrypt(string plainText, string passPhrase = null, byte[] salt = null)
+ {
+ if (plainText == null)
+ {
+ return null;
+ }
+
+ if (passPhrase == null)
+ {
+ passPhrase = DefaultPassPhrase;
+ }
+
+ if (salt == null)
+ {
+ salt = DefaultSalt;
+ }
+
+ var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
+ using (var password = new Rfc2898DeriveBytes(passPhrase, salt))
+ {
+ var keyBytes = password.GetBytes(Keysize / 8);
+ using (var symmetricKey = Aes.Create())
+ {
+ symmetricKey.Mode = CipherMode.CBC;
+ using (var encryptor = symmetricKey.CreateEncryptor(keyBytes, InitVectorBytes))
+ {
+ using (var memoryStream = new MemoryStream())
+ {
+ using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
+ {
+ cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
+ cryptoStream.FlushFinalBlock();
+ var cipherTextBytes = memoryStream.ToArray();
+ return Convert.ToBase64String(cipherTextBytes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public string Decrypt(string cipherText, string passPhrase = null, byte[] salt = null)
+ {
+ if (string.IsNullOrEmpty(cipherText))
+ {
+ return null;
+ }
+
+ if (passPhrase == null)
+ {
+ passPhrase = DefaultPassPhrase;
+ }
+
+ if (salt == null)
+ {
+ salt = DefaultSalt;
+ }
+
+ var cipherTextBytes = Convert.FromBase64String(cipherText);
+ using (var password = new Rfc2898DeriveBytes(passPhrase, salt))
+ {
+ var keyBytes = password.GetBytes(Keysize / 8);
+ using (var symmetricKey = Aes.Create())
+ {
+ symmetricKey.Mode = CipherMode.CBC;
+ using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, InitVectorBytes))
+ {
+ using (var memoryStream = new MemoryStream(cipherTextBytes))
+ {
+ using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
+ {
+ var plainTextBytes = new byte[cipherTextBytes.Length];
+ var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
+ return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/APIJSON.NET/APIJSON.Data/Infrastructure/StringExtensions.cs b/APIJSON.NET/APIJSON.Data/Infrastructure/StringExtensions.cs
new file mode 100644
index 0000000..240b92b
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Infrastructure/StringExtensions.cs
@@ -0,0 +1,28 @@
+namespace APIJSON.Data;
+
+using System;
+using System.Text.RegularExpressions;
+public static class StringExtensions
+{
+
+ ///
+ /// 是否有值
+ ///
+ ///
+ ///
+ 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);
+ }
+
+}
\ No newline at end of file
diff --git a/APIJSON.NET/APIJSON.Data/Models/DbOptions.cs b/APIJSON.NET/APIJSON.Data/Models/DbOptions.cs
new file mode 100644
index 0000000..c33da47
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Models/DbOptions.cs
@@ -0,0 +1,15 @@
+namespace APIJSON.Data;
+
+using global::SqlSugar;
+public class DbOptions
+{
+ ///
+ ///
+ ///
+ public DbType DbType { get; set; }
+
+ ///
+ ///
+ ///
+ public string ConnectionString { get; set; }
+}
diff --git a/APIJSON.NET/APIJSON.Data/Models/Login.cs b/APIJSON.NET/APIJSON.Data/Models/Login.cs
new file mode 100644
index 0000000..0dcdf11
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Models/Login.cs
@@ -0,0 +1,19 @@
+using SqlSugar;
+using System;
+
+namespace APIJSON.Data.Models;
+
+public class Login
+{
+ [SugarColumn(IsNullable = false, IsPrimaryKey = true)]
+ public int userId { get; set; }
+ [SugarColumn(Length = 100, ColumnDescription = "用户名")]
+ public string userName { get; set; }
+ [SugarColumn(Length = 200, ColumnDescription = "密码")]
+ public string passWord { get; set; }
+ [SugarColumn(Length = 100, ColumnDescription = "密码盐")]
+ public string passWordSalt { get; set; }
+ [SugarColumn(Length = 100, ColumnDescription = "权限组")]
+ public string roleCode { get; set; }
+
+}
diff --git a/APIJSON.NET/APIJSON.Data/Models/RoleItem.cs b/APIJSON.NET/APIJSON.Data/Models/RoleItem.cs
new file mode 100644
index 0000000..ba16bc6
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Models/RoleItem.cs
@@ -0,0 +1,18 @@
+namespace APIJSON.Data.Models;
+
+public class RoleItem
+{
+ public string[] Table { get; set; }
+ public string[] Column { get; set; }
+ public string[] Filter { get; set; }
+}
+public class Role
+{
+ public string Name { get; set; }
+ public RoleItem Select { get; set; }
+ public RoleItem Update { get; set; }
+ public RoleItem Insert { get; set; }
+ public RoleItem Delete { get; set; }
+
+}
+
diff --git a/APIJSON.NET/APIJSON.Data/Properties/AssemblyInfo.cs b/APIJSON.NET/APIJSON.Data/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7b4ef0d
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ApiJson.Common")]
+[assembly: AssemblyDescription("0.0.19 处理别名如果为关键字的缺陷")]
+[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.10.0")]
+[assembly: AssemblyFileVersion("0.0.10.0")]
diff --git a/APIJSON.NET/APIJSON.Data/SelectTable.cs b/APIJSON.NET/APIJSON.Data/SelectTable.cs
new file mode 100644
index 0000000..8aa9e2d
--- /dev/null
+++ b/APIJSON.NET/APIJSON.Data/SelectTable.cs
@@ -0,0 +1,832 @@
+namespace APIJSON.Data;
+
+using AspectCore.Extensions.Reflection;
+using global::SqlSugar;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq;
+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;
+ _tableMapper = tableMapper;
+ db = dbClient;
+ }
+ ///
+ /// 判断表名是否正确
+ ///
+ ///
+ ///
+ public virtual bool IsTable(string table)
+ {
+ return db.DbMaintenance.GetTableInfoList().Any(it => it.Name.Equals(table, StringComparison.CurrentCultureIgnoreCase));
+ }
+ ///
+ /// 判断表的列名是否正确
+ ///
+ ///
+ ///
+ ///
+ public virtual bool IsCol(string table, string col)
+ {
+ return db.DbMaintenance.GetColumnInfosByTableName(table).Any(it => it.DbColumnName.Equals(col, StringComparison.CurrentCultureIgnoreCase));
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual Tuple GetTableData(string subtable, int page, int count, int query, string json, JObject dd)
+ {
+
+ var role = _identitySvc.GetSelectRole(subtable);
+ if (!role.Item1)//没有权限返回异常
+ {
+ throw new Exception(role.Item2);
+ }
+ 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 (query == 1)//1-总数
+ return new Tuple(new List
-
+
-
+
+
@@ -29,7 +31,7 @@
English
通用文档
视频教程
- 在线工具
+ 在线工具
@@ -39,7 +41,7 @@
---
-APIJSON是一种为API而生的JSON网络传输协议。
+APIJSON是一种专为API而生的 JSON网络传输协议 以及 基于这套协议实现的ORM库。
为 简单的增删改查、复杂的查询、简单的事务操作 提供了完全自动化的API。
能大幅降低开发和沟通成本,简化开发流程,缩短开发周期。
适合中小型前后端分离的项目,尤其是互联网创业项目和企业自用项目。
@@ -57,10 +59,10 @@ APIJSON是一种为API而生的JSON网络传输协议。
#### 在线解析
* 自动生成接口文档,清晰可读永远最新
-* 自动生成请求代码,支持Android和iOS
-* 自动生成JavaBean文件,一键下载
+* 自动校验与格式化,支持高亮和收展
+* 自动生成各种语言代码,一键下载
* 自动管理与测试接口用例,一键共享
-* 自动校验与格式化JSON,支持高亮和收展
+* 自动给请求JSON加注释,一键切换
#### 对于前端
* 不用再向后端催接口、求文档
@@ -108,7 +110,7 @@ APIJSON是一种为API而生的JSON网络传输协议。
### 为什么要用APIJSON?
-[前后端10大痛点解析](https://github.com/TommyLemon/APIJSON/wiki)
+[前后端 关于接口的 沟通、文档、联调 等 10 大痛点解析](https://github.com/TommyLemon/APIJSON/wiki)
### 快速上手
https://github.com/liaozb/APIJSON.NET/tree/master/APIJSON.NET
@@ -121,6 +123,22 @@ https://github.com/liaozb/APIJSON.NET/tree/master/APIJSON.NET
测试及自动生成代码工具
[APIJSONTest.apk](http://files.cnblogs.com/files/tommylemon/APIJSONTest.apk)
+### 使用登记
+
+
+
+[您在使用APIJSON吗?](https://github.com/TommyLemon/APIJSON/issues/73)
+
### 技术交流
如果有什么问题或建议可以 [提ISSUE](https://github.com/liaozb/APIJSON.NET/issues) 或 [加群](https://github.com/TommyLemon/APIJSON#%E6%8A%80%E6%9C%AF%E4%BA%A4%E6%B5%81),交流技术,分享经验。
@@ -129,12 +147,15 @@ https://github.com/liaozb/APIJSON.NET/tree/master/APIJSON.NET
### 贡献者们
感谢大家的贡献。
+
### 相关推荐
[APIJSON, 让接口和文档见鬼去吧!](https://my.oschina.net/tommylemon/blog/805459)
@@ -146,16 +167,40 @@ https://github.com/liaozb/APIJSON.NET/tree/master/APIJSON.NET
[3步创建APIJSON后端新表及配置](https://my.oschina.net/tommylemon/blog/889074)
+[APIJSON 自动化接口和文档的快速开发神器 (一)](https://blog.csdn.net/qq_41829492/article/details/88670940)
+
+### 生态项目
+[APIAuto](https://github.com/TommyLemon/APIAuto) 自动化接口管理工具,自动生成文档与注释、自动生成代码、自动化回归测试、自动静态检查等
+
+[apijson-doc](https://github.com/vincentCheng/apijson-doc) APIJSON 官方文档,提供排版清晰、搜索方便的文档内容展示,包括设计规范、图文教程等
-### 其它项目
-[APIJSON](https://github.com/TommyLemon/APIJSON) 码云最有价值项目:后端接口和文档自动化,前端(客户端) 定制返回JSON的数据和结构
+[apijson.org](https://github.com/APIJSON/apijson.org) APIJSON 官方网站,提供 APIJSON 的 功能简介、登记用户、作者与贡献者、相关链接 等
-[APIJSONAuto](https://github.com/TommyLemon/APIJSONAuto) 自动化接口管理工具,自动生成文档与注释、自动生成代码、自动化回归测试、自动静态检查等
+[APIJSON](https://github.com/APIJSON/APIJSON) Java 版 APIJSON ,支持 MySQL, PostgreSQL, Oracle, TiDB
+
+[apijson-php](https://github.com/qq547057827/apijson-php) PHP 版 APIJSON,基于 ThinkPHP,支持 MySQL, PostgreSQL, MS SQL Server, Oracle 等
+
+[apijson](https://github.com/TEsTsLA/apijson) Node.ts 版 APIJSON,支持 MySQL, PostgreSQL, MS SQL Server, Oracle, SQLite, MariaDB, WebSQL
+
+[uliweb-apijson](https://github.com/zhangchunlin/uliweb-apijson) Python 版 APIJSON,支持 MySQL, PostgreSQL, MS SQL Server, Oracle, SQLite 等
+
+[APIJSON](https://github.com/crazytaxi824/APIJSON) Go 版 APIJSON,功能开发中...
+
+[APIJSONKOTLIN](https://github.com/luckyxiaomo/APIJSONKOTLIN) Kotlin 版 APIJSON,基础框架搭建中...
+
+[APIJSONParser](https://github.com/Zerounary/APIJSONParser) 第三方 APIJSON 解析器,将 JSON 动态解析成 SQL
+
+[ApiJsonByJFinal](https://gitee.com/zhiyuexin/ApiJsonByJFinal) 整合 APIJSON 和 JFinal 的 Demo
+
+[SpringServer1.2-APIJSON](https://github.com/Airforce-1/SpringServer1.2-APIJSON) 智慧党建服务器端,提供 上传 和 下载 文件的接口
+
+[AbsGrade](https://github.com/APIJSON/AbsGrade) 抽象列表分级工具,支持微信朋友圈单层评论、QQ空间双层评论、百度网盘多层(无限层)文件夹等
[APIJSON-Android-RxJava](https://github.com/TommyLemon/APIJSON-Android-RxJava) 仿微信朋友圈动态实战项目,ZBLibrary(UI) + APIJSON(HTTP) + RxJava(Data)
[Android-ZBLibrary](https://github.com/TommyLemon/Android-ZBLibrary) Android MVP快速开发框架,Demo全面,注释详细,使用简单,代码严谨
+
感谢热心的作者们的贡献,点 ⭐Star 支持下他们吧。
### 持续更新
@@ -166,3 +211,4 @@ https://gitee.com/liaozb/APIJSON.NET
### 我要赞赏
如果你喜欢 APIJSON.NET,感觉它帮助到了你,可以点右上角 ⭐Star 支持一下,谢谢 ^_^
+