优化if (isExist) throw Oops.Oh(ErrorCode.E0001);,提示的更细节一些
| | |
| | | /// <returns></returns> |
| | | private async Task CheckExisit( @(@Model.ClassName) input,bool isEdit=false) |
| | | { |
| | | |
| | | |
| | | @{ |
| | | var columnIndex = 0; |
| | | string my_message = string.Empty; |
| | | } |
| | | |
| | | @foreach (var column in Model.TableField) |
| | | { |
| | | if (@column.WhetherUnionKey == "Y") |
| | | { |
| | | my_message += "," + @column.ColumnComment + "[{input." + @column.ColumnName + "}]"; |
| | | } |
| | | if (@column.WhetherUnionKey == "Y") |
| | | { |
| | | columnIndex++; |
| | |
| | | @:,false); |
| | | @:} |
| | | } |
| | | |
| | | |
| | | |
| | | @if(columnIndex>0){ |
| | | @:if (isExist) throw Oops.Oh(ErrorCode.E0001); |
| | | @:if (isExist) throw Oops.Oh($"验证失败@(@my_message)已存在"); |
| | | }else{ |
| | | @://没有配置联合主键,不需要验重 |
| | | } |