平安校园
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.
 
 
 
 
 
 

139 lines
3.2 KiB

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