diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/service_InputDto.cs.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/service_InputDto.cs.vm index 3a7272cf..c5c9d3d4 100644 --- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/service_InputDto.cs.vm +++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/service_InputDto.cs.vm @@ -86,7 +86,7 @@ if (@column.WhetherAddUpdate == "Y"){ @if(@column.WhetherRequired=="Y"){ @:[Required(ErrorMessage = "@(@column.ColumnComment)不能为空")] } - @if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")){ + @if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")&&@column.ColumnLength>0){ @:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")] } @if(@column.AnyRule){ @@ -143,7 +143,7 @@ if (@column.WhetherAddUpdate == "Y"){ @if(@column.WhetherRequired=="Y"){ @:[Required(ErrorMessage = "@(@column.ColumnComment)不能为空")] } - @if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")){ + @if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")&&@column.ColumnLength>0){ @:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")] } @if(@column.AnyRule){