using Newtonsoft.Json;
namespace MiaoYu.Shared.Admin.Models.LowCodes;
///
/// 表列配置修改输入参数
///
public class TableColumnChangeInput
{
///
/// 表名(必填)
///
public string TableName { get; set; } = string.Empty;
///
/// 数据库标识(必填)
///
public string DataBase { get; set; } = string.Empty;
///
/// 列配置列表
///
public List Columns { get; set; } = new();
}
///
/// 表列配置修改项
///
public class TableColumnChangeDto
{
///
/// 列名(必填,用于匹配)
///
[JsonProperty("columnName")]
public string ColumnName { get; set; } = string.Empty;
///
/// 显示名称(可选,null 表示清空)
///
[JsonProperty("displayName")]
public string? DisplayName { get; set; }
///
/// 列描述(可选,null 表示清空)
///
[JsonProperty("describe")]
public string? Describe { get; set; }
///
/// C# 字段名(可选,null 表示清空)
///
[JsonProperty("csField")]
public string? CsField { get; set; }
///
/// 是否在表格中显示(可选,null 表示设置为 null)
///
[JsonProperty("isTableColumnShow")]
public bool? IsTableColumnShow { get; set; }
///
/// 是否可查询(可选,null 表示设置为 null)
///
[JsonProperty("isTableSelect")]
public bool? IsTableSelect { get; set; }
///
/// 是否是图片ID(可选,null 表示设置为 null)
///
[JsonProperty("isImageId")]
public bool? IsImageId { get; set; }
///
/// 排序ID(可选,null 表示设置为 null)
///
[JsonProperty("orderById")]
public int? OrderById { get; set; }
///
/// 宽度(可选,null 表示清空)
///
[JsonProperty("width")]
public string? Width { get; set; }
///
/// 记录传递的额外字段(用于检测字段是否被传递)
///
[JsonExtensionData]
private Dictionary? _extensionData;
///
/// 检查指定字段是否被传递
///
/// 字段名(PascalCase,如 "DisplayName")
/// 如果字段被传递返回 true,否则返回 false
public bool WasFieldProvided(string fieldName)
{
if (_extensionData == null || string.IsNullOrWhiteSpace(fieldName))
return false;
// 转换为 camelCase(因为前端使用 camelCase)
var camelCaseName = char.ToLowerInvariant(fieldName[0]) + fieldName.Substring(1);
// 检查是否在扩展数据中
return _extensionData.ContainsKey(camelCaseName);
}
}