平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BatchEditInput.cs 3.2 KiB

4 kuukautta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. 
  2. //
  3. namespace SafeCampus.System;
  4. /// <summary>
  5. /// 批量分页查询参数
  6. /// </summary>
  7. public class BatchEditPageInput : BasePageInput
  8. {
  9. /// <summary>
  10. /// 唯一编码
  11. /// </summary>
  12. public string Code { get; set; }
  13. /// <summary>
  14. /// 所属库
  15. /// </summary>
  16. public string ConfigId { get; set; }
  17. /// <summary>
  18. /// 实体名
  19. /// </summary>
  20. public string EntityName { get; set; }
  21. /// <summary>
  22. /// 表名
  23. /// </summary>
  24. public string TableName { get; set; }
  25. }
  26. /// <summary>
  27. /// 添加批量参数
  28. /// </summary>
  29. public class BatchEditAddInput
  30. {
  31. /// <summary>
  32. /// 唯一编码
  33. /// </summary>
  34. [Required(ErrorMessage = "Code必填")]
  35. public string Code { get; set; }
  36. /// <summary>
  37. /// 所属库
  38. /// </summary>
  39. [Required(ErrorMessage = "ConfigId必填")]
  40. public string ConfigId { get; set; }
  41. /// <summary>
  42. /// 实体名
  43. /// </summary>
  44. [Required(ErrorMessage = "EntityName必填")]
  45. public string EntityName { get; set; }
  46. /// <summary>
  47. /// 表名
  48. /// </summary>
  49. [Required(ErrorMessage = "TableName必填")]
  50. public string TableName { get; set; }
  51. /// <summary>
  52. /// 表描述
  53. /// </summary>
  54. public string TableDescription { get; set; }
  55. }
  56. /// <summary>
  57. /// 修改批量参数
  58. /// </summary>
  59. public class BatchEditConfigInput : BatchEditConfig, IValidatableObject
  60. {
  61. /// <summary>
  62. /// Id
  63. /// </summary>
  64. [IdNotNull(ErrorMessage = "Id不能为空")]
  65. public override long Id { get; set; }
  66. public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
  67. {
  68. if (Status == CommonStatusConst.ENABLE)
  69. {
  70. //如果是api请求并且必填参数有空的
  71. if (DataType.Contains("api") && (string.IsNullOrEmpty(RequestUrl) || string.IsNullOrEmpty(RequestType)
  72. || string.IsNullOrEmpty(RequestLabel) || string.IsNullOrEmpty(RequestValue)))
  73. {
  74. yield return new ValidationResult($"字段{ColumnName}接口信息必填", new[] { nameof(DataType) });
  75. }
  76. //如果是字典数据并且字典值为空
  77. if (DataType.Contains("dict") && string.IsNullOrEmpty(DictTypeCode))
  78. {
  79. yield return new ValidationResult($"字段{ColumnName}字典值必填", new[] { nameof(DictTypeCode) });
  80. }
  81. }
  82. }
  83. }
  84. /// <summary>
  85. /// 批量修改输入
  86. /// </summary>
  87. public class BatchEditInput
  88. {
  89. /// <summary>
  90. /// 批量编辑Code
  91. /// </summary>
  92. [Required(ErrorMessage = "Code不能为空")]
  93. public string Code { get; set; }
  94. /// <summary>
  95. /// Id列表
  96. /// </summary>
  97. [Required(ErrorMessage = "Ids不能为空")]
  98. public List<long>? Ids { get; set; }
  99. /// <summary>
  100. /// 字段列表
  101. /// </summary>
  102. [Required(ErrorMessage = "Columns不能为空")]
  103. public List<BatchEditColumn>? Columns { get; set; }
  104. }
  105. /// <summary>
  106. /// 批量修改DTO
  107. /// </summary>
  108. public class BatchEditColumn
  109. {
  110. [Required(ErrorMessage = "字段名必填")]
  111. public string TableColumn { get; set; }
  112. [Required(ErrorMessage = "字段值必填")]
  113. public object ColumnValue { get; set; }
  114. }