//
namespace SafeCampus.System;
///
/// 批量分页查询参数
///
public class BatchEditPageInput : BasePageInput
{
///
/// 唯一编码
///
public string Code { get; set; }
///
/// 所属库
///
public string ConfigId { get; set; }
///
/// 实体名
///
public string EntityName { get; set; }
///
/// 表名
///
public string TableName { get; set; }
}
///
/// 添加批量参数
///
public class BatchEditAddInput
{
///
/// 唯一编码
///
[Required(ErrorMessage = "Code必填")]
public string Code { get; set; }
///
/// 所属库
///
[Required(ErrorMessage = "ConfigId必填")]
public string ConfigId { get; set; }
///
/// 实体名
///
[Required(ErrorMessage = "EntityName必填")]
public string EntityName { get; set; }
///
/// 表名
///
[Required(ErrorMessage = "TableName必填")]
public string TableName { get; set; }
///
/// 表描述
///
public string TableDescription { get; set; }
}
///
/// 修改批量参数
///
public class BatchEditConfigInput : BatchEditConfig, IValidatableObject
{
///
/// Id
///
[IdNotNull(ErrorMessage = "Id不能为空")]
public override long Id { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
if (Status == CommonStatusConst.ENABLE)
{
//如果是api请求并且必填参数有空的
if (DataType.Contains("api") && (string.IsNullOrEmpty(RequestUrl) || string.IsNullOrEmpty(RequestType)
|| string.IsNullOrEmpty(RequestLabel) || string.IsNullOrEmpty(RequestValue)))
{
yield return new ValidationResult($"字段{ColumnName}接口信息必填", new[] { nameof(DataType) });
}
//如果是字典数据并且字典值为空
if (DataType.Contains("dict") && string.IsNullOrEmpty(DictTypeCode))
{
yield return new ValidationResult($"字段{ColumnName}字典值必填", new[] { nameof(DictTypeCode) });
}
}
}
}
///
/// 批量修改输入
///
public class BatchEditInput
{
///
/// 批量编辑Code
///
[Required(ErrorMessage = "Code不能为空")]
public string Code { get; set; }
///
/// Id列表
///
[Required(ErrorMessage = "Ids不能为空")]
public List? Ids { get; set; }
///
/// 字段列表
///
[Required(ErrorMessage = "Columns不能为空")]
public List? Columns { get; set; }
}
///
/// 批量修改DTO
///
public class BatchEditColumn
{
[Required(ErrorMessage = "字段名必填")]
public string TableColumn { get; set; }
[Required(ErrorMessage = "字段值必填")]
public object ColumnValue { get; set; }
}