CloudGamingAdmin/admin-server/CloudGaming.Shared.Admin/Models/LowCodes/GenDbTableDto.cs
2024-11-15 02:58:48 +08:00

177 lines
3.8 KiB
C#

namespace CloudGaming.Shared.Admin.Models.LowCodes;
/// <summary>
///
/// </summary>
public class GenDbTableDto : LowCodeTable
{
/// <summary>
/// 表字段信息
/// </summary>
/// <value></value>
public List<LowCodeTableInfo> TableInfos { get; set; }
/// <summary>
/// 命名空间
/// </summary>
public string? Namespace { get; set; }
/// <summary>
///
/// </summary>
public string NamespacePrefix { get; set; }
/// <summary>
/// 获取后缀
/// </summary>
/// <returns></returns>
public string GetPrefix()
{
return this.DataBase switch
{
"Game" or "Ext" => "Game\\",
"App" or "User" => "User\\",
_ => ""
};
}
private string _templateModel;
/// <summary>
/// 模型地址
/// </summary>
public string TemplateModel
{
get
{
if (string.IsNullOrEmpty(_templateModel))
{
_templateModel = GetPrefix() + "tempModel.cshtml";
}
return _templateModel;
}
set
{
_templateModel = value;
}
}
private string _templateService;
/// <summary>
/// 服务端
/// </summary>
public string TemplateService
{
get
{
if (string.IsNullOrEmpty(_templateService))
{
_templateService = GetPrefix() + "tempService.cshtml";
}
return _templateService;
}
set
{
_templateService = value;
}
}
private string _templateController;
/// <summary>
/// 控制器
/// </summary>
public string TemplateController
{
get
{
if (string.IsNullOrEmpty(_templateController))
{
_templateController = GetPrefix() + "tempController.cshtml";
}
return _templateController;
}
set
{
_templateController = value;
}
}
private string _templateServiceJs;
/// <summary>
/// 客户端服务器
/// </summary>
public string TemplateServiceJs
{
get
{
if (string.IsNullOrEmpty(_templateServiceJs))
{
_templateServiceJs = GetPrefix() + "tempClientService.cshtml";
}
return _templateServiceJs;
}
set
{
_templateServiceJs = value;
}
}
private string _templateIndex;
/// <summary>
/// 前端-首页
/// </summary>
public string TemplateIndex
{
get
{
if (string.IsNullOrEmpty(_templateIndex))
{
_templateIndex = GetPrefix() + "tempClientIndex.cshtml";
}
return _templateIndex;
}
set
{
_templateIndex = value;
}
}
private string _templateInfo;
/// <summary>
/// 前端-弹窗
/// </summary>
public string TemplateInfo
{
get
{
if (string.IsNullOrEmpty(_templateInfo))
{
_templateInfo = GetPrefix() + "tempClientInfo.cshtml";
}
return _templateInfo;
}
set
{
_templateInfo = value;
}
}
public GenDbTableDto ToGenDbTableDto()
{
string ex = GetPrefix();
this.TemplateModel = ex + "tempModel.cshtml";
this.TemplateService = ex + "tempService.cshtml";
this.TemplateController = ex + "tempController.cshtml";
this.TemplateServiceJs = ex + "tempClientService.cshtml";
this.TemplateIndex = ex + "tempClientIndex.cshtml";
this.TemplateInfo = ex + "tempClientInfo.cshtml";
return this;
}
}