开发代码生成功能
This commit is contained in:
@@ -22,6 +22,12 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
|
||||
protected IActionResult ToRespose(ResultCode resultCode, object data = null)
|
||||
{
|
||||
string jsonStr = GetJsonStr(GetApiResult(resultCode, data), "");
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// json输出带时间格式的
|
||||
/// </summary>
|
||||
@@ -40,10 +46,6 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
protected string SerializeObject(object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 响应返回结果
|
||||
|
||||
60
ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
Normal file
60
ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Model;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
using ZR.Model.CodeGenerator;
|
||||
using ZR.Service.IService;
|
||||
using ZR.Service.System;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成
|
||||
/// </summary>
|
||||
[Route("codeGenerator")]
|
||||
public class CodeGeneratorController : BaseController
|
||||
{
|
||||
public ICodeGeneratorService CodeGeneratorService;
|
||||
public CodeGeneratorController(ICodeGeneratorService codeGeneratorService)
|
||||
{
|
||||
CodeGeneratorService = codeGeneratorService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有数据库的信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetListDataBase")]
|
||||
//[YuebonAuthorize("GetListDataBase")]
|
||||
//[NoPermissionRequired]
|
||||
public IActionResult GetListDataBase()
|
||||
{
|
||||
List<DataBaseInfo> listTable = CodeGeneratorService.GetAllDataBases("SqlServer");
|
||||
|
||||
return SUCCESS(listTable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取所有表根据数据名
|
||||
/// </summary>
|
||||
/// <param name="enCode">数据库名</param>
|
||||
/// <param name="keywords">表名</param>
|
||||
/// <param name="pagerInfo">分页信息</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("FindListTable")]
|
||||
public IActionResult FindListTable(string enCode, string keywords, PagerInfo pagerInfo)
|
||||
{
|
||||
if (string.IsNullOrEmpty(enCode))
|
||||
{
|
||||
return ToRespose(ResultCode.PARAM_ERROR);
|
||||
}
|
||||
List<DbTableInfo> listTable = CodeGeneratorService.GetTablesWithPage(keywords, enCode, pagerInfo);
|
||||
|
||||
return SUCCESS(listTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
"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"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"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"
|
||||
|
||||
Reference in New Issue
Block a user