From 0e70896fa45edb4e6ac3a0bc3386af8cc03e4d52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 6 Dec 2021 12:54:53 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/System/ArticleController.cs | 2 +-
.../Extensions/SwaggerExtension.cs | 15 +-
ZR.Admin.WebApi/Startup.cs | 19 +-
ZR.Admin.WebApi/ZRAdmin.xml | 254 ++++++++----------
ZR.Admin.WebApi/appsettings.json | 2 +-
.../CodeGenTemplate/TplControllers.txt | 32 ++-
.../wwwroot/CodeGenTemplate/TplVue.txt | 2 +-
ZR.Vue/src/views/tool/gen/genInfoForm.vue | 2 +-
8 files changed, 150 insertions(+), 178 deletions(-)
diff --git a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
index 6c993d3..c6f9ce9 100644
--- a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
@@ -16,7 +16,7 @@ using System;
namespace ZR.Admin.WebApi.Controllers
{
///
- /// T4代码自动生成
+ /// 文章管理
///
[Verify]
[Route("article")]
diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs
index 40f9d49..31042e7 100644
--- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs
+++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs
@@ -27,11 +27,16 @@ namespace ZR.Admin.WebApi.Extensions
Version = "v1",
Description = "",
});
- //if (CurrentEnvironment.IsDevelopment())
- //{
- //添加文档注释
- c.IncludeXmlComments(Path.Combine(hostEnvironment.ContentRootPath, "ZRAdmin.xml"), true);
- //}
+ try
+ {
+ //添加文档注释
+ c.IncludeXmlComments(Path.Combine(hostEnvironment.ContentRootPath, "ZRAdmin.xml"), true);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("swagger 文档加载失败" + ex.Message);
+ }
+
//参考文章:http://www.zyiz.net/tech/detail-134965.html
//需要安装包Swashbuckle.AspNetCore.Filters
// 开启权限小锁 需要在对应的Action上添加[Authorize]才能看到
diff --git a/ZR.Admin.WebApi/Startup.cs b/ZR.Admin.WebApi/Startup.cs
index 7e334ba..e8b4b86 100644
--- a/ZR.Admin.WebApi/Startup.cs
+++ b/ZR.Admin.WebApi/Startup.cs
@@ -32,7 +32,7 @@ namespace ZR.Admin.WebApi
Configuration = configuration;
CurrentEnvironment = hostEnvironment;
}
-
+ private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private IWebHostEnvironment CurrentEnvironment { get; }
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
@@ -167,13 +167,14 @@ namespace ZR.Admin.WebApi
});
//ʽ ӡSQL
- DbScoped.SugarScope.GetConnection("0").Aop.OnLogExecuting = (sql, pars) =>
+ DbScoped.SugarScope.GetConnection(0).Aop.OnLogExecuting = (sql, pars) =>
{
- Console.WriteLine("SQL䡿" + sql.ToLower() + "\r\n"
- + DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
+ var param = DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
+ //Console.WriteLine("SQL䡿" + sql.ToLower() + "\r\n" + param);
+ logger.Info($"Sql䣺{sql}{param}");
};
//ӡ־
- DbScoped.SugarScope.GetConnection("0").Aop.OnError = (e) =>
+ DbScoped.SugarScope.GetConnection(0).Aop.OnError = (e) =>
{
Console.WriteLine($"[ִSql]{e.Message}SQL={e.Sql}");
Console.WriteLine();
@@ -182,14 +183,14 @@ namespace ZR.Admin.WebApi
//ʽ ӡSQL
DbScoped.SugarScope.GetConnection(1).Aop.OnLogExecuting = (sql, pars) =>
{
- Console.WriteLine("SQLBus" + sql.ToLower() + "\r\n"
- + DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
+ var param = DbScoped.SugarScope.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
+ //Console.WriteLine("SQLBus" + sql.ToLower() + "\r\n" + param);
+ logger.Info($"Sql䣺{sql}, {param}");
};
//Bus Db־
DbScoped.SugarScope.GetConnection(1).Aop.OnError = (e) =>
{
- Console.WriteLine($"[ִSqlBus]{e.Message}SQL={e.Sql}");
- Console.WriteLine();
+ logger.Error($"ִSqlʧܣ{e.Sql}ԭ{e.Message}");
};
}
}
diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml
index a7cb591..30d4241 100644
--- a/ZR.Admin.WebApi/ZRAdmin.xml
+++ b/ZR.Admin.WebApi/ZRAdmin.xml
@@ -36,148 +36,38 @@
-
-
- 代码生成演示Controller
-
- @author zr
- @date 2021-11-24
-
-
-
+
- 代码生成演示接口
+ 公共模块
-
-
- 查询代码生成演示列表
-
-
-
-
-
- 查询代码生成演示详情
-
-
-
-
-
-
- 添加代码生成演示
-
-
-
-
-
- 更新代码生成演示
-
-
-
-
-
- 删除代码生成演示
-
-
-
-
-
- 代码生成
-
-
-
-
- 获取所有数据库的信息
-
-
-
-
-
- 获取所有表根据数据名
-
- 数据库名
- 表名
- 分页信息
-
-
-
-
- 代码生成器
-
- 数据传输对象
-
-
-
-
- 获取代码生成表列表
-
- 表名
- 分页信息
-
-
-
-
- 查询表字段列表
-
- genTable表id
-
-
-
-
- 删除代码生成
-
-
-
-
-
-
- 导入表结构(保存)
-
-
-
-
-
-
-
- 修改保存代码生成业务
-
- 请求参数实体
-
-
-
-
- 预览代码
-
-
-
-
-
+
心跳
-
-
- 加密
-
-
-
-
-
-
- 解密
-
-
-
-
-
+
发送邮件
请求参数接收实体
+
+
+ 存储文件
+
+
+
+
+
+
+ 存储文件到阿里云
+
+
+
+
T4代码自动生成
@@ -231,6 +121,77 @@
+
+
+ 代码生成
+
+
+
+
+ 获取所有数据库的信息
+
+
+
+
+
+ 获取所有表根据数据名
+
+ 数据库名
+ 表名
+ 分页信息
+
+
+
+
+ 获取代码生成表列表
+
+ 表名
+ 分页信息
+
+
+
+
+ 查询表字段列表
+
+ genTable表id
+
+
+
+
+ 删除代码生成
+
+
+
+
+
+
+ 导入表结构(保存)
+
+
+
+
+
+
+
+ 修改保存代码生成业务
+
+ 请求参数实体
+
+
+
+
+ 预览代码
+
+
+
+
+
+
+ 生成代码(下载方式)
+
+ 数据传输对象
+
+
获取缓存监控数据
@@ -663,6 +624,7 @@
修改头像
+
@@ -894,13 +856,6 @@
-
-
- 存储文件
-
-
-
-
HttpContext扩展类
@@ -920,6 +875,13 @@
+
+
+ ClaimsIdentity
+
+
+
+
获取请求令牌
@@ -927,13 +889,13 @@
-
-
- 登录cookie写入
-
-
-
-
+
+
+ 组装Claims
+
+
+
+
@@ -1036,6 +998,12 @@
+
+
+ 验证Token
+
+
+
从令牌中获取数据声明
@@ -1051,7 +1019,7 @@
-
+
注册Services服务
diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json
index b8dcce0..bd00d8f 100644
--- a/ZR.Admin.WebApi/appsettings.json
+++ b/ZR.Admin.WebApi/appsettings.json
@@ -15,7 +15,7 @@
"urls": "http://localhost:8888", //Ŀurl
"sysConfig": {
"DBCommandTimeout": 10,
- "cors": "http://localhost:8887" //ַ","
+ "cors": "http://localhost:8887" //ַǰĿ","
},
"JwtSettings": {
"Issuer": "https://localhost:8888",
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index 8d53e48..a5ffedf 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -160,25 +160,23 @@ ${end}
string sFileName = ExportExcel(list, "${replaceDto.ModelTypeName}", "${genTable.FunctionName}");
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
}
-
$if(genTable.SortField != "")
- ///
- /// 保存排序
- ///
- ///
- ///
- ///
- [ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")]
- [HttpGet("ChangeSort")]
- [Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
- public IActionResult ChangeSort(int id = 0, int orderNum = 0)
- {
- if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
-
- bool result = _${replaceDto.ModelTypeName}Service.Update(w => w.${replaceDto.PKName} == id, it => new ${replaceDto.ModelTypeName}() { ${genTable.SortField} = orderNum });;
+ //////
+ ////// 代码自动生成(不用可删除) 保存排序
+ //////
+ //////
+ //////
+ //////
+ ///[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")]
+ ///[HttpGet("ChangeSort")]
+ //[Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
+ //public IActionResult ChangeSort(int id = 0, int orderNum = 0)
+ //{
+ // if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
+ // bool result = _${replaceDto.ModelTypeName}Service.Update(w => w.${replaceDto.PKName} == id, it => new ${replaceDto.ModelTypeName}() { ${genTable.SortField} = orderNum });;
- return SUCCESS(result);
- }
+ // return SUCCESS(result);
+ //}
$end
}
}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index 32197e9..49fc6e6 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -20,7 +20,7 @@ ${vueQueryFormHtml}
删除
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && 1 == 2)
修改排序
diff --git a/ZR.Vue/src/views/tool/gen/genInfoForm.vue b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
index 1d48727..54ff5f5 100644
--- a/ZR.Vue/src/views/tool/gen/genInfoForm.vue
+++ b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
@@ -75,7 +75,7 @@
- 排序字段
+ 查询排序字段