mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:43:26 +08:00
vue view code gen
This commit is contained in:
@@ -128,6 +128,57 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成代码
|
||||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <param name="fileType"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("生成代码Vue")]
|
||||
public IActionResult CodeGenDownVue([FromQuery] string tableName, [FromQuery] string fileType)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
if (string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
jm.msg = "请选择数据库";
|
||||
return new JsonResult(jm);
|
||||
}
|
||||
if (string.IsNullOrEmpty(fileType))
|
||||
{
|
||||
jm.msg = "请选择要导出的文件类型";
|
||||
return new JsonResult(jm);
|
||||
}
|
||||
|
||||
if (tableName == "AllTable")
|
||||
{
|
||||
var data = _codeGeneratorServices.CodeGenByAll(fileType, true);
|
||||
if (data != null)
|
||||
{
|
||||
return File(data, System.Net.Mime.MediaTypeNames.Application.Zip, tableName + "-" + fileType + ".zip");
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.msg = tableName + "获取数据库字段失败";
|
||||
return new JsonResult(jm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var data = _codeGeneratorServices.CodeGen(tableName, fileType, true);
|
||||
if (data != null)
|
||||
{
|
||||
return File(data, System.Net.Mime.MediaTypeNames.Application.Zip, tableName + "-" + fileType + ".zip");
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.msg = tableName + "获取数据库字段失败";
|
||||
return new JsonResult(jm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 获取所有表和表名并生成excel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user