|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
-
- //
-
-
-
-
-
-
-
-
- namespace SafeCampus.System;
-
- /// <summary>
- /// 批量分页查询参数
- /// </summary>
- public class BatchEditPageInput : BasePageInput
- {
- /// <summary>
- /// 唯一编码
- /// </summary>
- public string Code { get; set; }
-
- /// <summary>
- /// 所属库
- /// </summary>
- public string ConfigId { get; set; }
-
- /// <summary>
- /// 实体名
- /// </summary>
- public string EntityName { get; set; }
-
- /// <summary>
- /// 表名
- /// </summary>
- public string TableName { get; set; }
- }
-
- /// <summary>
- /// 添加批量参数
- /// </summary>
- public class BatchEditAddInput
- {
- /// <summary>
- /// 唯一编码
- /// </summary>
- [Required(ErrorMessage = "Code必填")]
- public string Code { get; set; }
-
- /// <summary>
- /// 所属库
- /// </summary>
- [Required(ErrorMessage = "ConfigId必填")]
- public string ConfigId { get; set; }
-
- /// <summary>
- /// 实体名
- /// </summary>
- [Required(ErrorMessage = "EntityName必填")]
- public string EntityName { get; set; }
-
- /// <summary>
- /// 表名
- /// </summary>
- [Required(ErrorMessage = "TableName必填")]
- public string TableName { get; set; }
-
- /// <summary>
- /// 表描述
- /// </summary>
- public string TableDescription { get; set; }
- }
-
- /// <summary>
- /// 修改批量参数
- /// </summary>
- public class BatchEditConfigInput : BatchEditConfig, IValidatableObject
- {
- /// <summary>
- /// Id
- /// </summary>
- [IdNotNull(ErrorMessage = "Id不能为空")]
- public override long Id { get; set; }
-
- public IEnumerable<ValidationResult> 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) });
- }
- }
- }
- }
-
- /// <summary>
- /// 批量修改输入
- /// </summary>
- public class BatchEditInput
- {
- /// <summary>
- /// 批量编辑Code
- /// </summary>
- [Required(ErrorMessage = "Code不能为空")]
- public string Code { get; set; }
-
- /// <summary>
- /// Id列表
- /// </summary>
- [Required(ErrorMessage = "Ids不能为空")]
- public List<long>? Ids { get; set; }
-
- /// <summary>
- /// 字段列表
- /// </summary>
- [Required(ErrorMessage = "Columns不能为空")]
- public List<BatchEditColumn>? Columns { get; set; }
- }
-
- /// <summary>
- /// 批量修改DTO
- /// </summary>
- public class BatchEditColumn
- {
- [Required(ErrorMessage = "字段名必填")]
- public string TableColumn { get; set; }
-
- [Required(ErrorMessage = "字段值必填")]
- public object ColumnValue { get; set; }
- }
|