Squashed commit of the following:
commit 1daa137d98a3a814e3617606b14c737dbb611f4f
Author: 不做码农 <599854767@qq.com>
Date: Sat Apr 9 14:51:29 2022 +0800
IPRatelimit添加白名单接口
commit d05690654b889ae3ab8f4add1b76a5859e1ab89a
Author: 不做码农 <599854767@qq.com>
Date: Fri Apr 8 20:20:11 2022 +0800
添加页签openPage支持传递参数
commit 861710079a26294c64d70eeadb7630bf83e3bfc4
Author: 不做码农 <599854767@qq.com>
Date: Fri Apr 8 12:44:28 2022 +0800
update FileHelper.cs
commit a0cf47c099533fabaf5bd389cf498f08eead2ef4
Author: 不做码农 <599854767@qq.com>
Date: Thu Apr 7 13:30:47 2022 +0800
优化代码生成模板
commit 5b376614d02c2d27b6e90252c2a3169adfb0e612
Author: 不做码农 <599854767@qq.com>
Date: Thu Apr 7 13:30:13 2022 +0800
IP限制增加百名单接口
commit 939ec56d1db4cad52f7b64555e16d52b5b061360
Author: 不做码农 <599854767@qq.com>
Date: Mon Apr 4 21:48:27 2022 +0800
fix 基础sql脚本bug
commit 19c738b974e14b62929dc69c2c6ac1e8540aad98
Author: 不做码农 <599854767@qq.com>
Date: Mon Apr 4 18:53:02 2022 +0800
新增加IPRateLimit限制
commit 6b0e6b11b3fdbb5ab53606cf4d0910ae30886365
Author: 不做码农 <599854767@qq.com>
Date: Mon Apr 4 12:09:39 2022 +0800
格式化代码
commit 1024471c64beef683b257b38d4904ab7cd509c82
Author: 不做码农 <599854767@qq.com>
Date: Mon Apr 4 12:02:32 2022 +0800
自定义异常新增获取LogAttribute属性
This commit is contained in:
parent
8fd6bba2d1
commit
973c3281b2
@ -1,16 +1,13 @@
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
using Infrastructure.Enums;
|
using Infrastructure.Enums;
|
||||||
using Infrastructure.Extensions;
|
|
||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Snowflake.Core;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -171,7 +168,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
SysFile file = new(formFile.FileName, fileName, fileExt, fileSize + "kb", fileDir, HttpContext.GetName())
|
SysFile file = new(formFile.FileName, fileName, fileExt, fileSize + "kb", fileDir, HttpContext.GetName())
|
||||||
{
|
{
|
||||||
StoreType = (int)Infrastructure.Enums.StoreType.ALIYUN,
|
StoreType = (int)StoreType.ALIYUN,
|
||||||
FileType = formFile.ContentType
|
FileType = formFile.ContentType
|
||||||
};
|
};
|
||||||
file = await SysFileService.SaveFileToAliyun(file, formFile);
|
file = await SysFileService.SaveFileToAliyun(file, formFile);
|
||||||
|
|||||||
27
ZR.Admin.WebApi/Extensions/IPRateExtension.cs
Normal file
27
ZR.Admin.WebApi/Extensions/IPRateExtension.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using AspNetCoreRateLimit;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ZR.Admin.WebApi.Extensions
|
||||||
|
{
|
||||||
|
public static class IPRateExtension
|
||||||
|
{
|
||||||
|
public static void AddIPRate(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||||
|
|
||||||
|
//从appsettings.json中加载常规配置,IpRateLimiting与配置文件中节点对应
|
||||||
|
services.Configure<IpRateLimitOptions>(configuration.GetSection("IpRateLimiting"));
|
||||||
|
|
||||||
|
//从appsettings.json中加载Ip规则
|
||||||
|
services.Configure<IpRateLimitPolicies>(configuration.GetSection("IpRateLimitPolicies"));
|
||||||
|
//注入计数器和规则存储
|
||||||
|
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
|
||||||
|
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
|
||||||
|
//配置(解析器、计数器密钥生成器)
|
||||||
|
services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
|
||||||
|
services.AddSingleton<IProcessingStrategy, AsyncKeyLockProcessingStrategy>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,13 @@
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
|
using Infrastructure.Attribute;
|
||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using IPTools.Core;
|
using IPTools.Core;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Newtonsoft.Json;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZR.Admin.WebApi.Extensions;
|
using ZR.Admin.WebApi.Extensions;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
@ -66,8 +69,15 @@ namespace ZR.Admin.WebApi.Middleware
|
|||||||
logLevel = NLog.LogLevel.Error;
|
logLevel = NLog.LogLevel.Error;
|
||||||
context.Response.StatusCode = 500;
|
context.Response.StatusCode = 500;
|
||||||
}
|
}
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||||
|
WriteIndented = true
|
||||||
|
};
|
||||||
|
|
||||||
string responseResult = System.Text.Json.JsonSerializer.Serialize(new ApiResult(code, msg)).ToLower();
|
ApiResult apiResult = new(code, msg);
|
||||||
|
string responseResult = JsonSerializer.Serialize(apiResult, options).ToLower();
|
||||||
string ip = HttpContextExtension.GetClientUserIp(context);
|
string ip = HttpContextExtension.GetClientUserIp(context);
|
||||||
var ip_info = IpTool.Search(ip);
|
var ip_info = IpTool.Search(ip);
|
||||||
|
|
||||||
@ -83,6 +93,18 @@ namespace ZR.Admin.WebApi.Middleware
|
|||||||
operLocation = ip_info.Province + " " + ip_info.City,
|
operLocation = ip_info.Province + " " + ip_info.City,
|
||||||
operTime = DateTime.Now
|
operTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
var endpoint = GetEndpoint(context);
|
||||||
|
if (endpoint != null)
|
||||||
|
{
|
||||||
|
var logAttribute = endpoint.Metadata.GetMetadata<LogAttribute>();
|
||||||
|
if (logAttribute != null)
|
||||||
|
{
|
||||||
|
sysOperLog.businessType = (int)logAttribute?.BusinessType;
|
||||||
|
sysOperLog.title = logAttribute?.Title;
|
||||||
|
sysOperLog.operParam = logAttribute.IsSaveRequestData ? sysOperLog.operParam : "";
|
||||||
|
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
HttpContextExtension.GetRequestValue(context, sysOperLog);
|
HttpContextExtension.GetRequestValue(context, sysOperLog);
|
||||||
LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error);
|
LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error);
|
||||||
|
|
||||||
@ -91,12 +113,22 @@ namespace ZR.Admin.WebApi.Middleware
|
|||||||
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
|
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
|
||||||
ei.Properties["jsonResult"] = responseResult;
|
ei.Properties["jsonResult"] = responseResult;
|
||||||
ei.Properties["requestParam"] = sysOperLog.operParam;
|
ei.Properties["requestParam"] = sysOperLog.operParam;
|
||||||
ei.Properties["user"] = context.User.Identity?.Name;
|
ei.Properties["user"] = HttpContextExtension.GetName(context);
|
||||||
|
|
||||||
Logger.Log(ei);
|
Logger.Log(ei);
|
||||||
await context.Response.WriteAsync(responseResult);
|
await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8);
|
||||||
|
|
||||||
SysOperLogService.InsertOperlog(sysOperLog);
|
SysOperLogService.InsertOperlog(sysOperLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Endpoint? GetEndpoint(HttpContext context)
|
||||||
|
{
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.Features.Get<IEndpointFeature>()?.Endpoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
168
ZR.Admin.WebApi/Startup.cs
Normal file
168
ZR.Admin.WebApi/Startup.cs
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
using AspNetCoreRateLimit;
|
||||||
|
using Hei.Captcha;
|
||||||
|
using Infrastructure;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ZR.Admin.WebApi.Extensions;
|
||||||
|
using ZR.Admin.WebApi.Filters;
|
||||||
|
using ZR.Admin.WebApi.Framework;
|
||||||
|
using ZR.Admin.WebApi.Hubs;
|
||||||
|
using ZR.Admin.WebApi.Middleware;
|
||||||
|
|
||||||
|
namespace ZR.Admin.WebApi
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
Configuration = configuration;
|
||||||
|
}
|
||||||
|
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
public IConfiguration Configuration { get; }
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
string corsUrls = Configuration["corsUrls"];
|
||||||
|
|
||||||
|
//配置跨域
|
||||||
|
services.AddCors(c =>
|
||||||
|
{
|
||||||
|
c.AddPolicy("Policy", policy =>
|
||||||
|
{
|
||||||
|
policy.WithOrigins(corsUrls.Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||||
|
.AllowAnyHeader()//允许任意头
|
||||||
|
.AllowCredentials()//允许cookie
|
||||||
|
.AllowAnyMethod();//允许任意方法
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//注入SignalR实时通讯,默认用json传输
|
||||||
|
services.AddSignalR(options =>
|
||||||
|
{
|
||||||
|
//客户端发保持连接请求到服务端最长间隔,默认30秒,改成4分钟,网页需跟着设置connection.keepAliveIntervalInMilliseconds = 12e4;即2分钟
|
||||||
|
//options.ClientTimeoutInterval = TimeSpan.FromMinutes(4);
|
||||||
|
//服务端发保持连接请求到客户端间隔,默认15秒,改成2分钟,网页需跟着设置connection.serverTimeoutInMilliseconds = 24e4;即4分钟
|
||||||
|
//options.KeepAliveInterval = TimeSpan.FromMinutes(2);
|
||||||
|
});
|
||||||
|
//消除Error unprotecting the session cookie警告
|
||||||
|
services.AddDataProtection()
|
||||||
|
.PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection"));
|
||||||
|
//普通验证码
|
||||||
|
services.AddHeiCaptcha();
|
||||||
|
services.AddIPRate(Configuration);
|
||||||
|
services.AddSession();
|
||||||
|
services.AddMemoryCache();
|
||||||
|
services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
//绑定整个对象到Model上
|
||||||
|
services.Configure<OptionsSetting>(Configuration);
|
||||||
|
|
||||||
|
//jwt 认证
|
||||||
|
services.AddAuthentication(options =>
|
||||||
|
{
|
||||||
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
}).AddCookie()
|
||||||
|
.AddJwtBearer(o =>
|
||||||
|
{
|
||||||
|
o.TokenValidationParameters = JwtUtil.ValidParameters();
|
||||||
|
});
|
||||||
|
|
||||||
|
InjectServices(services, Configuration);
|
||||||
|
|
||||||
|
services.AddMvc(options =>
|
||||||
|
{
|
||||||
|
options.Filters.Add(typeof(GlobalActionMonitor));//全局注册
|
||||||
|
})
|
||||||
|
.AddJsonOptions(options =>
|
||||||
|
{
|
||||||
|
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeConverter());
|
||||||
|
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullConverter());
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddSwaggerConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
app.UseSwagger();
|
||||||
|
//使可以多次多去body内容
|
||||||
|
app.Use((context, next) =>
|
||||||
|
{
|
||||||
|
context.Request.EnableBuffering();
|
||||||
|
if (context.Request.Query.TryGetValue("access_token", out var token))
|
||||||
|
{
|
||||||
|
context.Request.Headers.Add("Authorization", $"Bearer {token}");
|
||||||
|
}
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
//开启访问静态文件/wwwroot目录文件,要放在UseRouting前面
|
||||||
|
app.UseStaticFiles();
|
||||||
|
//开启路由访问
|
||||||
|
app.UseRouting();
|
||||||
|
app.UseCors("Policy");//要放在app.UseEndpoints前。
|
||||||
|
|
||||||
|
//app.UseAuthentication会启用Authentication中间件,该中间件会根据当前Http请求中的Cookie信息来设置HttpContext.User属性(后面会用到),
|
||||||
|
//所以只有在app.UseAuthentication方法之后注册的中间件才能够从HttpContext.User中读取到值,
|
||||||
|
//这也是为什么上面强调app.UseAuthentication方法一定要放在下面的app.UseMvc方法前面,因为只有这样ASP.NET Core的MVC中间件中才能读取到HttpContext.User的值。
|
||||||
|
//1.先开启认证
|
||||||
|
app.UseAuthentication();
|
||||||
|
//2.再开启授权
|
||||||
|
app.UseAuthorization();
|
||||||
|
//开启session
|
||||||
|
app.UseSession();
|
||||||
|
//开启缓存
|
||||||
|
app.UseResponseCaching();
|
||||||
|
//恢复/启动任务
|
||||||
|
app.UseAddTaskSchedulers();
|
||||||
|
//使用全局异常中间件
|
||||||
|
app.UseMiddleware<GlobalExceptionMiddleware>();
|
||||||
|
//启用客户端IP限制速率
|
||||||
|
app.UseIpRateLimiting();
|
||||||
|
|
||||||
|
app.UseEndpoints(endpoints =>
|
||||||
|
{
|
||||||
|
//设置socket连接
|
||||||
|
endpoints.MapHub<MessageHub>("/msgHub");
|
||||||
|
|
||||||
|
endpoints.MapControllerRoute(
|
||||||
|
name: "default",
|
||||||
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册Services服务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services"></param>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
|
private void InjectServices(IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddAppService();
|
||||||
|
services.AddSingleton(new AppSettings(configuration));
|
||||||
|
//开启计划任务
|
||||||
|
services.AddTaskSchedulers();
|
||||||
|
//初始化db
|
||||||
|
DbExtension.AddDb(configuration);
|
||||||
|
|
||||||
|
//注册REDIS 服务
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
//RedisServer.Initalize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,6 +21,7 @@
|
|||||||
<ProjectReference Include="..\ZR.Tasks\ZR.Tasks.csproj" />
|
<ProjectReference Include="..\ZR.Tasks\ZR.Tasks.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AspNetCoreRateLimit" Version="4.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
|
||||||
@ -37,11 +38,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Controllers\" />
|
<Folder Include="Controllers\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="ip2region.db">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -54,5 +54,74 @@
|
|||||||
"RedisServer": {
|
"RedisServer": {
|
||||||
"Cache": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=cache:",
|
"Cache": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=cache:",
|
||||||
"Session": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=session:"
|
"Session": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=session:"
|
||||||
|
},
|
||||||
|
//接口请求限制
|
||||||
|
"IpRateLimiting": {
|
||||||
|
//例如设置了5次每分钟访问限流。当False时:项目中每个接口都加入计数,不管你访问哪个接口,只要在一分钟内累计够5次,将禁止访问。
|
||||||
|
//True:当一分钟请求了5次GetData接口,则该接口将在时间段内禁止访问,但是还可以访问PostData()5次,总得来说是每个接口都有5次在这一分钟,互不干扰。
|
||||||
|
"EnableEndpointRateLimiting": true,
|
||||||
|
//false,拒绝的API调用不会添加到调用次数计数器上;如 客户端每秒发出3个请求并且您设置了每秒一个调用的限制,则每分钟或每天计数器等其他限制将仅记录第一个调用,即成功的API调用。如果您希望被拒绝的API调用计入其他时间的显示(分钟,小时等)
|
||||||
|
//,则必须设置StackBlockedRequests为true。
|
||||||
|
"StackBlockedRequests": false,
|
||||||
|
"RealIpHeader": "X-Real-IP",
|
||||||
|
//取白名单的客户端ID。如果此标头中存在客户端ID并且与ClientWhitelist中指定的值匹配,则不应用速率限制。
|
||||||
|
"ClientIdHeader": "X-ClientId",
|
||||||
|
"HttpStatusCode": 429,
|
||||||
|
//端点白名单
|
||||||
|
"EndpointWhitelist": [ "post:/system/dict/data/types", "*:/msghub/negotiate", "*:/LogOut" ],
|
||||||
|
//客户端白名单
|
||||||
|
//"ClientWhitelist": [ "dev-id-1", "dev-id-2" ],
|
||||||
|
"QuotaExceededResponse": {
|
||||||
|
"Content": "{{\"code\":429,\"msg\":\"访问过于频繁,请稍后重试\"}}",
|
||||||
|
"ContentType": "application/json",
|
||||||
|
"StatusCode": 429
|
||||||
|
},
|
||||||
|
//通用规则,api规则,结尾一定要带*
|
||||||
|
"GeneralRules": [
|
||||||
|
{
|
||||||
|
"Endpoint": "*:/captchaImage",
|
||||||
|
//时间段,格式:{数字}{单位};可使用单位:s, m, h, d
|
||||||
|
"Period": "3s",
|
||||||
|
"Limit": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Endpoint": "post:*",
|
||||||
|
//时间段,格式:{数字}{单位};可使用单位:s, m, h, d
|
||||||
|
"Period": "3s",
|
||||||
|
"Limit": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Endpoint": "put:*",
|
||||||
|
//时间段,格式:{数字}{单位};可使用单位:s, m, h, d
|
||||||
|
"Period": "3s",
|
||||||
|
"Limit": 1
|
||||||
|
}
|
||||||
|
//{
|
||||||
|
// "Endpoint": "*",
|
||||||
|
// //时间段,格式:{数字}{单位};可使用单位:s, m, h, d
|
||||||
|
// "Period": "1s",
|
||||||
|
// "Limit": 2
|
||||||
|
//}
|
||||||
|
//{
|
||||||
|
// "Endpoint": "*",
|
||||||
|
// "Period": "15m",
|
||||||
|
// "Limit": 100
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// "Endpoint": "*",
|
||||||
|
// "Period": "12h",
|
||||||
|
// "Limit": 1000
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// "Endpoint": "*",
|
||||||
|
// "Period": "7d",
|
||||||
|
// "Limit": 10000
|
||||||
|
//}
|
||||||
|
],
|
||||||
|
"IpRateLimitPolicies": {
|
||||||
|
//ip规则
|
||||||
|
"IpRules": [
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
109
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt
Normal file
109
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
$foreach(column in genTable.Columns)
|
||||||
|
$set(labelName = "")
|
||||||
|
$set(labelDisabled = "")
|
||||||
|
$set(columnName = column.CsharpFieldFl)
|
||||||
|
$set(value = "item.dictValue")
|
||||||
|
|
||||||
|
$if(column.ColumnComment != "")
|
||||||
|
$set(labelName = column.ColumnComment)
|
||||||
|
$else
|
||||||
|
$set(labelName = column.CsharpFieldFl)
|
||||||
|
$end
|
||||||
|
$if(column.IsPk == true)
|
||||||
|
$set(labelDisabled = ":disabled=true")
|
||||||
|
$end
|
||||||
|
$if(column.CsharpType == "int" || column.CsharpType == "long")
|
||||||
|
$set(value = "parseInt(item.dictValue)")
|
||||||
|
$end
|
||||||
|
|
||||||
|
$if(tool.CheckInputDtoNoField(column.CsharpField))
|
||||||
|
$elseif(column.IsInsert == false && column.IsEdit == false)
|
||||||
|
<el-col :lg="12" v-if="opertype == 2">
|
||||||
|
<el-form-item label="${labelName}">{{form.${columnName}}}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(tool.CheckTree(genTable ,column.CsharpField))
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="父级id" prop="${columnName}">
|
||||||
|
<treeselect v-model="form.${columnName}" :options="dataList" :normalizer="normalizer" :show-count="true" placeholder="选择上级菜单" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.IsPK || column.IsIncrement)
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
$if(column.IsIncrement == false)
|
||||||
|
<el-input-number v-model.number="form.${columnName}" controls-position="right" placeholder="请输入${labelName}" :disabled="title=='修改数据'"/>
|
||||||
|
$else
|
||||||
|
<span v-html="form.${columnName}"/>
|
||||||
|
$end
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$else
|
||||||
|
$if(column.HtmlType == "inputNumber")
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-input-number v-model.number="form.${columnName}" controls-position="right" placeholder="请输入${labelName}" ${labelDisabled}/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "datetime")
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-date-picker v-model="form.${columnName}" type="datetime" placeholder="选择日期时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "imageUpload")
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<UploadImage v-model="form.${columnName}" column="${columnName}" @success="handleUploadSuccess" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "fileUpload")
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<UploadFile v-model="form.${columnName}" column="${columnName}" @success="handleUploadSuccess" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "radio")
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-radio-group v-model="form.${columnName}">
|
||||||
|
<el-radio v-for="item in ${columnName}Options" :key="item.dictValue" :label="${value}">{{item.dictLabel}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "textarea")
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-input type="textarea" v-model="form.${columnName}" placeholder="请输入${labelName}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "editor")
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<editor v-model="form.${columnName}" :min-height="200" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "select")
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-select v-model="form.${columnName}" placeholder="请选择${labelName}">
|
||||||
|
<el-option v-for="item in ${columnName}Options" :key="item.dictValue" :label="item.dictLabel" :value="${value}"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$elseif(column.HtmlType == "checkbox")
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-checkbox-group v-model="form.${columnName}Checked">
|
||||||
|
<el-checkbox v-for="item in ${columnName}Options" :key="item.dictValue" :label="item.dictValue">{{item.dictLabel}}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$else
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
|
<el-input v-model="form.${columnName}" placeholder="请输入${labelName}" ${labelDisabled}/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
$end
|
||||||
|
$end
|
||||||
|
$end
|
||||||
@ -48,7 +48,7 @@ ${VueViewListContent}
|
|||||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
${VueViewFormContent}
|
${VueViewFormContent}
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -107,6 +107,7 @@ $end
|
|||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 操作类型 1、add 2、edit
|
// 操作类型 1、add 2、edit
|
||||||
|
opertype: 0,
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 是否展开,默认全部折叠
|
// 是否展开,默认全部折叠
|
||||||
|
|||||||
@ -57,7 +57,7 @@ $end
|
|||||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
${VueViewFormContent}
|
${VueViewFormContent}
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch"
|
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch"
|
||||||
@submit.prevent>
|
@submit.prevent>
|
||||||
|
|
||||||
$foreach(column in genTable.Columns)
|
$foreach(column in genTable.Columns)
|
||||||
$set(labelName = "")
|
$set(labelName = "")
|
||||||
$set(columnName = "")
|
$set(columnName = "")
|
||||||
|
|||||||
@ -27,9 +27,8 @@ namespace ZR.CodeGenerator
|
|||||||
|
|
||||||
if (GenConstants.inputDtoNoField.Any(f => f.Contains(dbFieldInfo.CsharpField, StringComparison.OrdinalIgnoreCase)))
|
if (GenConstants.inputDtoNoField.Any(f => f.Contains(dbFieldInfo.CsharpField, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
return sb.ToString();
|
|
||||||
}
|
}
|
||||||
if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit)
|
else if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit)
|
||||||
{
|
{
|
||||||
sb.AppendLine(" <el-col :lg=\"12\" v-if=\"opertype == 2\">");
|
sb.AppendLine(" <el-col :lg=\"12\" v-if=\"opertype == 2\">");
|
||||||
sb.AppendLine($" <el-form-item label=\"{labelName}\">{{{{form.{columnName}}}}}</el-form-item>");
|
sb.AppendLine($" <el-form-item label=\"{labelName}\">{{{{form.{columnName}}}}}</el-form-item>");
|
||||||
@ -200,36 +199,5 @@ namespace ZR.CodeGenerator
|
|||||||
return $"it => it.{ propertyName} == parm.{propertyName})";
|
return $"it => it.{ propertyName} == parm.{propertyName})";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 格式化字典数据显示到table
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="htmlType"></param>
|
|
||||||
/// <param name="columnName"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetFormatter(string htmlType, string columnName)
|
|
||||||
{
|
|
||||||
if (htmlType.Equals(GenConstants.HTML_CHECKBOX) ||
|
|
||||||
htmlType.Equals(GenConstants.HTML_SELECT) ||
|
|
||||||
htmlType.Equals(GenConstants.HTML_RADIO))
|
|
||||||
{
|
|
||||||
return $" :formatter=\"{columnName}Format\"";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 超出隐藏
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="column"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string ShowToolTip(GenTableColumn column)
|
|
||||||
{
|
|
||||||
if (column.CsharpType.Equals("string") ||
|
|
||||||
column.HtmlType.Equals(GenConstants.HTML_DATETIME))
|
|
||||||
{
|
|
||||||
return $" :show-overflow-tooltip=\"true\"";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,11 +65,6 @@ namespace ZR.CodeGenerator
|
|||||||
replaceDto.UploadFile = 1;
|
replaceDto.UploadFile = 1;
|
||||||
}
|
}
|
||||||
dbFieldInfo.CsharpFieldFl = dbFieldInfo.CsharpField.FirstLowerCase();
|
dbFieldInfo.CsharpFieldFl = dbFieldInfo.CsharpField.FirstLowerCase();
|
||||||
//CodeGenerateTemplate.GetQueryDtoProperty(dbFieldInfo, replaceDto);
|
|
||||||
|
|
||||||
replaceDto.VueViewFormHtml += CodeGenerateTemplate.TplVueFormContent(dbFieldInfo, dto.GenTable);
|
|
||||||
//replaceDto.VueViewListHtml += CodeGenerateTemplate.TplTableColumn(dbFieldInfo, dto.GenTable);
|
|
||||||
//replaceDto.VueQueryFormHtml += CodeGenerateTemplate.TplQueryFormHtml(dbFieldInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceDto.PKName = PKName;
|
replaceDto.PKName = PKName;
|
||||||
@ -78,9 +73,9 @@ namespace ZR.CodeGenerator
|
|||||||
InitJntTemplate(dto, replaceDto);
|
InitJntTemplate(dto, replaceDto);
|
||||||
replaceDto.VueViewListHtml = GenerateVueTableList();
|
replaceDto.VueViewListHtml = GenerateVueTableList();
|
||||||
replaceDto.VueQueryFormHtml = GenerateVueQueryForm();
|
replaceDto.VueQueryFormHtml = GenerateVueQueryForm();
|
||||||
|
replaceDto.VueViewFormHtml = GenerateCurdForm();
|
||||||
|
|
||||||
GenerateModels(replaceDto, dto);
|
GenerateModels(replaceDto, dto);
|
||||||
GenerateInputDto(replaceDto, dto);
|
|
||||||
GenerateRepository(replaceDto, dto);
|
GenerateRepository(replaceDto, dto);
|
||||||
GenerateService(replaceDto, dto);
|
GenerateService(replaceDto, dto);
|
||||||
GenerateControllers(replaceDto, dto);
|
GenerateControllers(replaceDto, dto);
|
||||||
@ -107,25 +102,13 @@ namespace ZR.CodeGenerator
|
|||||||
private static void GenerateModels(ReplaceDto replaceDto, GenerateDto generateDto)
|
private static void GenerateModels(ReplaceDto replaceDto, GenerateDto generateDto)
|
||||||
{
|
{
|
||||||
var tpl = FileHelper.ReadJtTemplate("TplModel.txt");
|
var tpl = FileHelper.ReadJtTemplate("TplModel.txt");
|
||||||
var result = tpl.Render();
|
var tplDto = FileHelper.ReadJtTemplate("TplDto.txt");
|
||||||
|
|
||||||
string fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, _option.ModelsNamespace, "Models", _option.SubNamespace, replaceDto.ModelTypeName + ".cs");
|
string fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, _option.ModelsNamespace, "Models", _option.SubNamespace, replaceDto.ModelTypeName + ".cs");
|
||||||
generateDto.GenCodes.Add(new GenCode(1, "Model.cs", fullPath, result));
|
string fullPathDto = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, _option.ModelsNamespace, "Dto", _option.SubNamespace, $"{replaceDto.ModelTypeName}Dto.cs");
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
generateDto.GenCodes.Add(new GenCode(1, "Model.cs", fullPath, tpl.Render()));
|
||||||
/// 生成表单提交输入参数Dto
|
generateDto.GenCodes.Add(new GenCode(2, "Dto.cs", fullPathDto, tplDto.Render()));
|
||||||
/// </summary>
|
|
||||||
/// <param name="generateDto"></param>
|
|
||||||
/// <param name="replaceDto">替换实体</param>
|
|
||||||
private static void GenerateInputDto(ReplaceDto replaceDto, GenerateDto generateDto)
|
|
||||||
{
|
|
||||||
var tpl = FileHelper.ReadJtTemplate("TplDto.txt");
|
|
||||||
|
|
||||||
var result = tpl.Render();
|
|
||||||
var fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, _option.ModelsNamespace, "Dto", _option.SubNamespace, $"{replaceDto.ModelTypeName}Dto.cs");
|
|
||||||
|
|
||||||
generateDto.GenCodes.Add(new GenCode(2, "Dto.cs", fullPath, result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -193,7 +176,6 @@ namespace ZR.CodeGenerator
|
|||||||
}
|
}
|
||||||
var tpl = FileHelper.ReadJtTemplate(fileName);
|
var tpl = FileHelper.ReadJtTemplate(fileName);
|
||||||
tpl.Set("vueQueryFormHtml", replaceDto.VueQueryFormHtml);
|
tpl.Set("vueQueryFormHtml", replaceDto.VueQueryFormHtml);
|
||||||
tpl.Set("VueViewEditFormRuleContent", replaceDto.VueViewEditFormRuleContent);//添加、修改表单验证规则
|
|
||||||
tpl.Set("VueViewFormContent", replaceDto.VueViewFormHtml);//添加、修改表单
|
tpl.Set("VueViewFormContent", replaceDto.VueViewFormHtml);//添加、修改表单
|
||||||
tpl.Set("VueViewListContent", replaceDto.VueViewListHtml);//查询 table列
|
tpl.Set("VueViewListContent", replaceDto.VueViewListHtml);//查询 table列
|
||||||
|
|
||||||
@ -227,15 +209,11 @@ namespace ZR.CodeGenerator
|
|||||||
}
|
}
|
||||||
fileName = Path.Combine("v3", fileName);
|
fileName = Path.Combine("v3", fileName);
|
||||||
var tpl = FileHelper.ReadJtTemplate(fileName);
|
var tpl = FileHelper.ReadJtTemplate(fileName);
|
||||||
//tpl.Set("vueQueryFormHtml", replaceDto.VueQueryFormHtml);
|
|
||||||
//tpl.Set("VueViewEditFormRuleContent", replaceDto.VueViewEditFormRuleContent);//添加、修改表单验证规则
|
|
||||||
//tpl.Set("VueViewFormContent", replaceDto.VueViewFormHtml);//添加、修改表单
|
|
||||||
//tpl.Set("VueViewListContent", replaceDto.VueViewListHtml);//查询 table列
|
|
||||||
|
|
||||||
var result = tpl.Render();
|
var result = tpl.Render();
|
||||||
var fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZR.Vue3", "src", "views", generateDto.GenTable.ModuleName.FirstLowerCase(), $"{generateDto.GenTable.BusinessName.FirstUpperCase()}.vue");
|
var fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZR.Vue3", "src", "views", generateDto.GenTable.ModuleName.FirstLowerCase(), $"{generateDto.GenTable.BusinessName.FirstUpperCase()}.vue");
|
||||||
//Console.WriteLine(result);
|
//Console.WriteLine(result);
|
||||||
generateDto.GenCodes.Add(new GenCode(16, "index.vue", fullPath, result));
|
generateDto.GenCodes.Add(new GenCode(16, "vue3.vue", fullPath, result));
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成vue页面api
|
/// 生成vue页面api
|
||||||
@ -297,6 +275,17 @@ namespace ZR.CodeGenerator
|
|||||||
{
|
{
|
||||||
var tpl = FileHelper.ReadJtTemplate("TableList.txt");
|
var tpl = FileHelper.ReadJtTemplate("TableList.txt");
|
||||||
var result = tpl.Render();
|
var result = tpl.Render();
|
||||||
|
//Console.WriteLine(result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 生成vue表单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GenerateCurdForm()
|
||||||
|
{
|
||||||
|
var tpl = FileHelper.ReadJtTemplate("CurdForm.txt");
|
||||||
|
var result = tpl.Render();
|
||||||
Console.WriteLine(result);
|
Console.WriteLine(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -445,7 +434,7 @@ namespace ZR.CodeGenerator
|
|||||||
IsIncrement = column.IsIdentity,
|
IsIncrement = column.IsIdentity,
|
||||||
Create_by = genTable.Create_by,
|
Create_by = genTable.Create_by,
|
||||||
Create_time = DateTime.Now,
|
Create_time = DateTime.Now,
|
||||||
IsInsert = !column.IsIdentity,//非自增字段都需要插入
|
IsInsert = !column.IsIdentity || GenConstants.inputDtoNoField.Any(f => f.Contains(column.DbColumnName, StringComparison.OrdinalIgnoreCase)),//非自增字段都需要插入
|
||||||
IsEdit = true,
|
IsEdit = true,
|
||||||
IsQuery = false,
|
IsQuery = false,
|
||||||
HtmlType = GenConstants.HTML_INPUT
|
HtmlType = GenConstants.HTML_INPUT
|
||||||
@ -520,7 +509,7 @@ namespace ZR.CodeGenerator
|
|||||||
options.Data.Set("replaceDto", replaceDto);
|
options.Data.Set("replaceDto", replaceDto);
|
||||||
options.Data.Set("options", dto.GenOptions);
|
options.Data.Set("options", dto.GenOptions);
|
||||||
options.Data.Set("genTable", dto.GenTable);
|
options.Data.Set("genTable", dto.GenTable);
|
||||||
options.Data.Set("btns", dto.CheckedBtn);
|
//options.Data.Set("btns", dto.CheckedBtn);
|
||||||
options.Data.Set("showCustomInput", showCustomInput);
|
options.Data.Set("showCustomInput", showCustomInput);
|
||||||
options.Data.Set("tool", new CodeGeneratorTool());
|
options.Data.Set("tool", new CodeGeneratorTool());
|
||||||
options.Data.Set("codeTool", new CodeGenerateTemplate());
|
options.Data.Set("codeTool", new CodeGenerateTemplate());
|
||||||
@ -528,5 +517,21 @@ namespace ZR.CodeGenerator
|
|||||||
//...其它数据
|
//...其它数据
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 模板用
|
||||||
|
/// <summary>
|
||||||
|
/// 模板用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool CheckInputDtoNoField(string str)
|
||||||
|
{
|
||||||
|
return GenConstants.inputDtoNoField.Any(f => f.Contains(str, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
public static bool CheckTree(GenTable genTable, string csharpField)
|
||||||
|
{
|
||||||
|
return (genTable.TplCategory.Equals("tree", StringComparison.OrdinalIgnoreCase) && genTable.TreeParentCode != null && csharpField.Equals(genTable.TreeParentCode));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,10 +77,10 @@ namespace ZR.CodeGenerator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="templateName">模板名称,应包括文件扩展名称。比如:template.txt</param>
|
/// <param name="templateName">模板名称,应包括文件扩展名称。比如:template.txt</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string ReadTemplate(string templateName)
|
public static string ReadTemplate(string tplName)
|
||||||
{
|
{
|
||||||
string path = Environment.CurrentDirectory;
|
string path = Environment.CurrentDirectory;
|
||||||
string fullName = $"{path}/wwwroot/CodeGenTemplate/{templateName}";
|
string fullName = Path.Combine(path, "wwwroot", "CodeGenTemplate", tplName);
|
||||||
|
|
||||||
Console.WriteLine("开始读取模板=" + fullName);
|
Console.WriteLine("开始读取模板=" + fullName);
|
||||||
string temp = fullName;
|
string temp = fullName;
|
||||||
|
|||||||
@ -39,10 +39,6 @@ namespace ZR.CodeGenerator.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string VueQueryFormHtml { get; set; }
|
public string VueQueryFormHtml { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// vue 添加、编辑表单规则
|
|
||||||
/// </summary>
|
|
||||||
public string VueViewEditFormRuleContent { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询条件
|
/// 查询条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -55,10 +55,10 @@ export default {
|
|||||||
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
|
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
|
||||||
},
|
},
|
||||||
// 添加tab页签
|
// 添加tab页签
|
||||||
openPage(title, url) {
|
openPage(title, url, params) {
|
||||||
var obj = { path: url, meta: { title: title } }
|
var obj = { path: url, meta: { title: title } }
|
||||||
store.dispatch('tagsView/addView', obj);
|
store.dispatch('tagsView/addView', obj);
|
||||||
return router.push(url);
|
return router.push({ path: url, query: params });
|
||||||
},
|
},
|
||||||
// 修改tab页签
|
// 修改tab页签
|
||||||
updatePage(obj) {
|
updatePage(obj) {
|
||||||
|
|||||||
@ -57,7 +57,7 @@ service.interceptors.response.use(res => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
} else if (code == 0 || code == 1 || code == 110 || code == 101 || code == 403 || code == 500) {
|
} else if (code == 0 || code == 1 || code == 110 || code == 101 || code == 403 || code == 500 || code == 429) {
|
||||||
Message({
|
Message({
|
||||||
message: msg,
|
message: msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@ -70,13 +70,13 @@ service.interceptors.response.use(res => {
|
|||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log('err' + error)
|
console.log('err' + error)
|
||||||
let {
|
let { message } = error;
|
||||||
message
|
|
||||||
} = error;
|
|
||||||
if (message == "Network Error") {
|
if (message == "Network Error") {
|
||||||
message = "后端接口连接异常";
|
message = "后端接口连接异常";
|
||||||
} else if (message.includes("timeout")) {
|
} else if (message.includes("timeout")) {
|
||||||
message = "系统接口请求超时";
|
message = "系统接口请求超时";
|
||||||
|
} else if (message.includes("Request failed with status code 429")) {
|
||||||
|
message = "请求过于频繁,请稍后再试";
|
||||||
} else if (message.includes("Request failed with status code")) {
|
} else if (message.includes("Request failed with status code")) {
|
||||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,24 +15,23 @@
|
|||||||
<div class="user-item-right overflow">
|
<div class="user-item-right overflow">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :xs="24" :md="24" class="right-title mb20 one-text-overflow">
|
<el-col :xs="24" :md="24" class="right-title mb20 one-text-overflow">
|
||||||
{{userInfo.welcomeMessage}},{{ userInfo.nickName }},{{ userInfo.welcomeContent }}
|
{{ userInfo.welcomeMessage }},{{ userInfo.nickName }},{{ userInfo.welcomeContent }}</el-col>
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="24" :md="24">
|
<el-col :xs="24" :sm="24" :md="24">
|
||||||
<el-col :xs="24" :md="8" class="right-l-v">
|
<el-col :xs="24" :md="8" class="right-l-v">
|
||||||
<div class="right-label">昵称:</div>
|
<div class="right-label">昵称:</div>
|
||||||
<div class="right-value">{{userInfo.nickName}}</div>
|
<div class="right-value">{{ userInfo.nickName }}</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :md="16" class="right-l-v">
|
<el-col :xs="24" :md="16" class="right-l-v">
|
||||||
<div class="right-label">身份:</div>
|
<div class="right-label">身份:</div>
|
||||||
<div class="right-value">
|
<div class="right-value">
|
||||||
<span v-for="item in userInfo.roles" :key="item.roleId">{{item.roleName}}</span>
|
<span v-for="item in userInfo.roles" :key="item.roleId">{{ item.roleName }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="24" class="mt10">
|
<el-col :md="24" class="mt10">
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="right-l-v">
|
<el-col :xs="24" :sm="12" :md="8" class="right-l-v">
|
||||||
<div class="right-label one-text-overflow">IP:</div>
|
<div class="right-label one-text-overflow">IP:</div>
|
||||||
<div class="right-value one-text-overflow">{{userInfo.loginIP}}</div>
|
<div class="right-value one-text-overflow">{{ userInfo.loginIP }}</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="16" class="right-l-v">
|
<el-col :xs="24" :sm="12" :md="16" class="right-l-v">
|
||||||
<div class="right-label one-text-overflow">时间:</div>
|
<div class="right-label one-text-overflow">时间:</div>
|
||||||
@ -41,9 +40,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="24" class="mt10">
|
<el-col :lg="24" class="mt10">
|
||||||
<el-button size="small" icon="el-icon-edit-outline">
|
<el-button size="small" icon="el-icon-edit-outline">
|
||||||
<router-link to="/user/profile">
|
<router-link to="/user/profile">修改信息</router-link>
|
||||||
修改信息
|
|
||||||
</router-link>
|
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button size="small" icon="el-icon-position" type="primary">发布活动</el-button> -->
|
<!-- <el-button size="small" icon="el-icon-position" type="primary">发布活动</el-button> -->
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -94,56 +91,55 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PanelGroup from "./dashboard/PanelGroup";
|
import PanelGroup from './dashboard/PanelGroup'
|
||||||
import LineChart from "./dashboard/LineChart";
|
import LineChart from './dashboard/LineChart'
|
||||||
import RaddarChart from "./dashboard/RaddarChart";
|
import RaddarChart from './dashboard/RaddarChart'
|
||||||
import PieChart from "./dashboard/PieChart";
|
import PieChart from './dashboard/PieChart'
|
||||||
import BarChart from "./dashboard/BarChart";
|
import BarChart from './dashboard/BarChart'
|
||||||
import Scroll from "vue-seamless-scroll";
|
import Scroll from 'vue-seamless-scroll'
|
||||||
import { listNewArticle } from "@/api/system/article.js";
|
import { listNewArticle } from '@/api/system/article.js'
|
||||||
|
|
||||||
const lineChartData = {
|
const lineChartData = {
|
||||||
newVisitis: {
|
newVisitis: {
|
||||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 145],
|
actualData: [120, 82, 91, 154, 162, 140, 145]
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||||
actualData: [180, 160, 151, 106, 145, 150, 130],
|
actualData: [180, 160, 151, 106, 145, 150, 130]
|
||||||
},
|
},
|
||||||
purchases: {
|
purchases: {
|
||||||
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
||||||
actualData: [120, 90, 100, 138, 142, 130, 130],
|
actualData: [120, 90, 100, 138, 142, 130, 130]
|
||||||
},
|
},
|
||||||
shoppings: {
|
shoppings: {
|
||||||
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 130],
|
actualData: [120, 82, 91, 154, 162, 140, 130]
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
export default {
|
export default {
|
||||||
name: "Index",
|
name: 'Index',
|
||||||
components: {
|
components: {
|
||||||
PanelGroup,
|
PanelGroup,
|
||||||
LineChart,
|
LineChart,
|
||||||
RaddarChart,
|
RaddarChart,
|
||||||
PieChart,
|
PieChart,
|
||||||
BarChart,
|
BarChart,
|
||||||
Scroll,
|
Scroll
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
photo() {
|
photo() {
|
||||||
return this.$store.getters.photo;
|
return this.$store.getters.photo
|
||||||
},
|
},
|
||||||
userInfo() {
|
userInfo() {
|
||||||
return this.$store.getters.userinfo;
|
return this.$store.getters.userinfo
|
||||||
},
|
},
|
||||||
currentTime() {
|
currentTime() {
|
||||||
return this.parseTime(new Date());
|
return this.parseTime(new Date())
|
||||||
},
|
},
|
||||||
optionSingleHeight() {
|
optionSingleHeight() {
|
||||||
return {
|
return {
|
||||||
@ -154,28 +150,28 @@ export default {
|
|||||||
openWatch: true, // 开启数据实时监控刷新dom
|
openWatch: true, // 开启数据实时监控刷新dom
|
||||||
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
|
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
|
||||||
singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
|
singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
|
||||||
waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
|
waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
|
||||||
};
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lineChartData: lineChartData.newVisitis,
|
lineChartData: lineChartData.newVisitis,
|
||||||
newArticleList: [],
|
newArticleList: []
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
listNewArticle().then((res) => {
|
listNewArticle().then((res) => {
|
||||||
this.newArticleList = res.data;
|
this.newArticleList = res.data
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSetLineChartData(type) {
|
handleSetLineChartData(type) {
|
||||||
this.lineChartData = lineChartData[type];
|
this.lineChartData = lineChartData[type]
|
||||||
},
|
},
|
||||||
onOpenGitee() {},
|
onOpenGitee() {}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -6,41 +6,36 @@ SET FOREIGN_KEY_CHECKS = 0;
|
|||||||
-- Table structure for Sys_TasksQz
|
-- Table structure for Sys_TasksQz
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `sys_tasksQz`;
|
DROP TABLE IF EXISTS `sys_tasksQz`;
|
||||||
CREATE TABLE `Sys_TasksQz` (
|
CREATE TABLE `sys_tasksQz` (
|
||||||
`id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'UID',
|
`ID` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'UID',
|
||||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称',
|
`Name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称',
|
||||||
`jobGroup` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务分组',
|
`JobGroup` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务分组',
|
||||||
`cron` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '运行时间表达式',
|
`Cron` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运行时间表达式',
|
||||||
`assemblyName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序集名称',
|
`AssemblyName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序集名称',
|
||||||
`className` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务所在类',
|
`ClassName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务所在类',
|
||||||
`remark` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '任务描述',
|
`Remark` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '任务描述',
|
||||||
`runTimes` int(11) NOT NULL COMMENT '执行次数',
|
`RunTimes` int(11) NOT NULL COMMENT '执行次数',
|
||||||
`beginTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
|
`BeginTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
|
||||||
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
|
`EndTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
`triggerType` int(11) NOT NULL COMMENT '触发器类型(0、simple 1、cron)',
|
`TriggerType` int(11) NOT NULL COMMENT '触发器类型(0、simple 1、cron)',
|
||||||
`intervalSecond` int(11) NOT NULL COMMENT '执行间隔时间(单位:秒)',
|
`IntervalSecond` int(11) NOT NULL COMMENT '执行间隔时间(单位:秒)',
|
||||||
`isStart` tinyint(4) NOT NULL COMMENT '是否启动',
|
`IsStart` tinyint(4) NOT NULL COMMENT '是否启动',
|
||||||
`jobParams` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '传入参数',
|
`JobParams` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '传入参数',
|
||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '最后更新时间',
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '最后更新时间',
|
||||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人编码',
|
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人编码',
|
||||||
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人编码',
|
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人编码',
|
||||||
`lastRunTime` datetime(0) NULL DEFAULT NULL COMMENT '最后执行时间',
|
`lastRunTime` datetime(0) NULL DEFAULT NULL COMMENT '最后执行时间',
|
||||||
`apiUrl` varchar(200) NULL DEFAULT NULL COMMENT '网络请求地址',
|
`apiUrl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'api执行地址',
|
||||||
`taskType` int(11) NULL DEFAULT NULL COMMENT '任务类型1程序集 2网络请求'
|
`taskType` int(4) NULL DEFAULT 1 COMMENT '任务类型1程序集任务 2网络请求',
|
||||||
PRIMARY KEY (`ID`) USING BTREE
|
PRIMARY KEY (`ID`) USING BTREE
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '计划任务' ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '计划任务' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of Sys_TasksQz
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_tasksQz` VALUES ('1410905433996136448', '测试任务', 'SYSTEM', '0 0/10 * * * ? ', 'ZR.Tasks', 'TaskScheduler.Job_SyncTest', NULL, 0, '2021-07-02 18:17:31', '9999-12-31 00:00:00', 1, 1, 1, NULL, '2021-07-02 18:17:23', '2021-07-02 18:17:31', 'admin', NULL, NULL);
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_Tasks_log
|
-- Table structure for sys_Tasks_log
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `sys_Tasks_log`;
|
DROP TABLE IF EXISTS `sys_tasks_log`;
|
||||||
CREATE TABLE `sys_Tasks_log` (
|
CREATE TABLE `sys_tasks_log` (
|
||||||
`jobLogId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务日志ID',
|
`jobLogId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务日志ID',
|
||||||
`jobId` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '任务id',
|
`jobId` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '任务id',
|
||||||
`jobName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '任务名称',
|
`jobName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '任务名称',
|
||||||
@ -148,7 +143,7 @@ INSERT INTO `sys_dict_data` VALUES (15, 2, '公告', '2', 'sys_notice_type', '',
|
|||||||
INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '正常状态');
|
INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '正常状态');
|
||||||
INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '关闭状态');
|
INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '关闭状态');
|
||||||
INSERT INTO `sys_dict_data` VALUES (18, 0, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '其他操作');
|
INSERT INTO `sys_dict_data` VALUES (18, 0, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '其他操作');
|
||||||
INSERT INTO `sys_dict_data` VALUES (18, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '新增操作');
|
INSERT INTO `sys_dict_data` VALUES (31, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '新增操作');
|
||||||
INSERT INTO `sys_dict_data` VALUES (19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '修改操作');
|
INSERT INTO `sys_dict_data` VALUES (19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '修改操作');
|
||||||
INSERT INTO `sys_dict_data` VALUES (20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '删除操作');
|
INSERT INTO `sys_dict_data` VALUES (20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '删除操作');
|
||||||
INSERT INTO `sys_dict_data` VALUES (21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '授权操作');
|
INSERT INTO `sys_dict_data` VALUES (21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2021-02-24 10:56:22', '', NULL, '授权操作');
|
||||||
|
|||||||
@ -29,7 +29,7 @@ CREATE TABLE sys_tasksQz
|
|||||||
apiUrl varchar(200) --网络请求地址
|
apiUrl varchar(200) --网络请求地址
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
INSERT INTO sys_tasksQz VALUES ('1410905433996136448', '测试任务', 'SYSTEM', '0 0/10 * * * ? ', 'ZR.Tasks', 'TaskScheduler.Job_SyncTest', NULL, 0, '2021-07-02 18:17:31', '9999-12-31 00:00:00', 1, 1, 1, NULL, '2021-07-02 18:17:23', '2021-07-02 18:17:31', 'admin', NULL, NULL);
|
INSERT INTO sys_tasksQz VALUES ('1410905433996136448', '测试任务', 'SYSTEM', '0 0/10 * * * ? ', 'ZR.Tasks', 'TaskScheduler.Job_SyncTest', NULL, 0, '2021-07-02 18:17:31', '9999-12-31 00:00:00', 1, 1, 1, NULL, '2021-07-02 18:17:23', '2021-07-02 18:17:31', 'admin', NULL, NULL, 1, '');
|
||||||
GO
|
GO
|
||||||
if OBJECT_ID(N'sys_Tasks_log',N'U') is not NULL DROP TABLE sys_Tasks_log
|
if OBJECT_ID(N'sys_Tasks_log',N'U') is not NULL DROP TABLE sys_Tasks_log
|
||||||
GO
|
GO
|
||||||
@ -488,8 +488,8 @@ GO
|
|||||||
IF OBJECT_ID(N'sys_role_dept',N'U') is not NULL DROP TABLE sys_role_dept
|
IF OBJECT_ID(N'sys_role_dept',N'U') is not NULL DROP TABLE sys_role_dept
|
||||||
GO
|
GO
|
||||||
CREATE TABLE sys_role_dept (
|
CREATE TABLE sys_role_dept (
|
||||||
roleId bigint(20) NOT NULL, -- '角色ID',
|
roleId bigint NOT NULL, -- '角色ID',
|
||||||
deptId bigint(20) NOT NULL , -- '部门ID',
|
deptId bigint NOT NULL , -- '部门ID',
|
||||||
)
|
)
|
||||||
|
|
||||||
GO
|
GO
|
||||||
@ -643,9 +643,6 @@ create table gen_table (
|
|||||||
dbName VARCHAR(100) , --数据库名
|
dbName VARCHAR(100) , --数据库名
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
INSERT INTO [dbo].[gen_table]([tableId], [tableName], [tableComment], [subTableName], [subTableFkName], [className], [tplCategory], [baseNameSpace], [moduleName], [businessName], [functionName], [functionAuthor], [genType], [genPath], [options], [create_by], [create_time], [update_by], [update_Time], [remark], [dbName])
|
|
||||||
VALUES (1, 'gen_demo', 'demo', NULL, NULL, 'Gendemo', 'crud', 'ZR.', 'business', 'Gendemo', '演示', 'zr', '0', '/', '{"parentMenuId":null,"sortField":"","sortType":"asc"}', 'admin', '2021-12-20 21:47:45.797', 'admin', '2021-12-20 21:49:39.503', NULL, 'ZrAdmin');
|
|
||||||
GO
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 代码生成业务表字段
|
-- 代码生成业务表字段
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -678,18 +675,6 @@ create table gen_table_column (
|
|||||||
remark VARCHAR(200)
|
remark VARCHAR(200)
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1, 1, 'gen_demo', 'id', '', 'int', 'int', 'Id', 1, 1, 1, 0, 0, 1, 0, 'EQ', 'input', '', 0, 'admin', '2021-12-20 21:47:46.187', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (2, 1, 'gen_demo', 'name', '', 'varchar', 'string', 'Name', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'input', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (3, 1, 'gen_demo', 'icon', '', 'varchar', 'string', 'Icon', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'imageUpload', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (4, 1, 'gen_demo', 'showStatus', '', 'int', 'int', 'ShowStatus', 0, 0, 1, 1, 1, 1, 0, 'EQ', 'radio', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (5, 1, 'gen_demo', 'addTime', '', 'datetime', 'DateTime', 'AddTime', 0, 0, 0, 1, 1, 1, 0, 'BETWEEN', 'datetime', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (6, 1, 'gen_demo', 'sex', '', 'int', 'int', 'Sex', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'select', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (7, 1, 'gen_demo', 'sort', '', 'int', 'int', 'Sort', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'input', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (8, 1, 'gen_demo', 'beginTime', '', 'datetime', 'DateTime', 'BeginTime', 0, 0, 0, 1, 1, 1, 0, 'BETWEEN', 'datetime', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (9, 1, 'gen_demo', 'endTime', '', 'datetime', 'DateTime', 'EndTime', 0, 0, 0, 1, 1, 1, 0, 'BETWEEN', 'datetime', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (10, 1, 'gen_demo', 'remark', '', 'varchar', 'string', 'Remark', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'input', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
INSERT INTO [dbo].[gen_table_column]([columnId], [tableId], [tableName], [columnName], [columnComment], [columnType], [csharpType], [csharpField], [isPk], [isIncrement], [isRequired], [isInsert], [isEdit], [isList], [isQuery], [queryType], [htmlType], [dictType], [sort], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (11, 1, 'gen_demo', 'feature', '', 'varchar', 'string', 'Feature', 0, 0, 0, 1, 1, 1, 0, 'EQ', 'input', '', 0, 'admin', '2021-12-20 21:47:46.190', NULL, NULL, NULL);
|
|
||||||
GO
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 参数配置表
|
-- 参数配置表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user