修改模板

main
forget_the_bright 1 year ago
parent 61b91aaa64
commit d0d7d0bc7f

@ -1,4 +1,5 @@
using System; using System;
using FluentValidation;
using NCA_MES_Models.CommonUtils.DB.DBAttribute; using NCA_MES_Models.CommonUtils.DB.DBAttribute;
namespace ${namespace_name} namespace ${namespace_name}
@ -25,4 +26,20 @@ $end
$end $end
} }
/// <summary>
/// 验证类 采用FluentValidation
/// 项目地址 https://github.com/FluentValidation/FluentValidation
/// 文档地址 https://docs.fluentvalidation.net/en/latest/start.html
/// </summary>
public class ${table_name}Validator : AbstractValidator<${table_name}>
{
public ${table_name}Validator()
{
$foreach(filedInfo in filedInfos)
$if(filedInfo["is_nullable"]=="true")
RuleFor(item => item.${filedInfo["field_name"]}).NotNull().WithMessage("${filedInfo["comment"]}不能为空");
$end
$end
}
}
} }
Loading…
Cancel
Save