diff --git a/Tiobon.Core.Api/Controllers/DbFirst/DbFirstController.cs b/Tiobon.Core.Api/Controllers/DbFirst/DbFirstController.cs
index 4d6f4fd7..e588e6d1 100644
--- a/Tiobon.Core.Api/Controllers/DbFirst/DbFirstController.cs
+++ b/Tiobon.Core.Api/Controllers/DbFirst/DbFirstController.cs
@@ -70,7 +70,7 @@ namespace Tiobon.Core.Controllers
/// 需要生成的表名
///
[HttpPost]
- public MessageModel GetFrameFilesByTableNames([FromBody]string[] tableNames, [FromQuery]string ConnID = null)
+ public MessageModel GetFrameFilesByTableNames([FromBody] string[] tableNames, [FromQuery] string ConnID = null)
{
ConnID = ConnID == null ? MainDb.CurrentDbConnId.ToLower() : ConnID;
@@ -144,11 +144,13 @@ namespace Tiobon.Core.Controllers
/// DbFrist 根据数据库表名 生成整体框架,包含Model层(一般可用第一次生成)
///
/// 数据库链接名称
- /// 需要生成的表名
+ /// 需要生成的表名
///
[HttpPost]
- public MessageModel GetAllFrameFilesByTableNames([FromBody]string[] tableNames, [FromQuery]string ConnID = null)
+ public MessageModel GetAllFrameFilesByTableNames([FromQuery] string tableName, [FromQuery] string ConnID = null)
{
+ string[] tableNames = new string[1];
+ tableNames[0] = tableName;
ConnID = ConnID == null ? MainDb.CurrentDbConnId.ToLower() : ConnID;
var isMuti = BaseDBConfig.IsMulti;
diff --git a/Tiobon.Core.Api/Controllers/Ghra_GradeController.cs b/Tiobon.Core.Api/Controllers/Ghra_GradeController.cs
index 2a6eb6ce..4a04b999 100644
--- a/Tiobon.Core.Api/Controllers/Ghra_GradeController.cs
+++ b/Tiobon.Core.Api/Controllers/Ghra_GradeController.cs
@@ -1,43 +1,45 @@
-using Microsoft.EntityFrameworkCore;
-using Tiobon.Core.DataAccess;
-
-namespace Tiobon.Core.Api.Controllers
+namespace Tiobon.Core.Api.Controllers
{
- [Route("api/[controller]/[action]")]
- [ApiController]
- [Authorize(Permissions.Name)]
- public class Ghra_GradeController : ControllerBase
+ ///
+ /// Ghra_Grade
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ [Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghra)]
+ public class Ghra_GradeController : ControllerBase
{
#region 初始化
///
/// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
///
private readonly IGhra_GradeServices _ghra_GradeServices;
-
+
public Ghra_GradeController(IGhra_GradeServices Ghra_GradeServices)
{
_ghra_GradeServices = Ghra_GradeServices;
}
#endregion
-
+
#region 基础接口
#region 查询
+ ///
+ /// Ghra_Grade -- 根据条件查询数据
+ ///
+ /// 条件
+ ///
[HttpGet]
public async Task>> Get([FromFilter] QueryFilter filter)
{
-
- using var _context = ContextFactory.CreateContext();
- var list = await _context.Ghra_Grade.ToListAsync();
-
- return new MessageModel>()
- {
- msg = "获取成功",
- success = true,
- response = await _ghra_GradeServices.QueryFilterPage(filter)
- };
+ var response = await _ghra_GradeServices.QueryFilterPage(filter);
+ return new MessageModel>() { msg = "获取成功", success = true, response = response };
}
+ ///
+ /// Ghra_Grade -- 根据Id查询数据
+ ///
+ /// 主键ID
+ ///
[HttpGet("{id}")]
public async Task> Get(string id)
{
@@ -51,6 +53,11 @@ namespace Tiobon.Core.Api.Controllers
#endregion
#region 新增
+ ///
+ /// Ghra_Grade -- 新增数据
+ ///
+ ///
+ ///
[HttpPost]
public async Task> Post([FromBody] Ghra_Grade request)
{
@@ -62,13 +69,18 @@ namespace Tiobon.Core.Api.Controllers
{
data.response = id.ObjToString();
data.msg = "添加成功";
- }
+ }
return data;
}
#endregion
- #region 新增
+ #region 更新
+ ///
+ /// Ghra_Grade -- 更新数据
+ ///
+ ///
+ ///
[HttpPut]
public async Task> Put([FromBody] Ghra_Grade request)
{
@@ -85,6 +97,11 @@ namespace Tiobon.Core.Api.Controllers
#endregion
#region 删除
+ ///
+ /// Ghra_Grade -- 删除数据
+ ///
+ ///
+ ///
[HttpDelete]
public async Task> Delete(int id)
{
diff --git a/Tiobon.Core.Api/GlobalUsings.cs b/Tiobon.Core.Api/GlobalUsings.cs
index cd7a8892..bf90ffe8 100644
--- a/Tiobon.Core.Api/GlobalUsings.cs
+++ b/Tiobon.Core.Api/GlobalUsings.cs
@@ -15,4 +15,5 @@ global using Tiobon.Core.Model;
global using Tiobon.Core.Model.Models;
global using Tiobon.Core.Model.ViewModels;
global using Tiobon.Core.Repository.UnitOfWorks;
-global using Microsoft.AspNetCore.Mvc;
+global using Tiobon.Core.SwaggerHelper;
+global using static Tiobon.Core.Extensions.SwaggerSetup;
diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml
index 91b45fa3..a8db25c2 100644
--- a/Tiobon.Core.Api/Tiobon.Core.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.xml
@@ -116,12 +116,12 @@
需要生成的表名
-
+
DbFrist 根据数据库表名 生成整体框架,包含Model层(一般可用第一次生成)
数据库链接名称
- 需要生成的表名
+ 需要生成的表名
@@ -1216,11 +1216,51 @@
+
+
+ Ghra_Grade
+
+
服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
+
+
+ Ghra_Grade -- 根据条件查询数据
+
+ 条件
+
+
+
+
+ Ghra_Grade -- 根据Id查询数据
+
+ 主键ID
+
+
+
+
+ Ghra_Grade -- 新增数据
+
+
+
+
+
+
+ Ghra_Grade -- 更新数据
+
+
+
+
+
+
+ Ghra_Grade -- 删除数据
+
+
+
+
服务管理
diff --git a/Tiobon.Core.Api/appsettings.json b/Tiobon.Core.Api/appsettings.json
index 02f7d71a..e5aa4467 100644
--- a/Tiobon.Core.Api/appsettings.json
+++ b/Tiobon.Core.Api/appsettings.json
@@ -209,7 +209,6 @@
"AppConfigAlert": {
"Enabled": true
},
- "ApiName": "Tiobon.Core",
"IdentityServer4": {
"Enabled": false, // 这里默认是false,表示使用jwt,如果设置为true,则表示系统使用Ids4模式
"AuthorizationUrl": "http://localhost:5004", // 认证中心域名
diff --git a/Tiobon.Core.Common/Seed/FrameSeed.cs b/Tiobon.Core.Common/Seed/FrameSeed.cs
index 34a4cae1..6e653ed5 100644
--- a/Tiobon.Core.Common/Seed/FrameSeed.cs
+++ b/Tiobon.Core.Common/Seed/FrameSeed.cs
@@ -105,7 +105,6 @@ namespace Tiobon.Core.Common.Seed
///
/// 功能描述:根据数据库表生产Controller层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID
@@ -130,112 +129,134 @@ namespace Tiobon.Core.Common.Seed
{
IDbFirst = IDbFirst.Where(lstTableNames);
}
+
+ var tableName = lstTableNames[0];
+ var groupName = tableName.Split('_')[0];
var ls = IDbFirst.IsCreateDefaultValue().IsCreateAttribute()
.SettingClassTemplate(p => p =
@"namespace " + strNameSpace + @"
{
+ ///
+ /// {ClassName}
+ ///
[Route(""api/[controller]/[action]"")]
[ApiController]
- [Authorize(Permissions.Name)]
- public class {ClassName}Controller : ControllerBase
+ [Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_" + groupName + @")]
+ public class {ClassName}Controller : ControllerBase
{
- #region 初始化
- ///
- /// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
- ///
- private readonly I{ClassName}Services _{ClassName}Services;
+ #region 初始化
+ ///
+ /// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
+ ///
+ private readonly I{ClassName}Services _{ClassName}Services;
- public {ClassName}Controller(I{ClassName}Services {ClassName}Services)
- {
- _{ClassName}Services = {ClassName}Services;
- }
- #endregion
+ public {ClassName}Controller(I{ClassName}Services {ClassName}Services)
+ {
+ _{ClassName}Services = {ClassName}Services;
+ }
+ #endregion
- #region 基础接口
+ #region 基础接口
- #region 查询
- [HttpGet]
- public async Task>> Get(int page = 1, string key = """",int pageSize = 50)
- {
- if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key))
- key = """";
-
- Expression> whereExpression = a => true;
-
- return new MessageModel>()
- {
- msg = ""获取成功"",
- success = true,
- response = await _{ClassName}Services.QueryPage(whereExpression, page, pageSize)
- };
- }
+ #region 查询
+ ///
+ /// {ClassName} -- 根据条件查询数据
+ ///
+ /// 条件
+ ///
+ [HttpGet]
+ public async Task>> Get([FromFilter] QueryFilter filter)
+ {
+ var response = await _{ClassName}Services.QueryFilterPage(filter);
+ return new MessageModel>() { msg = ""获取成功"", success = true, response = response };
+ }
- [HttpGet(""{id}"")]
- public async Task> Get(string id)
+ ///
+ /// {ClassName} -- 根据Id查询数据
+ ///
+ /// 主键ID
+ ///
+ [HttpGet(""{id}"")]
+ public async Task> Get(string id)
+ {
+ return new MessageModel<{ClassName}>()
{
- return new MessageModel<{ClassName}>()
- {
- msg = ""获取成功"",
- success = true,
- response = await _{ClassName}Services.QueryById(id)
- };
- }
- #endregion
+ msg = ""获取成功"",
+ success = true,
+ response = await _{ClassName}Services.QueryById(id)
+ };
+ }
+ #endregion
- #region 新增
- [HttpPost]
- public async Task> Post([FromBody] {ClassName} request)
- {
- var data = new MessageModel();
+ #region 新增
+ ///
+ /// {ClassName} -- 新增数据
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> Post([FromBody] {ClassName} request)
+ {
+ var data = new MessageModel();
- var id = await _{ClassName}Services.Add(request);
- data.success = id > 0;
- if (data.success)
- {
- data.response = id.ObjToString();
- data.msg = ""添加成功"";
- }
+ var id = await _{ClassName}Services.Add(request);
+ data.success = id > 0;
+ if (data.success)
+ {
+ data.response = id.ObjToString();
+ data.msg = ""添加成功"";
+ }
- return data;
- }
- #endregion
+ return data;
+ }
+ #endregion
- #region 新增
- [HttpPut]
- public async Task> Put([FromBody] {ClassName} request)
+ #region 更新
+ ///
+ /// {ClassName} -- 更新数据
+ ///
+ ///
+ ///
+ [HttpPut]
+ public async Task> Put([FromBody] {ClassName} request)
+ {
+ var data = new MessageModel();
+ data.success = await _{ClassName}Services.Update(request);
+ if (data.success)
{
- var data = new MessageModel();
- data.success = await _{ClassName}Services.Update(request);
- if (data.success)
- {
- data.msg = ""更新成功"";
- data.response = request?.Id.ObjToString();
- }
-
- return data;
+ data.msg = ""更新成功"";
+ data.response = request?.Id.ObjToString();
}
- #endregion
- #region 删除
- [HttpDelete]
- public async Task> Delete(int id)
- {
- var data = new MessageModel();
- var model = await _{ClassName}Services.QueryById(id);
- model.IsEnable = 1;
- // data.success = await _departmentServices.Update(model);
- if (data.success)
- {
- data.msg = ""删除成功"";
- data.response = model?.Id.ObjToString();
- }
+ return data;
+ }
+ #endregion
- return data;
+ #region 删除
+ ///
+ /// {ClassName} -- 删除数据
+ ///
+ ///
+ ///
+ [HttpDelete]
+ public async Task> Delete(int id)
+ {
+ var data = new MessageModel();
+ var model = await _{ClassName}Services.QueryById(id);
+ model.IsEnable = 1;
+ // data.success = await _departmentServices.Update(model);
+ if (data.success)
+ {
+ data.msg = ""删除成功"";
+ data.response = model?.Id.ObjToString();
}
- #endregion
- #endregion
+ return data;
+ }
+ #endregion
+
+ #endregion
}
}")
@@ -258,7 +279,6 @@ namespace Tiobon.Core.Common.Seed
///
/// 功能描述:根据数据库表生产Model层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID
@@ -324,7 +344,6 @@ namespace " + strNameSpace + @"
///
/// 功能描述:根据数据库表生产IRepository层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID
@@ -381,7 +400,6 @@ namespace " + strNameSpace + @"
///
/// 功能描述:根据数据库表生产IServices层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID
@@ -438,7 +456,6 @@ namespace " + strNameSpace + @"
///
/// 功能描述:根据数据库表生产 Repository 层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID
@@ -500,7 +517,6 @@ namespace " + strNameSpace + @"
///
/// 功能描述:根据数据库表生产 Services 层
- /// 作 者:Tiobon.Core
///
///
/// 数据库链接ID