整体调整
parent
10b04071d9
commit
1794ed9696
|
|
@ -1,10 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace OpenAuth.App.Request
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryAppListReq : PageReq
|
||||
{
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
using Infrastructure;
|
||||
using OpenAuth.Auth.AuthStrategies;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.Repository;
|
||||
using SqlSugar;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Http;
|
|||
using Microsoft.Extensions.DependencyModel;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.Repository;
|
||||
using SqlSugar;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,122 +0,0 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using OpenAuth.App.FormScheme.FormHelpers;
|
||||
using OpenAuth.App.Interface;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.App.BaseApp.Base
|
||||
{
|
||||
public abstract class SqlSugarBaseApp<T, TDbContext>
|
||||
where T : class, new()
|
||||
where TDbContext : SugarUnitOfWork, new()
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用于普通的数据库操作
|
||||
/// </summary>
|
||||
protected ISimpleClient<T> Repository;
|
||||
/// <summary>
|
||||
/// 用于事务操作
|
||||
/// </summary>
|
||||
protected ISugarUnitOfWork<TDbContext> UnitWork;
|
||||
|
||||
protected IAuth _auth;
|
||||
|
||||
|
||||
public SqlSugarBaseApp(ISugarUnitOfWork<TDbContext> unitWork, ISimpleClient<T> repository, IAuth auth)
|
||||
{
|
||||
UnitWork = unitWork;
|
||||
Repository = repository;
|
||||
_auth = auth;
|
||||
}
|
||||
|
||||
public SqlSugarClient CodeClient(string code, IConfiguration config)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code) || code == "hcsystemdb")
|
||||
{
|
||||
return new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = SqlSugar.DbType.PostgreSQL,
|
||||
ConnectionString = config.GetConnectionString("OpenAuthDBContext"),
|
||||
IsAutoCloseConnection = true,
|
||||
MoreSettings = new SqlSugar.ConnMoreSettings()
|
||||
{
|
||||
//PgSqlIsAutoToLower = false,
|
||||
//PgSqlIsAutoToLowerCodeFirst = false,
|
||||
IsAutoToUpper = false,
|
||||
|
||||
DatabaseModel = DbType.PostgreSQL
|
||||
}
|
||||
},
|
||||
db =>
|
||||
{
|
||||
//单例参数配置,所有上下文生效
|
||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
//Console.WriteLine(sql + "\r\n" +
|
||||
//db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
//Console.WriteLine();
|
||||
};
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var link = UnitWork.Db.Queryable<Repository.Domain.SysDatabaseLink>().Where(r => r.DBName == code).First();
|
||||
if (link != null)
|
||||
{
|
||||
return new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DBCommonHelper.GetDbType(link.DBType),
|
||||
ConnectionString = link.DBConnection,
|
||||
IsAutoCloseConnection = true,
|
||||
MoreSettings = new SqlSugar.ConnMoreSettings()
|
||||
{
|
||||
//PgSqlIsAutoToLower = false,
|
||||
//PgSqlIsAutoToLowerCodeFirst = false,
|
||||
IsAutoToUpper = false,
|
||||
|
||||
DatabaseModel = DbType.PostgreSQL
|
||||
}
|
||||
},
|
||||
db =>
|
||||
{
|
||||
//单例参数配置,所有上下文生效
|
||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
//Console.WriteLine(sql + "\r\n" +
|
||||
//db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
//Console.WriteLine();
|
||||
};
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("此编码找不到对应数据库:" + code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SqlSugarClient TestLinkClient(string conn, string dbtype)
|
||||
{
|
||||
var client = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DBCommonHelper.GetDbType(dbtype),
|
||||
ConnectionString = conn,
|
||||
IsAutoCloseConnection = true,
|
||||
MoreSettings = new SqlSugar.ConnMoreSettings()
|
||||
{
|
||||
IsAutoToUpper = false,
|
||||
DatabaseModel = DbType.PostgreSQL
|
||||
}
|
||||
},
|
||||
db =>
|
||||
{
|
||||
//单例参数配置,所有上下文生效
|
||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
};
|
||||
});
|
||||
return client;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.CodeTable;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.FormScheme.FormHelpers;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using static Dm.net.buffer.ByteArrayBuffer;
|
||||
|
||||
namespace OpenAuth.App.DbTable
|
||||
{
|
||||
public class DbTableApp : SqlSugarBaseApp<Repository.Domain.DbCodeTable, SugarDbContext>
|
||||
{
|
||||
private IConfiguration _configuration;
|
||||
public DbTableApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<Repository.Domain.DbCodeTable> repository, IConfiguration configuration) : base(unitWork, repository, null)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表信息
|
||||
/// </summary>
|
||||
/// <param name="dbcode">数据库编码</param>
|
||||
/// <param name="dbTableReq">数据表信息</param>
|
||||
/// <returns></returns>
|
||||
public Response<bool> AddTable(string dbcode, DbTableReq dbTableReq)
|
||||
{
|
||||
if (dbTableReq.DbColumnInfoList == null || !dbTableReq.DbColumnInfoList.Any())
|
||||
throw new Exception("请添加数据列");
|
||||
using (var db = this.CodeClient(dbcode, _configuration))
|
||||
{
|
||||
var typeBuilder = db.DynamicBuilder().CreateClass(dbTableReq.TableName, new SugarTable() { TableName = dbTableReq.TableName, TableDescription = dbTableReq.Description });
|
||||
dbTableReq.DbColumnInfoList.ForEach(u =>
|
||||
{
|
||||
typeBuilder.CreateProperty(u.DbColumnName, typeof(string), new SugarColumn()
|
||||
{
|
||||
IsPrimaryKey = u.IsPrimarykey == 1,
|
||||
IsIdentity = u.IsIdentity == 1,
|
||||
ColumnDataType = u.DataType,
|
||||
Length = u.Length,
|
||||
IsNullable = u.IsNullable == 1,
|
||||
DecimalDigits = u.DecimalDigits,
|
||||
ColumnDescription = u.ColumnDescription,
|
||||
});
|
||||
});
|
||||
db.CodeFirst.InitTables(typeBuilder.BuilderType());
|
||||
return new Response<bool>()
|
||||
{
|
||||
Code = 200,
|
||||
Result = true,
|
||||
Message = "创建成功"
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建字段
|
||||
/// </summary>
|
||||
/// <param name="dbcode">数据库编码</param>
|
||||
/// <param name="dbColumnInput">表字段</param>
|
||||
/// <returns></returns>
|
||||
public Response<bool> AddColumn(string dbcode, DbColumnInput dbColumnInput)
|
||||
{
|
||||
using (var db = this.CodeClient(dbcode, _configuration))
|
||||
{
|
||||
var column = new DbColumnInfo
|
||||
{
|
||||
ColumnDescription = dbColumnInput.ColumnDescription,
|
||||
DbColumnName = dbColumnInput.DbColumnName,
|
||||
IsIdentity = dbColumnInput.IsIdentity == 1,
|
||||
IsNullable = dbColumnInput.IsNullable == 1,
|
||||
IsPrimarykey = dbColumnInput.IsPrimarykey == 1,
|
||||
Length = dbColumnInput.Length,
|
||||
DecimalDigits = dbColumnInput.DecimalDigits,
|
||||
DataType = dbColumnInput.DataType
|
||||
};
|
||||
|
||||
db.DbMaintenance.AddColumn(dbColumnInput.TableName, column);
|
||||
db.DbMaintenance.AddColumnRemark(dbColumnInput.DbColumnName, dbColumnInput.TableName, dbColumnInput.ColumnDescription);
|
||||
if (column.IsPrimarykey)
|
||||
db.DbMaintenance.AddPrimaryKey(dbColumnInput.TableName, dbColumnInput.DbColumnName);
|
||||
return new Response<bool>()
|
||||
{
|
||||
Code = 200,
|
||||
Result = true,
|
||||
Message = "创建成功"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
using Infrastructure;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using Utils.Web.Model;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -3,14 +3,15 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace OpenAuth.App.Request
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryCategoryListReq : PageReq
|
||||
{
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace OpenAuth.App.Request
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryCategoryTypeListReq : PageReq
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
|
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.CodeTable
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using Infrastructure.Extensions;
|
|||
using Infrastructure.Utilities;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NUnit.Framework;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.FormScheme.FormHelpers;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
|
@ -14,7 +14,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
|
||||
|
||||
namespace OpenAuth.App.CodeTable
|
||||
|
|
@ -84,12 +84,13 @@ namespace OpenAuth.App.CodeTable
|
|||
/// <returns></returns>
|
||||
public List<DbColumnInfo> GetTableColumnList(string code, string tableName)
|
||||
{
|
||||
using (var db = this.CodeClient(code, _configuration))
|
||||
{
|
||||
//var list= this.Repository.AsSugarClient().DbMaintenance.GetTableInfoList(isCache);
|
||||
var list = db.DbMaintenance.GetColumnInfosByTableName(tableName,false);
|
||||
return list;
|
||||
}
|
||||
//using (var db = this.CodeClient(code, _configuration))
|
||||
//{
|
||||
// //var list= this.Repository.AsSugarClient().DbMaintenance.GetTableInfoList(isCache);
|
||||
// var list = db.DbMaintenance.GetColumnInfosByTableName(tableName,false);
|
||||
// return list;
|
||||
//}
|
||||
return null;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -242,36 +243,36 @@ namespace OpenAuth.App.CodeTable
|
|||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public List<dynamic> GetTableAndViewColumnList(string dbCode, string tableName)
|
||||
{
|
||||
using (var db = this.CodeClient(dbCode, _configuration))
|
||||
{
|
||||
string query = $@"
|
||||
SELECT
|
||||
c.column_name,
|
||||
d.description
|
||||
FROM
|
||||
information_schema.columns c
|
||||
LEFT JOIN
|
||||
pg_catalog.pg_class t ON t.relname = c.table_name
|
||||
LEFT JOIN
|
||||
pg_catalog.pg_attribute a ON a.attnum > 0
|
||||
AND a.attrelid = t.oid
|
||||
AND a.attname = c.column_name
|
||||
LEFT JOIN
|
||||
pg_catalog.pg_namespace n ON n.oid = t.relnamespace
|
||||
LEFT JOIN
|
||||
pg_catalog.pg_description d ON d.objoid = a.attrelid
|
||||
AND d.objsubid = a.attnum
|
||||
WHERE
|
||||
c.table_name = @tableName
|
||||
AND c.table_schema = 'public';";
|
||||
// 执行查询并获取结果
|
||||
var viewColumns = db.Ado.SqlQuery<dynamic>(query, new { tableName = tableName });
|
||||
return viewColumns;
|
||||
}
|
||||
//public List<dynamic> GetTableAndViewColumnList(string dbCode, string tableName)
|
||||
//{
|
||||
// using (var db = this.CodeClient(dbCode, _configuration))
|
||||
// {
|
||||
// string query = $@"
|
||||
// SELECT
|
||||
// c.column_name,
|
||||
// d.description
|
||||
// FROM
|
||||
// information_schema.columns c
|
||||
// LEFT JOIN
|
||||
// pg_catalog.pg_class t ON t.relname = c.table_name
|
||||
// LEFT JOIN
|
||||
// pg_catalog.pg_attribute a ON a.attnum > 0
|
||||
// AND a.attrelid = t.oid
|
||||
// AND a.attname = c.column_name
|
||||
// LEFT JOIN
|
||||
// pg_catalog.pg_namespace n ON n.oid = t.relnamespace
|
||||
// LEFT JOIN
|
||||
// pg_catalog.pg_description d ON d.objoid = a.attrelid
|
||||
// AND d.objsubid = a.attnum
|
||||
// WHERE
|
||||
// c.table_name = @tableName
|
||||
// AND c.table_schema = 'public';";
|
||||
// // 执行查询并获取结果
|
||||
// var viewColumns = db.Ado.SqlQuery<dynamic>(query, new { tableName = tableName });
|
||||
// return viewColumns;
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.App.Common
|
||||
{
|
||||
public class CommonData
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行cmd命令
|
||||
/// </summary>
|
||||
/// <param name="strDir"></param>
|
||||
/// <param name="_path"></param>
|
||||
public static void ExeCmdProcess(string strDir, string _path)
|
||||
{
|
||||
Process p = new Process();
|
||||
p.StartInfo.FileName = "cmd.exe ";
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardInput = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
p.StartInfo.CreateNoWindow = false;
|
||||
|
||||
//指定执行程序的目录
|
||||
p.StartInfo.WorkingDirectory = _path;
|
||||
//开始执行
|
||||
p.Start();
|
||||
//Console.WriteLine("command:" + strInput);
|
||||
p.StandardInput.WriteLine(strDir.ToString() + "&exit");
|
||||
|
||||
//执行结果返回
|
||||
string output = p.StandardOutput.ReadToEnd();
|
||||
|
||||
//等待执行完成
|
||||
p.WaitForExit();
|
||||
|
||||
//关闭程序
|
||||
p.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
namespace OpenAuth.App.Common
|
||||
{
|
||||
public struct TubanZhuanTi {
|
||||
|
||||
public const string weifayongdi = "Subject_WFYD";
|
||||
public const string feifacaikuang = "Subject_FFCK";
|
||||
public const string zhongdianwenti1 = "Subject_ZDWT1";
|
||||
public const string zhongdianwenti2 = "Subject_ZDWT2";
|
||||
public const string gdflh = "Subject_GDFLH";
|
||||
public const string wfydwp = "Subject_WPWF";
|
||||
public const string xcsj = "Subject_XCSJ";
|
||||
public const string sthx = "Subject_STHX";
|
||||
public const string stxf = "Subject_STXF";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,9 @@
|
|||
using Castle.Core.Internal;
|
||||
using ClosedXML.Excel;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NUnit.Framework.Internal.Execution;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using Infrastructure;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Repository;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.DataCodeRule.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
|
@ -10,7 +10,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Cache;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.DataCodeRule
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.FormScheme.FormHelpers;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
|
@ -11,7 +11,7 @@ using System.Data;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.DataSource
|
||||
{
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.CodeTable;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.FormScheme.FormHelpers;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using static Dm.net.buffer.ByteArrayBuffer;
|
||||
|
||||
namespace OpenAuth.App.DbTable
|
||||
{
|
||||
public class DbTableApp : SqlSugarBaseApp<Repository.Domain.DbCodeTable, SugarDbContext>
|
||||
{
|
||||
private IConfiguration _configuration;
|
||||
public DbTableApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<Repository.Domain.DbCodeTable> repository, IConfiguration configuration) : base(unitWork, repository, null)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表信息
|
||||
/// </summary>
|
||||
/// <param name="dbcode">数据库编码</param>
|
||||
/// <param name="dbTableReq">数据表信息</param>
|
||||
/// <returns></returns>
|
||||
public Response<bool> AddTable(string dbcode, DbTableReq dbTableReq)
|
||||
{
|
||||
if (dbTableReq.DbColumnInfoList == null || !dbTableReq.DbColumnInfoList.Any())
|
||||
throw new Exception("请添加数据列");
|
||||
return null;
|
||||
|
||||
//if (dbTableReq.DbColumnInfoList == null || !dbTableReq.DbColumnInfoList.Any())
|
||||
// throw new Exception("请添加数据列");
|
||||
//using (var db = this.CodeClient(dbcode, _configuration))
|
||||
//{
|
||||
// var typeBuilder = db.DynamicBuilder().CreateClass(dbTableReq.TableName, new SugarTable() { TableName = dbTableReq.TableName, TableDescription = dbTableReq.Description });
|
||||
// dbTableReq.DbColumnInfoList.ForEach(u =>
|
||||
// {
|
||||
// typeBuilder.CreateProperty(u.DbColumnName, typeof(string), new SugarColumn()
|
||||
// {
|
||||
// IsPrimaryKey = u.IsPrimarykey == 1,
|
||||
// IsIdentity = u.IsIdentity == 1,
|
||||
// ColumnDataType = u.DataType,
|
||||
// Length = u.Length,
|
||||
// IsNullable = u.IsNullable == 1,
|
||||
// DecimalDigits = u.DecimalDigits,
|
||||
// ColumnDescription = u.ColumnDescription,
|
||||
// });
|
||||
// });
|
||||
// db.CodeFirst.InitTables(typeBuilder.BuilderType());
|
||||
// return new Response<bool>()
|
||||
// {
|
||||
// Code = 200,
|
||||
// Result = true,
|
||||
// Message = "创建成功"
|
||||
// };
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建字段
|
||||
/// </summary>
|
||||
/// <param name="dbcode">数据库编码</param>
|
||||
/// <param name="dbColumnInput">表字段</param>
|
||||
/// <returns></returns>
|
||||
public Response<bool> AddColumn(string dbcode, DbColumnInput dbColumnInput)
|
||||
{
|
||||
return null;
|
||||
|
||||
//using (var db = this.CodeClient(dbcode, _configuration))
|
||||
//{
|
||||
// var column = new DbColumnInfo
|
||||
// {
|
||||
// ColumnDescription = dbColumnInput.ColumnDescription,
|
||||
// DbColumnName = dbColumnInput.DbColumnName,
|
||||
// IsIdentity = dbColumnInput.IsIdentity == 1,
|
||||
// IsNullable = dbColumnInput.IsNullable == 1,
|
||||
// IsPrimarykey = dbColumnInput.IsPrimarykey == 1,
|
||||
// Length = dbColumnInput.Length,
|
||||
// DecimalDigits = dbColumnInput.DecimalDigits,
|
||||
// DataType = dbColumnInput.DataType
|
||||
// };
|
||||
|
||||
// db.DbMaintenance.AddColumn(dbColumnInput.TableName, column);
|
||||
// db.DbMaintenance.AddColumnRemark(dbColumnInput.DbColumnName, dbColumnInput.TableName, dbColumnInput.ColumnDescription);
|
||||
// if (column.IsPrimarykey)
|
||||
// db.DbMaintenance.AddPrimaryKey(dbColumnInput.TableName, dbColumnInput.DbColumnName);
|
||||
// return new Response<bool>()
|
||||
// {
|
||||
// Code = 200,
|
||||
// Result = true,
|
||||
// Message = "创建成功"
|
||||
// };
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,14 +9,15 @@ using Infrastructure.Helpers;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace OpenAuth.App.Request
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryFileListReq : PageReq
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using Infrastructure;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.FormModule.Request;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.Repository;
|
||||
|
|
@ -13,7 +13,7 @@ using System.Linq.Expressions;
|
|||
using System.Text;
|
||||
using Castle.Core.Internal;
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.FormModule
|
||||
{
|
||||
|
|
@ -555,26 +555,27 @@ namespace OpenAuth.App.FormModule
|
|||
/// <returns></returns>
|
||||
public Response<List<DbTableInfo>> GetTableList(string code, string key, bool isCache = false)
|
||||
{
|
||||
using (var db = this.CodeClient(code, _configuration))
|
||||
{
|
||||
var list = db.DbMaintenance.GetTableInfoList(isCache);
|
||||
//var list = db.DbMaintenance.GetTableInfoList((dbtype, sql) =>
|
||||
//{
|
||||
// if (dbtype == SqlSugar.DbType.Kdbndp)
|
||||
// {
|
||||
// return sql.Replace(@"where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' order by relname", @" INNER JOIN PG_NAMESPACE AS n ON c.relnamespace = n.oid where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' and n.nspname = 'public' order by relname");
|
||||
// }
|
||||
// return sql;
|
||||
//});
|
||||
var info = list.FindAll(t =>
|
||||
t.DbObjectType == DbObjectType.Table && t.Name.ToLower() != "lr_db_codecolumns" &&
|
||||
t.Name.ToLower() != "lr_db_codetable" && t.Name.ToLower() != "lr_db_history")
|
||||
.WhereIF(!key.IsNullOrEmpty(), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
|
||||
return new Response<List<DbTableInfo>>
|
||||
{
|
||||
Result = info
|
||||
};
|
||||
}
|
||||
//using (var db = this.CodeClient(code, _configuration))
|
||||
//{
|
||||
// var list = db.DbMaintenance.GetTableInfoList(isCache);
|
||||
// //var list = db.DbMaintenance.GetTableInfoList((dbtype, sql) =>
|
||||
// //{
|
||||
// // if (dbtype == SqlSugar.DbType.Kdbndp)
|
||||
// // {
|
||||
// // return sql.Replace(@"where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' order by relname", @" INNER JOIN PG_NAMESPACE AS n ON c.relnamespace = n.oid where relkind = 'r' and c.oid > 16384 and c.relnamespace != 99 and c.relname not like '%pl_profiler_saved%' and n.nspname = 'public' order by relname");
|
||||
// // }
|
||||
// // return sql;
|
||||
// //});
|
||||
// var info = list.FindAll(t =>
|
||||
// t.DbObjectType == DbObjectType.Table && t.Name.ToLower() != "lr_db_codecolumns" &&
|
||||
// t.Name.ToLower() != "lr_db_codetable" && t.Name.ToLower() != "lr_db_history")
|
||||
// .WhereIF(!key.IsNullOrEmpty(), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
|
||||
// return new Response<List<DbTableInfo>>
|
||||
// {
|
||||
// Result = info
|
||||
// };
|
||||
//}
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository;
|
||||
using System;
|
||||
|
|
@ -34,8 +34,9 @@ using NPOI.HSSF.UserModel;
|
|||
using NPOI.SS.UserModel;
|
||||
using OpenAuth.App.FormModule;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using Castle.Core.Internal;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.FormScheme
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository;
|
||||
using System;
|
||||
|
|
@ -16,7 +16,7 @@ using OpenAuth.App.BaseApp.WFTask;
|
|||
using OpenAuth.App.BaseApp.ImMsgManager;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.BaseApp
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using Infrastructure;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.FormScheme;
|
||||
using OpenAuth.App.Permission;
|
||||
using OpenAuth.Repository;
|
||||
|
|
@ -11,7 +11,7 @@ using System.Data;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.Import
|
||||
{
|
||||
|
|
@ -6,8 +6,8 @@ using Infrastructure;
|
|||
using Infrastructure.Const;
|
||||
using Infrastructure.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Extensions;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
|
|
@ -16,6 +16,7 @@ using OpenAuth.Repository;
|
|||
using OpenAuth.Repository.Domain;
|
||||
using Quartz;
|
||||
using SqlSugar;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace OpenAuth.App.Request
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryOpenJobListReq : PageReq
|
||||
{
|
||||
|
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.BaseApp.Jobs
|
||||
{
|
||||
|
|
@ -11,6 +11,7 @@ using OpenAuth.App.BaseApp.WFTask;
|
|||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App.BaseApp.Jobs
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using System.Linq;
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.ModuleManager;
|
||||
using OpenAuth.App.ModuleManager.Response;
|
||||
|
|
@ -12,6 +12,7 @@ using OpenAuth.Repository;
|
|||
using OpenAuth.Repository.Core;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.ModuleManager
|
||||
{
|
||||
|
|
@ -43,12 +43,15 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\OpenAuth.Auth\OpenAuth.Auth.csproj" />
|
||||
<ProjectReference Include="..\OpenAuth.BaseApp\OpenAuth.BaseApp.csproj" />
|
||||
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj" />
|
||||
<ProjectReference Include="..\Utils.Web\Utils.Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="BaseApp\FormModule\Response\" />
|
||||
<Folder Include="BaseApp\Permission\" />
|
||||
<Folder Include="FormModule\Response\" />
|
||||
<Folder Include="Permission\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.Base.Tree;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.App.BasicQueryService;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
|
|
@ -12,6 +11,7 @@ using SqlSugar;
|
|||
using SqlSugar.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using OpenAuth.Auth.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Text;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Permission.Request;
|
||||
using OpenAuth.Repository;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using OpenAuth.App.Request;
|
||||
using Utils.Web.Model;
|
||||
|
||||
namespace OpenAuth.App.Permission.Request;
|
||||
|
||||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenAuth.App.Base;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.BaseApp;
|
||||
using OpenAuth.Auth.Interface;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.Repository;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue