Browse Source

Page Enum 数据类型查询修复

Cyrus Zhou 10 months ago
parent
commit
f089e76d48
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Admin.NET/Admin.NET.Web.Entry/wwwroot/template/Service.cs.vm

+ 5 - 1
Admin.NET/Admin.NET.Web.Entry/wwwroot/template/Service.cs.vm

@@ -64,7 +64,7 @@ public class @(Model.ClassName)Service : IDynamicApiController, ITransient
             } else if (column.NetType.TrimEnd('?') == "int" || column.NetType.TrimEnd('?') == "long") {
             @:.WhereIF(input.@(column.PropertyName) != null, u => u.@(column.PropertyName) @(column.QueryType) input.@(column.PropertyName))
             } else if (column.NetType.TrimEnd('?').EndsWith("Enum")) {
-            @:.WhereIF(input.@(column.PropertyName).HasValue, u => u.@(column.PropertyName) == input.@(column.PropertyName))
+            @:.WhereIF(input.@(column.PropertyName).HasValue, u => u.@(column.PropertyName) == (int)input.@(column.PropertyName))
             } else if (column.NetType.TrimEnd('?') == "DateTime" && column.QueryType == "~") {
             @:.WhereIF(input.@(column.PropertyName)Range?.Length == 2, u => u.@(column.PropertyName) >= input.@(column.PropertyName)Range[0] && u.@(column.PropertyName) <= input.@(column.PropertyName)Range[1])
             }
@@ -79,7 +79,11 @@ public class @(Model.ClassName)Service : IDynamicApiController, ITransient
             @:.Select((@joinTableName) => new @(Model.ClassName)Output
             @:{
             foreach (var column in Model.TableField) {
+                if(column.NetType.TrimEnd('?').EndsWith("Enum")) {
+                @:@(column.PropertyName) = (@(column.NetType))u.@(column.PropertyName),
+                }else{
                 @:@(column.PropertyName) = u.@(column.PropertyName),
+                }
                 if (column.EffectType == "ForeignKey" || column.EffectType == "ApiTreeSelector") {
                 @:@(column.ExtendedPropertyName) = @column.GetDisplayColumn(column.LowerPropertyNameTrimEndId),
                 }