From a51fb7d71ad26867c3464107ae9b81a978dddbca 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: Sun, 5 Dec 2021 18:01:39 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E8=AE=BE=E7=BD=AEZRAdmin.xml=E4=B8=BA?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=8D=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/ZR.Admin.WebApi.csproj | 3 +
ZR.Admin.WebApi/ZRAdmin.xml | 1061 ++++++++++++++++++++++++
2 files changed, 1064 insertions(+)
create mode 100644 ZR.Admin.WebApi/ZRAdmin.xml
diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
index 07c5a31..0b71c00 100644
--- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
+++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
@@ -60,6 +60,9 @@
Always
+
+ PreserveNewest
+
diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml
new file mode 100644
index 0000000..a7cb591
--- /dev/null
+++ b/ZR.Admin.WebApi/ZRAdmin.xml
@@ -0,0 +1,1061 @@
+
+
+
+ ZR.Admin.WebApi
+
+
+
+
+ json输出带时间格式的
+
+
+
+
+
+
+
+ 响应返回结果
+
+ 受影响行数
+
+
+
+
+ 全局Code使用
+
+
+
+
+
+
+
+ 导出Excel
+
+
+
+
+
+
+
+
+ 代码生成演示Controller
+
+ @author zr
+ @date 2021-11-24
+
+
+
+
+ 代码生成演示接口
+
+
+
+
+ 查询代码生成演示列表
+
+
+
+
+
+ 查询代码生成演示详情
+
+
+
+
+
+
+ 添加代码生成演示
+
+
+
+
+
+ 更新代码生成演示
+
+
+
+
+
+ 删除代码生成演示
+
+
+
+
+
+ 代码生成
+
+
+
+
+ 获取所有数据库的信息
+
+
+
+
+
+ 获取所有表根据数据名
+
+ 数据库名
+ 表名
+ 分页信息
+
+
+
+
+ 代码生成器
+
+ 数据传输对象
+
+
+
+
+ 获取代码生成表列表
+
+ 表名
+ 分页信息
+
+
+
+
+ 查询表字段列表
+
+ genTable表id
+
+
+
+
+ 删除代码生成
+
+
+
+
+
+
+ 导入表结构(保存)
+
+
+
+
+
+
+
+ 修改保存代码生成业务
+
+ 请求参数实体
+
+
+
+
+ 预览代码
+
+
+
+
+
+
+ 心跳
+
+
+
+
+
+ 加密
+
+
+
+
+
+
+ 解密
+
+
+
+
+
+
+ 发送邮件
+
+ 请求参数接收实体
+
+
+
+
+ T4代码自动生成
+
+
+
+
+ 文章接口
+
+
+
+
+ 查询文章列表
+
+
+
+
+
+ 获取文章目录,前端没用到
+
+
+
+
+
+ 获取文章目录树
+
+
+
+
+
+ 查询文章详情
+
+
+
+
+
+
+ 添加文章
+
+
+
+
+
+ 更新文章
+
+
+
+
+
+ 删除文章
+
+
+
+
+
+ 获取缓存监控数据
+
+
+
+
+
+ 获取服务器信息
+
+
+
+
+
+ 系统访问记录
+
+
+
+
+ 查询登录日志
+ /monitor/logininfor/list
+
+
+
+
+
+
+
+ 清空登录日志
+ /monitor/logininfor/clean
+
+
+
+
+
+ /monitor/logininfor/1
+
+
+
+
+
+
+ 登录日志导出
+
+
+
+
+
+ 查询操作日志
+
+
+
+
+
+
+ 删除操作日志
+
+
+
+
+
+
+ 清空操作日志
+
+
+
+
+
+ 导出操作日志
+
+
+
+
+
+ 参数配置Controller
+
+ @author zhaorui
+ @date 2021-09-29
+
+
+
+
+ 参数配置接口
+
+
+
+
+ 查询参数配置列表
+
+
+
+
+
+ 查询参数配置详情
+
+
+
+
+
+
+ 根据参数键名查询参数值
+
+
+
+
+
+
+ 添加参数配置
+
+
+
+
+
+ 更新参数配置
+
+
+
+
+
+ 删除参数配置
+
+
+
+
+
+ 部门
+
+
+
+
+ 获取部门列表
+
+
+
+
+
+ 查询部门列表(排除节点)
+
+
+
+
+
+
+ 获取部门下拉树列表
+
+
+
+
+
+
+ 根据部门编号获取详细信息
+
+
+
+
+
+ 新增部门
+
+
+
+
+
+
+ 修改部门
+
+
+
+
+
+
+ 删除部门
+
+
+
+
+
+ 数据字典信息
+ @author zr
+
+
+
+
+ 搜索
+
+
+
+
+
+
+
+ 根据字典类型查询字典数据信息
+
+
+
+
+
+
+ 查询字典数据详细
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+ 修改
+
+
+
+
+
+
+ 删除字典类型
+
+
+
+
+
+
+ 数据字典信息
+
+
+
+
+ 查询
+
+
+
+
+
+
+
+ 查询字典类型详细
+
+
+
+
+
+
+ 添加字典类型
+
+
+
+
+
+
+ 修改字典类型
+
+
+
+
+
+
+ 删除字典类型
+
+
+
+
+
+ 字典导出
+
+
+
+
+
+ 登录
+
+
+
+
+ 登录
+
+ 登录对象
+
+
+
+
+ 注销
+
+
+
+
+
+ 获取用户信息
+
+
+
+
+
+ 获取路由信息
+
+
+
+
+
+ 生成图片验证码
+
+
+
+
+
+ 获取菜单列表 √
+
+
+
+
+
+ 根据菜单编号获取详细信息 √
+
+
+
+
+
+
+ 获取菜单下拉树列表(分配角色所需菜单)
+
+
+
+
+
+ 获取角色菜单信息
+ 加载对应角色菜单列表树
+
+
+
+
+
+
+ 修改菜单 √
+
+
+
+
+
+
+ 添加菜单 √
+
+
+
+
+
+
+ 菜单删除 √
+
+
+
+
+
+
+ 保存排序
+
+
+
+
+
+
+ 岗位管理
+
+
+
+
+ 岗位列表查询
+
+
+
+
+
+ 岗位查询
+
+
+
+
+
+
+ 岗位管理
+
+
+
+
+
+
+ 岗位管理
+
+
+
+
+
+
+ 岗位删除
+
+
+
+
+
+
+ 获取岗位选择框列表
+
+
+
+
+ 岗位导出
+
+
+
+
+
+ 个人中心用户信息获取
+
+
+
+
+
+ 修改用户
+
+
+
+
+
+ 修改密码
+
+
+
+
+
+ 修改头像
+
+
+
+
+
+ 角色信息
+
+
+
+
+ 获取系统角色管理
+
+
+
+
+
+ 根据角色编号获取详细信息
+
+
+
+
+
+
+ 添加角色 √
+
+
+
+
+
+
+ 修改角色 √
+
+
+
+
+
+
+ 根据角色分配菜单
+
+
+
+
+
+
+ 角色删除 √
+
+
+
+
+
+
+ 修改角色状态 √
+
+ 角色对象
+
+
+
+
+ 角色导出
+
+
+
+
+
+ 用户管理 -> 获取用户
+ /system/user/list
+
+
+
+
+
+ 用户管理 -> 编辑、添加用户获取用户,信息查询
+
+
+
+
+
+
+ 添加用户
+
+
+
+
+
+
+ 修改用户
+
+
+
+
+
+
+ 改变用户状态
+
+
+
+
+
+
+ 删除用户
+
+
+
+
+
+
+ 重置密码
+
+
+
+
+
+ 用户导出
+
+
+
+
+
+
+ 根据角色编号获取已分配的用户
+
+
+
+
+
+
+ 添加角色用户
+
+
+
+
+
+ 删除角色用户
+
+
+
+
+
+
+ 获取未分配用户角色
+
+
+
+
+
+
+ 查询日志
+
+
+
+
+
+
+
+ 删除定时任务调用日志
+
+
+
+
+
+
+ 清空日志
+
+
+
+
+
+ 定时任务日志导出
+
+
+
+
+
+ 计划任务
+
+
+
+
+ 查询计划任务列表
+
+
+
+
+
+ 查询单个计划任务
+
+ 编码
+
+
+
+
+ 添加任务
+
+
+
+
+
+ 更新任务
+
+
+
+
+
+ 删除任务
+
+
+
+
+
+ 启动任务
+
+
+
+
+
+ 停止任务
+
+
+
+
+
+ 定时任务立即执行一次
+
+
+
+
+
+
+ 定时任务导出
+
+
+
+
+
+ 存储文件
+
+
+
+
+
+
+ HttpContext扩展类
+
+
+
+
+ 是否是ajax请求
+
+
+
+
+
+
+ 获取客户端IP
+
+
+
+
+
+
+ 获取请求令牌
+
+
+
+
+
+
+ 登录cookie写入
+
+
+
+
+
+
+
+ 定时任务扩展方法
+
+
+
+
+ 程序启动后添加任务计划
+
+
+
+
+
+
+ API授权判断
+
+
+
+
+ 权限字符串,例如 system:user:view
+
+
+
+
+ 执行Action前校验是否有权限访问
+
+
+
+
+
+
+
+ OnActionExecuting是在Action执行之前运行的方法。
+
+
+
+
+
+ OnActionExecuted是在Action中的代码执行之后运行的方法。
+
+
+
+
+
+ 记录请求,输出日志
+
+
+
+
+ OnActionExecuted是在Action中的代码执行之后运行的方法。
+
+
+
+
+
+ 设置请求参数
+
+
+
+
+
+
+ 授权校验访问
+ 如果跳过授权登录在Action 或controller加上 AllowAnonymousAttribute
+
+
+
+
+ 只判断token是否正确,不判断权限
+ 如果需要判断权限的在Action上加上ApiActionPermission属性标识权限类别,ActionPermissionFilter作权限处理
+
+
+
+
+
+ 记录用户登陆信息
+
+
+
+
+
+
+
+
+ 2020-11-20
+
+
+
+
+ 获取用户身份信息
+
+
+
+
+
+
+ 生成token
+
+
+
+
+
+
+ 从令牌中获取数据声明
+
+ 令牌
+
+
+
+
+ jwt token校验
+
+
+
+
+
+
+
+ 注册Services服务
+
+
+
+
+
From 6622ea12e99fcd58e0268a986f2963851c57ddb9 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: Sun, 5 Dec 2021 18:17:05 +0800
Subject: [PATCH 02/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?=
=?UTF-8?q?=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/build.bat | 2 +-
ZR.Vue/.env.development | 2 +-
ZR.Vue/.env.staging | 8 ++++++++
ZR.Vue/vue.config.js | 6 +++---
4 files changed, 13 insertions(+), 5 deletions(-)
create mode 100644 ZR.Vue/.env.staging
diff --git a/ZR.Admin.WebApi/build.bat b/ZR.Admin.WebApi/build.bat
index f3d0008..5aa4fb6 100644
--- a/ZR.Admin.WebApi/build.bat
+++ b/ZR.Admin.WebApi/build.bat
@@ -1,6 +1,6 @@
@echo off
-docker build -t ZRAdmin:latest -f ./Dockerfile .
+docker build -t ZRAdmin.NET:latest -f ./Dockerfile .
echo "==============鿴==========="
docker images
diff --git a/ZR.Vue/.env.development b/ZR.Vue/.env.development
index e4fd273..d7d1cf0 100644
--- a/ZR.Vue/.env.development
+++ b/ZR.Vue/.env.development
@@ -3,7 +3,7 @@
ENV = 'development'
# ZR管理系统/开发环境
-VUE_APP_BASE_API = 'http://localhost:8888/'
+VUE_APP_BASE_API = '/dev-api'
# 路由前缀
VUE_APP_ROUTER_PREFIX = '/'
diff --git a/ZR.Vue/.env.staging b/ZR.Vue/.env.staging
new file mode 100644
index 0000000..184dcfe
--- /dev/null
+++ b/ZR.Vue/.env.staging
@@ -0,0 +1,8 @@
+# 测试环境配置
+ENV = 'staging'
+
+# ZR管理系统/生产环境
+VUE_APP_BASE_API = '/stage-api'
+
+# 路由前缀
+VUE_APP_ROUTER_PREFIX = '/'
diff --git a/ZR.Vue/vue.config.js b/ZR.Vue/vue.config.js
index 4b9cde4..a366f0e 100644
--- a/ZR.Vue/vue.config.js
+++ b/ZR.Vue/vue.config.js
@@ -34,11 +34,11 @@ module.exports = {
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
- '/api': {
- target: process.env.VUE_APP_BASE_API,
+ [process.env.VUE_APP_BASE_API]: {
+ target: 'http://localhost:8888/',// 后端接口地址
changeOrigin: true,
pathRewrite: {
- '^/api': ''//需要rewrite的
+ ['^' + process.env.VUE_APP_BASE_API]: ''//需要rewrite的
}
}
},
From 013264da731bf3ff287761346c58562937c9d5cf 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: Sun, 5 Dec 2021 22:09:09 +0800
Subject: [PATCH 03/14] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E8=A1=A8=E6=97=A0=E4=B8=BB=E9=94=AE=E6=97=A0=E8=87=AA?=
=?UTF-8?q?=E5=A2=9E=E6=97=B6controller=20=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/CodeGeneratorTool.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index eadb973..9a0c7d6 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -46,7 +46,7 @@ namespace ZR.CodeGenerator
///
public static void GenerateSingle(GenerateDto dto)
{
- string PKName = "id";
+ string PKName = "Id";
string PKType = "int";
ReplaceDto replaceDto = new();
replaceDto.ModelTypeName = dto.GenTable.ClassName;//表名对应C# 实体类名
From 1e1a80b1a798731a0b1e80c64448b6124a9a0415 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:52:07 +0800
Subject: [PATCH 04/14] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E5=AF=BC=E5=85=A5=E4=B8=9A=E5=8A=A1=E5=90=8D=E6=88=AA?=
=?UTF-8?q?=E5=8F=96bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/CodeGeneratorTool.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 9a0c7d6..f118b71 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -278,9 +278,10 @@ namespace ZR.CodeGenerator
/// 业务名
public static string GetBusinessName(string tableName)
{
- int lastIndex = tableName.LastIndexOf("_");
+ int lastIndex = tableName.LastIndexOf("_");//_前缀长度
int nameLength = tableName.Length;
- string businessName = tableName[(nameLength - lastIndex + 1)..];
+ int subLength = (nameLength - lastIndex) - 1;
+ string businessName = tableName[(lastIndex + 1)..];// tableName.Substring(lastIndex + 1, subLength);
return businessName.ToLower();
}
From d2c63d552e4a5f529819018c82038a5bff4cebad 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:52:33 +0800
Subject: [PATCH 05/14] =?UTF-8?q?fix=20vue=E6=B7=BB=E5=8A=A0=E3=80=81?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A1=A8=E5=8D=95=E7=94=9F=E6=88=90bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/CodeGenerateTemplate.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index ddb9f7e..5f9fae9 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -78,7 +78,7 @@ namespace ZR.CodeGenerator
{
return sb.ToString();
}
- if (!dbFieldInfo.IsInsert || !dbFieldInfo.IsEdit)
+ if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit)
{
return sb.ToString();
}
@@ -187,7 +187,7 @@ namespace ZR.CodeGenerator
if (!dbFieldInfo.IsQuery || dbFieldInfo.HtmlType == GenConstants.HTML_FILE_UPLOAD) return sb.ToString();
if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME)
{
- sb.AppendLine(" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
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 06/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=94=9F=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 @@
- 排序字段
+ 查询排序字段
From b2abc465cf21c96ac4486a0c9c2313e8d6e18d03 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 13:28:12 +0800
Subject: [PATCH 07/14] =?UTF-8?q?fix=20=E6=96=B0=E5=A2=9E=E9=AA=8C?=
=?UTF-8?q?=E8=AF=81=E7=A0=81=E5=BC=80=E5=85=B3=E4=B8=8D=E5=85=BC=E5=AE=B9?=
=?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=ACbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/Controllers/System/SysLoginController.cs | 8 +++++---
ZR.Admin.WebApi/ZRAdmin.xml | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs
index 6687616..1e07704 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs
@@ -143,17 +143,19 @@ namespace ZR.Admin.WebApi.Controllers.System
string uuid = Guid.NewGuid().ToString().Replace("-", "");
SysConfig sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff");
+ var captchaOff = sysConfig?.ConfigValue ?? "0";
+
var code = SecurityCodeHelper.GetRandomEnDigitalText(4);
byte[] imgByte;
- if (sysConfig.ConfigValue == "1")
+ if (captchaOff == "1")
{
imgByte = SecurityCodeHelper.GetGifEnDigitalCodeByte(code);//动态gif数字字母
}
- else if (sysConfig.ConfigValue == "2")
+ else if (captchaOff == "2")
{
imgByte = SecurityCodeHelper.GetGifBubbleCodeByte(code);//动态gif泡泡
}
- else if (sysConfig.ConfigValue == "3")
+ else if (captchaOff == "3")
{
imgByte = SecurityCodeHelper.GetBubbleCodeByte(code);//泡泡
}
diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml
index 30d4241..69d5491 100644
--- a/ZR.Admin.WebApi/ZRAdmin.xml
+++ b/ZR.Admin.WebApi/ZRAdmin.xml
@@ -70,7 +70,7 @@
- T4代码自动生成
+ 文章管理
From 54a8c7f783fd548314858f9c53316ed35e2a07fc 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 13:30:44 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=94=9F=E6=88=90=E6=9F=A5=E8=AF=A2=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/CodeGenerateTemplate.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 5f9fae9..38db3e1 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -229,7 +229,7 @@ namespace ZR.CodeGenerator
//有排序字段
if (!string.IsNullOrEmpty(genTable?.SortField.ToString()) && genTable?.SortField.ToString() == dbFieldInfo.CsharpField)
{
- sb.AppendLine($@" ");
+ sb.AppendLine($@" ");
sb.AppendLine(@" ");
sb.AppendLine($@" ");
sb.AppendLine($" {{{{scope.row.{columnName}}}}}");
@@ -238,7 +238,7 @@ namespace ZR.CodeGenerator
}
else if (dbFieldInfo.IsList && dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
{
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
From 75dd2a1be77f81df3ea9e3918eb2e6a82966413e 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 14:45:40 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E5=BF=BD=E7=95=A5ZRAdmin.xml=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
ZR.Admin.WebApi/ZRAdmin.xml | 1029 -----------------------------------
2 files changed, 1 insertion(+), 1029 deletions(-)
delete mode 100644 ZR.Admin.WebApi/ZRAdmin.xml
diff --git a/.gitignore b/.gitignore
index be46788..581d89f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -267,3 +267,4 @@ __pycache__/
/ZR.Admin.WebApi/wwwroot/export
/ZR.Vue/src/views/business/Gendemo.vue
/ZR.Admin.WebApi/Properties/launchSettings.json
+/ZR.Admin.WebApi/ZRAdmin.xml
diff --git a/ZR.Admin.WebApi/ZRAdmin.xml b/ZR.Admin.WebApi/ZRAdmin.xml
deleted file mode 100644
index 69d5491..0000000
--- a/ZR.Admin.WebApi/ZRAdmin.xml
+++ /dev/null
@@ -1,1029 +0,0 @@
-
-
-
- ZR.Admin.WebApi
-
-
-
-
- json输出带时间格式的
-
-
-
-
-
-
-
- 响应返回结果
-
- 受影响行数
-
-
-
-
- 全局Code使用
-
-
-
-
-
-
-
- 导出Excel
-
-
-
-
-
-
-
-
- 公共模块
-
-
-
-
- 心跳
-
-
-
-
-
- 发送邮件
-
- 请求参数接收实体
-
-
-
-
- 存储文件
-
-
-
-
-
-
- 存储文件到阿里云
-
-
-
-
-
-
- 文章管理
-
-
-
-
- 文章接口
-
-
-
-
- 查询文章列表
-
-
-
-
-
- 获取文章目录,前端没用到
-
-
-
-
-
- 获取文章目录树
-
-
-
-
-
- 查询文章详情
-
-
-
-
-
-
- 添加文章
-
-
-
-
-
- 更新文章
-
-
-
-
-
- 删除文章
-
-
-
-
-
- 代码生成
-
-
-
-
- 获取所有数据库的信息
-
-
-
-
-
- 获取所有表根据数据名
-
- 数据库名
- 表名
- 分页信息
-
-
-
-
- 获取代码生成表列表
-
- 表名
- 分页信息
-
-
-
-
- 查询表字段列表
-
- genTable表id
-
-
-
-
- 删除代码生成
-
-
-
-
-
-
- 导入表结构(保存)
-
-
-
-
-
-
-
- 修改保存代码生成业务
-
- 请求参数实体
-
-
-
-
- 预览代码
-
-
-
-
-
-
- 生成代码(下载方式)
-
- 数据传输对象
-
-
-
-
- 获取缓存监控数据
-
-
-
-
-
- 获取服务器信息
-
-
-
-
-
- 系统访问记录
-
-
-
-
- 查询登录日志
- /monitor/logininfor/list
-
-
-
-
-
-
-
- 清空登录日志
- /monitor/logininfor/clean
-
-
-
-
-
- /monitor/logininfor/1
-
-
-
-
-
-
- 登录日志导出
-
-
-
-
-
- 查询操作日志
-
-
-
-
-
-
- 删除操作日志
-
-
-
-
-
-
- 清空操作日志
-
-
-
-
-
- 导出操作日志
-
-
-
-
-
- 参数配置Controller
-
- @author zhaorui
- @date 2021-09-29
-
-
-
-
- 参数配置接口
-
-
-
-
- 查询参数配置列表
-
-
-
-
-
- 查询参数配置详情
-
-
-
-
-
-
- 根据参数键名查询参数值
-
-
-
-
-
-
- 添加参数配置
-
-
-
-
-
- 更新参数配置
-
-
-
-
-
- 删除参数配置
-
-
-
-
-
- 部门
-
-
-
-
- 获取部门列表
-
-
-
-
-
- 查询部门列表(排除节点)
-
-
-
-
-
-
- 获取部门下拉树列表
-
-
-
-
-
-
- 根据部门编号获取详细信息
-
-
-
-
-
- 新增部门
-
-
-
-
-
-
- 修改部门
-
-
-
-
-
-
- 删除部门
-
-
-
-
-
- 数据字典信息
- @author zr
-
-
-
-
- 搜索
-
-
-
-
-
-
-
- 根据字典类型查询字典数据信息
-
-
-
-
-
-
- 查询字典数据详细
-
-
-
-
-
-
- 添加
-
-
-
-
-
-
- 修改
-
-
-
-
-
-
- 删除字典类型
-
-
-
-
-
-
- 数据字典信息
-
-
-
-
- 查询
-
-
-
-
-
-
-
- 查询字典类型详细
-
-
-
-
-
-
- 添加字典类型
-
-
-
-
-
-
- 修改字典类型
-
-
-
-
-
-
- 删除字典类型
-
-
-
-
-
- 字典导出
-
-
-
-
-
- 登录
-
-
-
-
- 登录
-
- 登录对象
-
-
-
-
- 注销
-
-
-
-
-
- 获取用户信息
-
-
-
-
-
- 获取路由信息
-
-
-
-
-
- 生成图片验证码
-
-
-
-
-
- 获取菜单列表 √
-
-
-
-
-
- 根据菜单编号获取详细信息 √
-
-
-
-
-
-
- 获取菜单下拉树列表(分配角色所需菜单)
-
-
-
-
-
- 获取角色菜单信息
- 加载对应角色菜单列表树
-
-
-
-
-
-
- 修改菜单 √
-
-
-
-
-
-
- 添加菜单 √
-
-
-
-
-
-
- 菜单删除 √
-
-
-
-
-
-
- 保存排序
-
-
-
-
-
-
- 岗位管理
-
-
-
-
- 岗位列表查询
-
-
-
-
-
- 岗位查询
-
-
-
-
-
-
- 岗位管理
-
-
-
-
-
-
- 岗位管理
-
-
-
-
-
-
- 岗位删除
-
-
-
-
-
-
- 获取岗位选择框列表
-
-
-
-
- 岗位导出
-
-
-
-
-
- 个人中心用户信息获取
-
-
-
-
-
- 修改用户
-
-
-
-
-
- 修改密码
-
-
-
-
-
- 修改头像
-
-
-
-
-
-
- 角色信息
-
-
-
-
- 获取系统角色管理
-
-
-
-
-
- 根据角色编号获取详细信息
-
-
-
-
-
-
- 添加角色 √
-
-
-
-
-
-
- 修改角色 √
-
-
-
-
-
-
- 根据角色分配菜单
-
-
-
-
-
-
- 角色删除 √
-
-
-
-
-
-
- 修改角色状态 √
-
- 角色对象
-
-
-
-
- 角色导出
-
-
-
-
-
- 用户管理 -> 获取用户
- /system/user/list
-
-
-
-
-
- 用户管理 -> 编辑、添加用户获取用户,信息查询
-
-
-
-
-
-
- 添加用户
-
-
-
-
-
-
- 修改用户
-
-
-
-
-
-
- 改变用户状态
-
-
-
-
-
-
- 删除用户
-
-
-
-
-
-
- 重置密码
-
-
-
-
-
- 用户导出
-
-
-
-
-
-
- 根据角色编号获取已分配的用户
-
-
-
-
-
-
- 添加角色用户
-
-
-
-
-
- 删除角色用户
-
-
-
-
-
-
- 获取未分配用户角色
-
-
-
-
-
-
- 查询日志
-
-
-
-
-
-
-
- 删除定时任务调用日志
-
-
-
-
-
-
- 清空日志
-
-
-
-
-
- 定时任务日志导出
-
-
-
-
-
- 计划任务
-
-
-
-
- 查询计划任务列表
-
-
-
-
-
- 查询单个计划任务
-
- 编码
-
-
-
-
- 添加任务
-
-
-
-
-
- 更新任务
-
-
-
-
-
- 删除任务
-
-
-
-
-
- 启动任务
-
-
-
-
-
- 停止任务
-
-
-
-
-
- 定时任务立即执行一次
-
-
-
-
-
-
- 定时任务导出
-
-
-
-
-
- HttpContext扩展类
-
-
-
-
- 是否是ajax请求
-
-
-
-
-
-
- 获取客户端IP
-
-
-
-
-
-
- ClaimsIdentity
-
-
-
-
-
-
- 获取请求令牌
-
-
-
-
-
-
- 组装Claims
-
-
-
-
-
-
-
- 定时任务扩展方法
-
-
-
-
- 程序启动后添加任务计划
-
-
-
-
-
-
- API授权判断
-
-
-
-
- 权限字符串,例如 system:user:view
-
-
-
-
- 执行Action前校验是否有权限访问
-
-
-
-
-
-
-
- OnActionExecuting是在Action执行之前运行的方法。
-
-
-
-
-
- OnActionExecuted是在Action中的代码执行之后运行的方法。
-
-
-
-
-
- 记录请求,输出日志
-
-
-
-
- OnActionExecuted是在Action中的代码执行之后运行的方法。
-
-
-
-
-
- 设置请求参数
-
-
-
-
-
-
- 授权校验访问
- 如果跳过授权登录在Action 或controller加上 AllowAnonymousAttribute
-
-
-
-
- 只判断token是否正确,不判断权限
- 如果需要判断权限的在Action上加上ApiActionPermission属性标识权限类别,ActionPermissionFilter作权限处理
-
-
-
-
-
- 记录用户登陆信息
-
-
-
-
-
-
-
-
- 2020-11-20
-
-
-
-
- 获取用户身份信息
-
-
-
-
-
-
- 生成token
-
-
-
-
-
-
- 验证Token
-
-
-
-
-
- 从令牌中获取数据声明
-
- 令牌
-
-
-
-
- jwt token校验
-
-
-
-
-
-
-
- 注册Services服务
-
-
-
-
-
From 08598bef9f749e8f4050bb37a35f9b2db7f49149 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 21:02:29 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E3=80=81=E8=A1=A8=E5=8D=95=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CodeGenTemplate/TplControllers.txt | 6 +++---
.../wwwroot/CodeGenTemplate/TplVue.txt | 4 ++++
.../wwwroot/CodeGenTemplate/TplVueApi.txt | 2 +-
ZR.CodeGenerator/CodeGenerateTemplate.cs | 20 +++++++++++++++++++
4 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index a5ffedf..b99d464 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -167,9 +167,9 @@ $if(genTable.SortField != "")
//////
//////
//////
- ///[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")]
- ///[HttpGet("ChangeSort")]
- //[Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
+ /////[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, "请求参数错误")); }
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index 49fc6e6..d058190 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -20,6 +20,9 @@ ${vueQueryFormHtml}
删除
+
+ 导出
+
$if(genTable.SortField != "" && 1 == 2)
修改排序
@@ -266,6 +269,7 @@ $end
}
});
},
+ handleExport() {},
},
};
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
index c70b678..ec612d3 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
@@ -57,6 +57,7 @@ export function del${genTable.BusinessName}(pid) {
method: 'delete'
})
}
+
// 导出${genTable.functionName}
export function export${replaceDto.ModelTypeName}(query) {
return request({
@@ -75,5 +76,4 @@ export function changeSort(data) {
params: data
})
}
-
$end
\ No newline at end of file
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 38db3e1..605277d 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -162,6 +162,17 @@ namespace ZR.CodeGenerator
sb.AppendLine(" ");
sb.AppendLine(" ");
}
+ else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT)
+ {
+ string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
+ sb.AppendLine(" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine(" ");
+ sb.AppendLine(" ");
+ sb.AppendLine(" ");
+ }
else
{
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
@@ -201,6 +212,15 @@ namespace ZR.CodeGenerator
sb.AppendLine(" ");
sb.AppendLine(" ");
}
+ else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT)
+ {
+ //string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine(" ");
+ sb.AppendLine(" ");
+ }
else
{
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
From baa0f9b4e50389560b4cd0cbe01224acf0b7a1e5 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 21:03:00 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E5=BF=BD?=
=?UTF-8?q?=E7=95=A5=E6=96=87=E4=BB=B6=E5=A4=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
.../key-b6498f45-218a-4853-a182-0e86942ab496.xml | 16 ----------------
2 files changed, 1 insertion(+), 16 deletions(-)
delete mode 100644 ZR.Admin.WebApi/DataProtection/key-b6498f45-218a-4853-a182-0e86942ab496.xml
diff --git a/.gitignore b/.gitignore
index 581d89f..6fd12c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -268,3 +268,4 @@ __pycache__/
/ZR.Vue/src/views/business/Gendemo.vue
/ZR.Admin.WebApi/Properties/launchSettings.json
/ZR.Admin.WebApi/ZRAdmin.xml
+/ZR.Admin.WebApi/DataProtection
diff --git a/ZR.Admin.WebApi/DataProtection/key-b6498f45-218a-4853-a182-0e86942ab496.xml b/ZR.Admin.WebApi/DataProtection/key-b6498f45-218a-4853-a182-0e86942ab496.xml
deleted file mode 100644
index 71c92b8..0000000
--- a/ZR.Admin.WebApi/DataProtection/key-b6498f45-218a-4853-a182-0e86942ab496.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- 2021-08-02T06:58:41.3050198Z
- 2021-08-02T06:58:41.2698484Z
- 2021-10-31T06:58:41.2698484Z
-
-
-
-
-
-
- gmFBOJQxBXoKTqyvLeEnS6IDsf61vG/s0krHG1MfcZwQlu/D2XUaCms+xzpFc2c2JGdaJh5LiLIyJuoRR20Mug==
-
-
-
-
\ No newline at end of file
From 74635e79b96e9558ee25491caeaec47eaf35ffb2 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 22:50:50 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E6=97=B6?=
=?UTF-8?q?=E9=97=B4=E8=8C=83=E5=9B=B4=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wwwroot/CodeGenTemplate/TplDto.txt | 8 ++++----
.../wwwroot/CodeGenTemplate/TplVue.txt | 15 ++++++++++++++-
ZR.CodeGenerator/CodeGenerateTemplate.cs | 10 +++++-----
ZR.Vue/src/main.js | 3 ++-
ZR.Vue/src/utils/ruoyi.js | 11 +++++++++++
5 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
index 52b05d7..68c509a 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
@@ -23,12 +23,12 @@ ${end}
public class ${replaceDto.ModelTypeName}QueryDto : PagerInfo
{
$foreach(item in genTable.Columns)
-$if(item.IsQuery)
+$if(item.IsQuery && item.htmlType == "datetime")
+ public DateTime? Begin$item.CsharpField { get; set; }
+ public DateTime? End$item.CsharpField { get; set; }
+$elseif(item.IsQuery)
public $item.CsharpType $item.CsharpField { get; set; }
$end
${end}
-
- public DateTime? BeginTime { get; set; }
- public DateTime? EndTime { get; set; }
}
}
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index d058190..35ea5ff 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -103,8 +103,12 @@ $foreach(item in genTable.Columns)
$if((item.HtmlType == "radio" || item.HtmlType == "select"))
// ${item.ColumnComment}选项列表
${item.ColumnName}Options: [],
+$elseif(item.HtmlType == "datetime")
+ //${item.ColumnComment}时间范围
+ dateRange${item.CsharpField}: [],
$end
$end
+
$if(genTable.SortField != "")
// 是否显示编辑排序
showEditSort: false,
@@ -130,6 +134,9 @@ $if((item.HtmlType == "radio" || item.HtmlType == "select") && item.DictType !=
this.getDicts("${item.DictType}").then((response) => {
this.${item.ColumnName}Options = response.data;
})
+$elseif(item.HtmlType == "datetime")
+ this.queryParams["begin${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 0);
+ this.queryParams["end${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 1);
$end
$end
},
@@ -137,7 +144,7 @@ $end
// 查询数据
getList() {
console.log(JSON.stringify(this.queryParams));
- list${genTable.BusinessName}(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
+ list${genTable.BusinessName}(this.queryParams).then(res => {
if (res.code == 200) {
this.dataList = res.data.result;
this.total = res.data.totalNum;
@@ -163,6 +170,12 @@ $end
/** 重置查询操作 */
resetQuery() {
this.timeRange = [];
+$foreach(item in genTable.Columns)
+if(item.HtmlType == "datetime")
+ //${item.ColumnComment}时间范围
+ dateRange${item.CsharpField}= [];
+$end
+$end
this.resetForm("queryForm");
this.queryParams = {
pageNum: 1,
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 605277d..159e229 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -34,8 +34,8 @@ namespace ZR.CodeGenerator
//时间类型
if (tbColumn.CsharpType == GenConstants.TYPE_DATE)
{
- replaceDto.QueryCondition += $" predicate = predicate.AndIF(parm.BeginTime != null, it => it.{tbColumn.CsharpField} >= parm.BeginTime);\n";
- replaceDto.QueryCondition += $" predicate = predicate.AndIF(parm.EndTime != null, it => it.{tbColumn.CsharpField} <= parm.EndTime);\n";
+ replaceDto.QueryCondition += $" predicate = predicate.AndIF(parm.Begin{tbColumn.CsharpField} != null, it => it.{tbColumn.CsharpField} >= parm.Begin{tbColumn.CsharpField});\n";
+ replaceDto.QueryCondition += $" predicate = predicate.AndIF(parm.End{tbColumn.CsharpField} != null, it => it.{tbColumn.CsharpField} <= parm.End{tbColumn.CsharpField});\n";
}
}
}
@@ -199,7 +199,7 @@ namespace ZR.CodeGenerator
if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME)
{
sb.AppendLine($" ");
- sb.AppendLine(" ");
sb.AppendLine(" ");
}
@@ -245,9 +245,9 @@ namespace ZR.CodeGenerator
string showToolTip = dbFieldInfo.CsharpType == "string" ? ":show-overflow-tooltip=\"true\"" : "";
string formatter = !string.IsNullOrEmpty(dbFieldInfo.DictType) ? $" :formatter=\"{columnName}Format\"" : "";
StringBuilder sb = new StringBuilder();
-
+ var sortField = genTable?.SortField ?? "";
//有排序字段
- if (!string.IsNullOrEmpty(genTable?.SortField.ToString()) && genTable?.SortField.ToString() == dbFieldInfo.CsharpField)
+ if (!string.IsNullOrEmpty(sortField.ToString()) && sortField.ToString() == dbFieldInfo.CsharpField)
{
sb.AppendLine($@" ");
sb.AppendLine(@" ");
diff --git a/ZR.Vue/src/main.js b/ZR.Vue/src/main.js
index c16beb0..fa6dc78 100644
--- a/ZR.Vue/src/main.js
+++ b/ZR.Vue/src/main.js
@@ -16,7 +16,7 @@ import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
+import { parseTime, resetForm, addDateRange, addDateRange2, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
//分页组件
import Pagination from "@/components/Pagination";
//自定义表格工具扩展
@@ -36,6 +36,7 @@ Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
+Vue.prototype.addDateRange2 = addDateRange2
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
diff --git a/ZR.Vue/src/utils/ruoyi.js b/ZR.Vue/src/utils/ruoyi.js
index 5e04dae..fd86973 100644
--- a/ZR.Vue/src/utils/ruoyi.js
+++ b/ZR.Vue/src/utils/ruoyi.js
@@ -65,6 +65,17 @@ export function addDateRange(params, dateRange) {
return search;
}
+export function addDateRange2(dateRange, index) {
+ console.log(dateRange);
+ var time = "";
+ if (null != dateRange && '' != dateRange) {
+ if (dateRange.length <= 2) {
+ time = dateRange[index];
+ }
+ }
+ return time;
+}
+
// 回显数据字典
export function selectDictLabel(datas, value) {
var actions = [];
From f453b95f6186b39b28cce697538316e181eaa5a5 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: Tue, 7 Dec 2021 16:51:14 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=94=9F=E6=88=90=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/CommonController.cs | 2 +-
.../CodeGenTemplate/TplControllers.txt | 4 +-
.../wwwroot/CodeGenTemplate/TplVue.txt | 55 +++++++++++-------
.../wwwroot/CodeGenTemplate/TplVueApi.txt | 2 +-
ZR.CodeGenerator/CodeGenerateTemplate.cs | 56 ++++++++-----------
ZR.CodeGenerator/CodeGeneratorTool.cs | 17 ++++--
ZR.Vue/src/views/tool/gen/editTable.vue | 7 +--
7 files changed, 78 insertions(+), 65 deletions(-)
diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs
index 591d78f..d331494 100644
--- a/ZR.Admin.WebApi/Controllers/CommonController.cs
+++ b/ZR.Admin.WebApi/Controllers/CommonController.cs
@@ -37,7 +37,7 @@ namespace ZR.Admin.WebApi.Controllers
/// 心跳
///
///
- [HttpGet, Route("health/index")]
+ [HttpGet]
public IActionResult Health()
{
return SUCCESS(true);
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index b99d464..91f9590 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -52,7 +52,7 @@ namespace ${options.ApiControllerNamespace}.Controllers
//搜索条件查询语法参考Sqlsugar
${QueryCondition}
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && genTable.SortField != null)
var response = _${replaceDto.ModelTypeName}Service.GetPages(predicate.ToExpression(), parm, x => x.${genTable.SortField}, "${genTable.SortType}");
$else
var response = _${replaceDto.ModelTypeName}Service.GetPages(predicate.ToExpression(), parm);
@@ -160,7 +160,7 @@ ${end}
string sFileName = ExportExcel(list, "${replaceDto.ModelTypeName}", "${genTable.FunctionName}");
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
}
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && genTable.SortField != null)
//////
////// 代码自动生成(不用可删除) 保存排序
//////
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index 35ea5ff..8f42fec 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 != "" && 1 == 2)
@@ -33,7 +33,7 @@ $end
-
+
${VueViewListContent}
@@ -46,16 +46,16 @@ ${VueViewListContent}
-
+
-${VueViewFormContent}
+ ${VueViewFormContent}
@@ -68,7 +68,8 @@ import {
del${genTable.BusinessName},
update${genTable.BusinessName},
get${genTable.BusinessName},
-$if(genTable.SortField != "")
+ export${genTable.BusinessName},
+$if(genTable.SortField != "" && genTable.SortField != null)
changeSort
$end
} from '@/api/${genTable.ModuleName}/${lowerBusinessName}.js';
@@ -103,13 +104,13 @@ $foreach(item in genTable.Columns)
$if((item.HtmlType == "radio" || item.HtmlType == "select"))
// ${item.ColumnComment}选项列表
${item.ColumnName}Options: [],
-$elseif(item.HtmlType == "datetime")
+$elseif(item.HtmlType == "datetime" && item.IsQuery == true)
//${item.ColumnComment}时间范围
dateRange${item.CsharpField}: [],
$end
$end
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && genTable.SortField != null)
// 是否显示编辑排序
showEditSort: false,
$end
@@ -125,7 +126,7 @@ ${VueViewEditFormRuleContent}
},
};
},
- mounted() {
+ created() {
// 列表数据查询
this.getList();
@@ -134,17 +135,20 @@ $if((item.HtmlType == "radio" || item.HtmlType == "select") && item.DictType !=
this.getDicts("${item.DictType}").then((response) => {
this.${item.ColumnName}Options = response.data;
})
-$elseif(item.HtmlType == "datetime")
- this.queryParams["begin${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 0);
- this.queryParams["end${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 1);
$end
$end
},
methods: {
// 查询数据
getList() {
+$foreach(item in genTable.Columns)
+$if(item.HtmlType == "datetime" && item.IsQuery == true)
+ this.queryParams["begin${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 0);
+ this.queryParams["end${item.CsharpField}"] = this.addDateRange2(this.dateRange${item.CsharpField}, 1);
+$end
+$end
console.log(JSON.stringify(this.queryParams));
- list${genTable.BusinessName}(this.queryParams).then(res => {
+ list${genTable.BusinessName}(this.queryParams).then(res => {
if (res.code == 200) {
this.dataList = res.data.result;
this.total = res.data.totalNum;
@@ -171,9 +175,9 @@ $end
resetQuery() {
this.timeRange = [];
$foreach(item in genTable.Columns)
-if(item.HtmlType == "datetime")
+$if(item.HtmlType == "datetime" && item.IsQuery == true)
//${item.ColumnComment}时间范围
- dateRange${item.CsharpField}= [];
+ this.dateRange${item.CsharpField}= [];
$end
$end
this.resetForm("queryForm");
@@ -220,7 +224,7 @@ $end
}
});
},
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && genTable.SortField != null)
// 显示编辑排序
handleShowSort() {
this.showEditSort = !this.showEditSort;
@@ -239,9 +243,8 @@ $end
$if(replaceDto.UploadFile == 1)
//图片上传成功方法
handleUploadSuccess(res, columnName) {
- console.log(columnName, res)
this.form[columnName] = res.data;
- console.log(JSON.stringify(this.form))
+ console.log(JSON.stringify(this.form), JSON.stringify(res))
},
$end
$foreach(item in genTable.Columns)
@@ -282,7 +285,21 @@ $end
}
});
},
- handleExport() {},
+ /** 导出按钮操作 */
+ handleExport() {
+ const queryParams = this.queryParams;
+ this.${confirm}confirm("是否确认导出所有${genTable.functionName}数据项?", "警告", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(function () {
+ return export${genTable.BusinessName}(queryParams);
+ })
+ .then((response) => {
+ this.download(response.data.path);
+ });
+ },
},
};
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
index ec612d3..a69b283 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVueApi.txt
@@ -67,7 +67,7 @@ export function export${replaceDto.ModelTypeName}(query) {
})
}
-$if(genTable.SortField != "")
+$if(genTable.SortField != "" && genTable.SortField != null)
//排序
export function changeSort(data) {
return request({
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 159e229..01ef44c 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -72,21 +72,22 @@ namespace ZR.CodeGenerator
string columnName = dbFieldInfo.ColumnName;
string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, columnName);
string labelDisabled = dbFieldInfo.IsPk ? ":disabled=\"true\"" : "";
- string placeHolder = dbFieldInfo.IsIncrement ? "" : $"请输入{labelName}";
StringBuilder sb = new StringBuilder();
+ string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
+
if (GenConstants.inputDtoNoField.Any(f => f.ToLower().Contains(dbFieldInfo.CsharpField.ToLower())))
{
return sb.ToString();
}
- if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit)
+ if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit && !dbFieldInfo.IsPk)
{
return sb.ToString();
}
if (dbFieldInfo.HtmlType == GenConstants.HTML_INPUT_NUMBER)
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
}
@@ -94,7 +95,7 @@ namespace ZR.CodeGenerator
{
//时间
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -103,21 +104,15 @@ namespace ZR.CodeGenerator
{
//图片
sb.AppendLine(" ");
- sb.AppendLine($" ");
- //sb.AppendLine($" ");
- //sb.AppendLine($" ");
- //sb.AppendLine(" ");
- //sb.AppendLine(" ");
- //sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($@" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
}
else if (dbFieldInfo.HtmlType == GenConstants.HTML_RADIO && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
- string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine($" {{{{item.dictLabel}}}}");
sb.AppendLine(" ");
@@ -127,10 +122,9 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_RADIO)
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
- sb.AppendLine(" 是");
- sb.AppendLine(" 否");
+ sb.AppendLine(" 请选择字典生成");
sb.AppendLine(" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -146,29 +140,27 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_EDITOR)
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
}
else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
- string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
sb.AppendLine(" ");
- sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
}
- else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT)
+ else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && string.IsNullOrEmpty(dbFieldInfo.DictType))
{
- string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -177,8 +169,8 @@ namespace ZR.CodeGenerator
{
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
sb.AppendLine(" ");
- sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
}
@@ -200,14 +192,14 @@ namespace ZR.CodeGenerator
{
sb.AppendLine($" ");
sb.AppendLine($" ");
+ sb.AppendLine($" end-placeholder=\"结束日期\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" >");
sb.AppendLine(" ");
}
- else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
+ else if ((dbFieldInfo.HtmlType == GenConstants.HTML_SELECT || dbFieldInfo.HtmlType == GenConstants.HTML_RADIO) && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
//string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" size=\"small\"");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -216,7 +208,7 @@ namespace ZR.CodeGenerator
{
//string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -225,7 +217,7 @@ namespace ZR.CodeGenerator
{
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
sb.AppendLine($" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine(" ");
}
@@ -247,7 +239,7 @@ namespace ZR.CodeGenerator
StringBuilder sb = new StringBuilder();
var sortField = genTable?.SortField ?? "";
//有排序字段
- if (!string.IsNullOrEmpty(sortField.ToString()) && sortField.ToString() == dbFieldInfo.CsharpField)
+ if (!string.IsNullOrEmpty(sortField.ToString()) && sortField.ToString() == dbFieldInfo.CsharpField && !dbFieldInfo.IsPk && CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType))
{
sb.AppendLine($@" ");
sb.AppendLine(@" ");
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index f118b71..c863a5f 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -66,7 +66,7 @@ namespace ZR.CodeGenerator
replaceDto.UploadFile = 1;
}
CodeGenerateTemplate.GetQueryDtoProperty(dbFieldInfo, replaceDto);
-
+
replaceDto.VueViewFormHtml += CodeGenerateTemplate.TplVueFormContent(dbFieldInfo);
replaceDto.VueViewListHtml += CodeGenerateTemplate.TplTableColumn(dbFieldInfo, dto.GenTable);
replaceDto.VueViewEditFormRuleContent += CodeGenerateTemplate.TplFormRules(dbFieldInfo);
@@ -177,7 +177,7 @@ namespace ZR.CodeGenerator
{
var fullPath = Path.Combine(generateDto.GenCodePath, _option.ApiControllerNamespace, "Controllers", generateDto.GenTable.ModuleName, $"{replaceDto.ModelTypeName}Controller.cs");
var tpl = FileHelper.ReadJtTemplate("TplControllers.txt");
-
+
tpl.Set("QueryCondition", replaceDto.QueryCondition);
var result = tpl.Render();
generateDto.GenCodes.Add(new GenCode(5, "Controller", fullPath, result));
@@ -278,11 +278,11 @@ namespace ZR.CodeGenerator
/// 业务名
public static string GetBusinessName(string tableName)
{
- int lastIndex = tableName.LastIndexOf("_");//_前缀长度
+ int lastIndex = tableName.IndexOf("_");//_前缀长度
int nameLength = tableName.Length;
int subLength = (nameLength - lastIndex) - 1;
- string businessName = tableName[(lastIndex + 1)..];// tableName.Substring(lastIndex + 1, subLength);
- return businessName.ToLower();
+ string businessName = tableName[(lastIndex + 1)..];
+ return businessName.Replace("_", "").ToLower();
}
///
@@ -397,7 +397,11 @@ namespace ZR.CodeGenerator
{
genTableColumn.IsList = true;
}
-
+ //时间类型初始化between范围查询
+ if (genTableColumn.CsharpType == GenConstants.TYPE_DATE)
+ {
+ genTableColumn.QueryType = "BETWEEN";
+ }
genTableColumns.Add(genTableColumn);
}
return genTableColumns;
@@ -421,6 +425,7 @@ namespace ZR.CodeGenerator
options.OutMode = OutMode.Auto;
//options.DisableeLogogram = true;//禁用简写
options.Data.Set("refs", "$");//特殊标签替换
+ options.Data.Set("confirm", "$");//特殊标签替换
options.Data.Set("replaceDto", replaceDto);
options.Data.Set("options", dto.GenOptions);
options.Data.Set("genTable", dto.GenTable);
diff --git a/ZR.Vue/src/views/tool/gen/editTable.vue b/ZR.Vue/src/views/tool/gen/editTable.vue
index 3e03c8b..5f50c81 100644
--- a/ZR.Vue/src/views/tool/gen/editTable.vue
+++ b/ZR.Vue/src/views/tool/gen/editTable.vue
@@ -53,8 +53,7 @@
-
+
@@ -90,7 +89,7 @@
-
+
{{ dict.dictName }}
{{ dict.dictType }}
@@ -101,7 +100,7 @@
-
+
From cf43e9d0774ed332a449b8ea87f489e590b5e17b 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: Tue, 7 Dec 2021 17:28:28 +0800
Subject: [PATCH 14/14] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E8=A1=A8=E5=8D=95=E6=A0=A1=E9=AA=8Cbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/CodeGenerateTemplate.cs | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 01ef44c..1a4a511 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -86,7 +86,7 @@ namespace ZR.CodeGenerator
if (dbFieldInfo.HtmlType == GenConstants.HTML_INPUT_NUMBER)
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -95,7 +95,7 @@ namespace ZR.CodeGenerator
{
//时间
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -104,7 +104,7 @@ namespace ZR.CodeGenerator
{
//图片
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($@" ");
sb.AppendLine(" ");
sb.AppendLine(" ");
@@ -112,7 +112,7 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_RADIO && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine($" {{{{item.dictLabel}}}}");
sb.AppendLine(" ");
@@ -122,7 +122,7 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_RADIO)
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" 请选择字典生成");
sb.AppendLine(" ");
@@ -148,7 +148,7 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
@@ -158,7 +158,7 @@ namespace ZR.CodeGenerator
else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && string.IsNullOrEmpty(dbFieldInfo.DictType))
{
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
@@ -169,7 +169,7 @@ namespace ZR.CodeGenerator
{
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
sb.AppendLine(" ");
- sb.AppendLine($" ");
+ sb.AppendLine($" ");
sb.AppendLine($" ");
sb.AppendLine(" ");
sb.AppendLine(" ");