优化项目结构
This commit is contained in:
@@ -6,14 +6,12 @@ namespace Infrastructure
|
||||
/// </summary>
|
||||
public class OptionsSetting
|
||||
{
|
||||
public static string ConnAdmin = "Conn_admin";
|
||||
public static string Conn = "ConnDynamic";
|
||||
public static string DbType = "DbType";
|
||||
public static string CodeGenDbType = "CodeGenDbType";
|
||||
public static string ConnAdmin = "conn_zrAdmin";
|
||||
public static string DbType = "conn_admin_Type";
|
||||
public static string DbKey = "DbKey";
|
||||
public static string Gen_conn = "gen:conn";
|
||||
public static string Gen_conn_dbType = "gen:dbType";
|
||||
|
||||
public static string Gen_author = "gen:author";
|
||||
public string Conn_Admin { get; set; }
|
||||
|
||||
public string AppName { get; set; }
|
||||
|
||||
@@ -67,12 +67,12 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return SUCCESS(vm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表格列
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
///// <summary>
|
||||
///// 获取表格列
|
||||
///// </summary>
|
||||
///// <param name="dbName"></param>
|
||||
///// <param name="tableName"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpGet("getColumnInfo")]
|
||||
//[ActionPermissionFilter(Permission = "tool:gen:list")]
|
||||
//public IActionResult QueryColumnInfo(string dbName, string tableName)
|
||||
@@ -183,7 +183,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
ModuleName = "bus",
|
||||
ClassName = CodeGeneratorTool.GetClassName(tableName),
|
||||
BusinessName = CodeGeneratorTool.GetClassName(tableName),
|
||||
FunctionAuthor = ConfigUtils.Instance.GetConfig("gen:author"),
|
||||
FunctionAuthor = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_author),
|
||||
FunctionName = tabInfo.Description,
|
||||
TableName = tableName,
|
||||
TableComment = tabInfo.Description,
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Conn_Admin": "server=127.0.0.1;user=zr;pwd=abc;database=admin",
|
||||
"ConnDynamic": "server=127.0.0.1;user=zr;pwd=abc;database={database}"//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
},
|
||||
"urls": "http://localhost:8888", //<2F><><EFBFBD><EFBFBD>url
|
||||
"sysConfig": {
|
||||
"DBCommandTimeout": 10,
|
||||
"cors": "http://localhost:8887" //<2F><><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>ַ
|
||||
},
|
||||
"DemoMode": false, //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾģʽ
|
||||
"DbKey": "",
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1, Sqlite = 2, Oracle = 3, PostgreSQL = 4,
|
||||
"CodeGenDbType": 0,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
},
|
||||
"ALYUN_OCS": {
|
||||
"REGIONID": "cn-hangzhou",
|
||||
"KEY": "XX",
|
||||
"SECRET": "XX"
|
||||
},
|
||||
"gen": {
|
||||
"conn": "server=127.0.0.1;user=zr;pwd=abc;database={database}",
|
||||
"dbType": 1,
|
||||
"autoPre": true, //<2F>Զ<EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>ǰ
|
||||
"author": "zhaorui",
|
||||
"tablePrefix": "live_,sys_" //"<22><>ǰ<C7B0><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<C7B0><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>ŷָ<C5B7><D6B8><EFBFBD>",
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,32 @@
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"conn_zrAdmin": "server=127.0.0.1;user=zr;pwd=abc;database=admin"
|
||||
},
|
||||
"urls": "http://localhost:8888", //<2F><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>url
|
||||
"sysConfig": {
|
||||
"DBCommandTimeout": 10,
|
||||
"cors": "http://localhost:8887" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<22><><EFBFBD><EFBFBD>
|
||||
},
|
||||
"DemoMode": false, //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾģʽ
|
||||
"DbKey": "", //<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>key
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
},
|
||||
"ALYUN_OCS": {
|
||||
"REGIONID": "cn-hangzhou",
|
||||
"KEY": "XX",
|
||||
"SECRET": "XX"
|
||||
},
|
||||
"gen": {
|
||||
"conn": "server=127.0.0.1;user=zr;pwd=abc;database={database}",
|
||||
"dbType": 1,
|
||||
"autoPre": true, //<2F>Զ<EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>ǰ
|
||||
"author": "zhaorui",
|
||||
"tablePrefix": "live_,sys_" //"<22><>ǰ<C7B0><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<C7B0><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>ŷָ<C5B7><D6B8><EFBFBD>",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.CodeGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成数据库连接
|
||||
/// </summary>
|
||||
public class DbProvider
|
||||
{
|
||||
protected static SqlSugarScope CodeDb;
|
||||
@@ -19,12 +22,13 @@ namespace ZR.CodeGenerator
|
||||
/// <returns></returns>
|
||||
public SqlSugarScope GetSugarDbContext(string dbName = "")
|
||||
{
|
||||
string connStr = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_conn).Replace("{database}", dbName);
|
||||
string connStr = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_conn);
|
||||
int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.Gen_conn_dbType, 0);
|
||||
connStr = connStr.Replace("{database}", dbName);
|
||||
if (string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin);
|
||||
dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0);
|
||||
dbType = ConfigUtils.Instance.GetAppConfig<int>(OptionsSetting.DbType);
|
||||
}
|
||||
var db = new SqlSugarScope(new List<ConnectionConfig>()
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ZR.Repository.DbProvider
|
||||
{
|
||||
string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin);
|
||||
string dbKey = ConfigUtils.Instance.GetAppConfig<string>(OptionsSetting.DbKey);
|
||||
int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0);
|
||||
string dbType = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.DbType);
|
||||
if (!string.IsNullOrEmpty(dbKey))
|
||||
{
|
||||
connStr = NETCore.Encrypt.EncryptProvider.DESDecrypt(connStr, dbKey);
|
||||
@@ -32,7 +32,7 @@ namespace ZR.Repository.DbProvider
|
||||
{
|
||||
new ConnectionConfig(){
|
||||
ConnectionString = connStr,
|
||||
DbType = (DbType)dbType,
|
||||
DbType = (DbType)Convert.ToInt32(dbType),
|
||||
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样
|
||||
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
|
||||
ConfigId = 0
|
||||
@@ -52,21 +52,5 @@ namespace ZR.Repository.DbProvider
|
||||
Console.WriteLine();
|
||||
};
|
||||
}
|
||||
|
||||
public SqlSugarClient GetSugarDbContext(string dbName)
|
||||
{
|
||||
string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.Conn).Replace("{DbName}", dbName);
|
||||
int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0);
|
||||
|
||||
return new SqlSugarClient(new List<ConnectionConfig>()
|
||||
{
|
||||
new ConnectionConfig(){
|
||||
ConnectionString = connStr,
|
||||
DbType = (DbType)dbType,
|
||||
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样
|
||||
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ export const constantRoutes = [
|
||||
component: (resolve) => require(['@/views/login'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/demo',
|
||||
component: (resolve) => require(['@/views/gift/index'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
// {
|
||||
// path: '/demo',
|
||||
// component: (resolve) => require(['@/views/gift/index'], resolve),
|
||||
// hidden: true
|
||||
// },
|
||||
{
|
||||
path: '/404',
|
||||
component: (resolve) => require(['@/views/error/404'], resolve),
|
||||
|
||||
41
ZRAdmin.xml
41
ZRAdmin.xml
@@ -27,47 +27,6 @@
|
||||
<param name="data"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ZR.Admin.WebApi.Controllers.UserInfoController">
|
||||
<summary>
|
||||
代码自动生成
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ZR.Admin.WebApi.Controllers.UserInfoController._UserInfoService">
|
||||
<summary>
|
||||
用户信息接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.QueryUserInfo(ZR.Model.Dto.UserInfoQueryDto)">
|
||||
<summary>
|
||||
查询用户信息列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.GetUserInfo(System.Int32)">
|
||||
<summary>
|
||||
查询用户信息详情
|
||||
</summary>
|
||||
<param name="Luid"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.AddUserInfo(ZR.Model.Dto.UserInfoDto)">
|
||||
<summary>
|
||||
添加用户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.UpdateUserInfo(ZR.Model.Dto.UserInfoDto)">
|
||||
<summary>
|
||||
更新用户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.DeleteUserInfo(System.Int32)">
|
||||
<summary>
|
||||
删除用户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ZR.Admin.WebApi.Controllers.CodeGeneratorController">
|
||||
<summary>
|
||||
代码生成
|
||||
|
||||
BIN
document/images/15.png
Normal file
BIN
document/images/15.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 MiB |
BIN
document/images/16.png
Normal file
BIN
document/images/16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 MiB |
Reference in New Issue
Block a user