diff --git a/OpenAuth.App/SysPrinterPlanApp/Request/AddOrUpdateSysPrinterPlanReq.cs b/OpenAuth.App/SysPrinterPlanApp/Request/AddOrUpdateSysPrinterPlanReq.cs
new file mode 100644
index 00000000..3f393aa7
--- /dev/null
+++ b/OpenAuth.App/SysPrinterPlanApp/Request/AddOrUpdateSysPrinterPlanReq.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// This code was generated by a CodeSmith Template.
+//
+// DO NOT MODIFY contents of this file. Changes to this
+// file will be lost if the code is regenerated.
+// Author:Yubao Li
+//------------------------------------------------------------------------------
+using System;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations.Schema;
+using OpenAuth.Repository.Core;
+
+namespace OpenAuth.App.Request
+{
+ ///
+ ///
+ ///
+
+ public class AddOrUpdateSysPrinterPlanReq
+ {
+ ///
+ ///方案名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ ///方案ID
+ ///
+ public string Id { get; set; }
+
+ ///
+ ///创建人
+ ///
+ public string CreateUser { get; set; }
+
+ ///
+ ///数据源;打印方案对应的数据来源SQL
+ ///
+ public string SourceSql { get; set; }
+
+ ///
+ ///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
+ ///
+ public string CloumnView { get; set; }
+
+ ///
+ ///打印方案内容;打印方案JSON对象
+ ///
+ public string PlanContent { get; set; }
+
+ ///
+ ///创建日期
+ ///
+ public DateTime CreateTime { get; set; }
+
+ ///
+ ///是否可用
+ ///
+ public bool Disable { get; set; }
+
+
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.App/SysPrinterPlanApp/Request/QuerySysPrinterPlanListReq.cs b/OpenAuth.App/SysPrinterPlanApp/Request/QuerySysPrinterPlanListReq.cs
new file mode 100644
index 00000000..da65a7a5
--- /dev/null
+++ b/OpenAuth.App/SysPrinterPlanApp/Request/QuerySysPrinterPlanListReq.cs
@@ -0,0 +1,7 @@
+namespace OpenAuth.App.Request
+{
+ public class QuerySysPrinterPlanListReq : PageReq
+ {
+
+ }
+}
diff --git a/OpenAuth.App/SysPrinterPlanApp/SysPrinterPlanApp.cs b/OpenAuth.App/SysPrinterPlanApp/SysPrinterPlanApp.cs
new file mode 100644
index 00000000..2fed2f57
--- /dev/null
+++ b/OpenAuth.App/SysPrinterPlanApp/SysPrinterPlanApp.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Infrastructure;
+using Microsoft.EntityFrameworkCore;
+using OpenAuth.App.Interface;
+using OpenAuth.App.Request;
+using OpenAuth.App.Response;
+using OpenAuth.Repository;
+using OpenAuth.Repository.Domain;
+using OpenAuth.Repository.Interface;
+
+
+namespace OpenAuth.App
+{
+ public class SysPrinterPlanApp : BaseStringApp
+ {
+ ///
+ /// 加载列表
+ ///
+ public async Task Load(QuerySysPrinterPlanListReq request)
+ {
+ var loginContext = _auth.GetCurrentUser();
+ if (loginContext == null)
+ {
+ throw new CommonException("登录已过期", Define.INVALID_TOKEN);
+ }
+
+ var columnFields = loginContext.GetTableColumns("SysPrinterPlan");
+ if (columnFields == null || columnFields.Count == 0)
+ {
+ throw new Exception("请在代码生成界面配置SysPrinterPlan表的字段属性");
+ }
+
+ var result = new TableData();
+ var objs = GetDataPrivilege("u");
+ if (!string.IsNullOrEmpty(request.key))
+ {
+ //增加筛选条件,如:
+ objs = objs.Where(u => u.Name.Contains(request.key));
+ }
+
+ var propertyStr = string.Join(',', columnFields.Select(u => u.ColumnName));
+ result.columnFields = columnFields;
+ result.data = objs.OrderBy(u => u.Id)
+ .Skip((request.page - 1) * request.limit)
+ .Take(request.limit).Select($"new ({propertyStr})");
+ result.count = await objs.CountAsync();
+ return result;
+ }
+
+ public void Add(AddOrUpdateSysPrinterPlanReq obj)
+ {
+ //程序类型取入口应用的名称,可以根据自己需要调整
+ var addObj = obj.MapTo();
+ //addObj.Time = DateTime.Now;
+ Repository.Add(addObj);
+ }
+
+ public void Update(AddOrUpdateSysPrinterPlanReq obj)
+ {
+ UnitWork.Update(u => u.Id == obj.Id, u => new SysPrinterPlan
+ {
+ Name = obj.Name,
+ SourceSql = obj.SourceSql,
+ PlanContent = obj.PlanContent
+ });
+ }
+
+ public SysPrinterPlanApp(IUnitWork unitWork,
+ IRepository repository, IAuth auth) : base(unitWork, repository, auth)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.Repository/Domain/SysPrinterPlan.cs b/OpenAuth.Repository/Domain/SysPrinterPlan.cs
new file mode 100644
index 00000000..32e66864
--- /dev/null
+++ b/OpenAuth.Repository/Domain/SysPrinterPlan.cs
@@ -0,0 +1,75 @@
+//------------------------------------------------------------------------------
+// This code was generated by a CodeSmith Template.
+//
+// DO NOT MODIFY contents of this file. Changes to this
+// file will be lost if the code is regenerated.
+// Author:Yubao Li
+//------------------------------------------------------------------------------
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations.Schema;
+using OpenAuth.Repository.Core;
+
+namespace OpenAuth.Repository.Domain
+{
+ ///
+ ///
+ ///
+ [Table("SysPrinterPlan")]
+ public class SysPrinterPlan : StringEntity
+ {
+ public SysPrinterPlan()
+ {
+ this.Name = "";
+ this.CreateUser = "";
+ this.SourceSql = "";
+ this.CloumnView = "";
+ this.PlanContent = "";
+ this.CreateTime = DateTime.Now;
+ this.Disable = false;
+ }
+
+ ///
+ ///方案名称
+ ///
+ [Description("方案名称")]
+ public string Name { get; set; }
+
+ ///
+ ///创建人
+ ///
+ [Description("创建人")]
+ public string CreateUser { get; set; }
+
+ ///
+ ///数据源;打印方案对应的数据来源SQL
+ ///
+ [Description("数据源;打印方案对应的数据来源SQL")]
+ public string SourceSql { get; set; }
+
+ ///
+ ///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
+ ///
+ [Description("中文视图名;设计打印方案时,提供中文快捷按钮的视图来源")]
+ public string CloumnView { get; set; }
+
+ ///
+ ///打印方案内容;打印方案JSON对象
+ ///
+ [Description("打印方案内容;打印方案JSON对象")]
+ public string PlanContent { get; set; }
+
+ ///
+ ///创建日期
+ ///
+ [Description("创建日期")]
+ public DateTime CreateTime { get; set; }
+
+ ///
+ ///是否可用
+ ///
+ [Description("是否可用")]
+ public bool Disable { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.Repository/OpenAuthDBContext.cs b/OpenAuth.Repository/OpenAuthDBContext.cs
index 03119bca..3ee8af03 100644
--- a/OpenAuth.Repository/OpenAuthDBContext.cs
+++ b/OpenAuth.Repository/OpenAuthDBContext.cs
@@ -1,124 +1,124 @@
-using System;
-using System.Linq;
-
-using Infrastructure;
-using Infrastructure.Extensions;
-using Infrastructure.Utilities;
-
-using Microsoft.AspNetCore.Http;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-using OpenAuth.Repository.Domain;
-using OpenAuth.Repository.QueryObj;
-
-namespace OpenAuth.Repository
-{
-
- public partial class OpenAuthDBContext : DbContext
- {
-
- private ILoggerFactory _LoggerFactory;
- private IHttpContextAccessor _httpContextAccessor;
- private IConfiguration _configuration;
- private IOptions _appConfiguration;
-
- public OpenAuthDBContext(DbContextOptions options, ILoggerFactory loggerFactory,
- IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IOptions appConfiguration)
- : base(options)
- {
- _LoggerFactory = loggerFactory;
- _httpContextAccessor = httpContextAccessor;
- _configuration = configuration;
- _appConfiguration = appConfiguration;
- }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.EnableSensitiveDataLogging(true); //允许打印参数
- optionsBuilder.UseLoggerFactory(_LoggerFactory);
- InitTenant(optionsBuilder);
- base.OnConfiguring(optionsBuilder);
- }
-
- //初始化多租户信息,根据租户id调整数据库
- private void InitTenant(DbContextOptionsBuilder optionsBuilder)
- {
-
- var tenantId = _httpContextAccessor.GetTenantId();
- string connect = _configuration.GetConnectionString(tenantId);
- if(string.IsNullOrEmpty(connect))
- {
- throw new Exception($"未能找到租户{tenantId}对应的连接字符串信息");
- }
-
- //这个地方如果用IOption,在单元测试的时候会获取不到AppSetting的值😅
- var dbtypes = _configuration.GetSection("AppSetting:DbTypes").GetChildren()
- .ToDictionary(x => x.Key, x => x.Value);
-
- var dbType = dbtypes[tenantId];
- if(dbType == Define.DBTYPE_SQLSERVER)
- {
- optionsBuilder.UseSqlServer(connect);
- }
- else if(dbType == Define.DBTYPE_MYSQL) //mysql
- {
- optionsBuilder.UseMySql(connect, new MySqlServerVersion(new Version(8, 0, 11)));
- }
- else if(dbType == Define.DBTYPE_PostgreSQL) //PostgreSQL
- {
- optionsBuilder.UseNpgsql(connect);
- }
- else
- {
- optionsBuilder.UseOracle(connect, options => options.UseOracleSQLCompatibility("11"));
- }
-
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity()
- .HasKey(c => new { c.Id });
- modelBuilder.Entity().HasNoKey();
- modelBuilder.Entity().HasNoKey();
- }
-
- public virtual DbSet Applications { get; set; }
- public virtual DbSet Categories { get; set; }
- public virtual DbSet CategoryTypes { get; set; }
- public virtual DbSet FlowInstances { get; set; }
- public virtual DbSet FlowInstanceOperationHistorys { get; set; }
- public virtual DbSet FlowInstanceTransitionHistorys { get; set; }
- public virtual DbSet FlowSchemes { get; set; }
- public virtual DbSet