Forráskód Böngészése

添加查询源数据排序功能

lcl 3 hónapja
szülő
commit
c956a28ae0

+ 1 - 1
Model/Database/PriList.cs

@@ -118,7 +118,7 @@ namespace Model
         /// <summary>
         /// 奖励金额来源数据
         /// </summary>
-        [SugarColumn(ColumnDescription = "奖励金额来源数据", Length = 50, ColumnName = "prize_source_field")]
+        [SugarColumn(ColumnDescription = "奖励金额来源数据", Length = 500, ColumnName = "prize_source_field")]
         public string? prizeSourceField { get; set; }
 
 

+ 7 - 0
Model/Database/PriQueryTable.cs

@@ -94,6 +94,13 @@ namespace Model
         public int stepCount { get; set; }
 
 
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [SugarColumn(ColumnDescription = "排序", Length = 200, ColumnName = "order_by")]
+        public string? orderBy { get; set; }
+
+
         /// <summary>
         /// 自定义sql查询
         /// </summary>

+ 7 - 0
Model/Database/PriRecursionStartTable.cs

@@ -80,6 +80,13 @@ namespace Model
         public int databaseId { get; set; }
 
 
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [SugarColumn(ColumnDescription = "排序", Length = 200, ColumnName = "order_by")]
+        public string? orderBy { get; set; }
+
+
 
     }
 }

+ 7 - 1
Model/Vo/Admin/GetPriQueryTableQueryVo.cs

@@ -49,10 +49,16 @@ namespace Vo.Admin
         public int stepCount { get; set; }
 
 
+        /// <summary>
+        /// 排序
+        /// </summary>
+        public string orderBy { get; set; }
+
+
         /// <summary>
         /// 自定义sql查询
         /// </summary>
-        public string? customSql { get; set; }
+        public string customSql { get; set; }
 
 
 

+ 6 - 0
Model/Vo/Admin/GetPriRecursionStartTableQueryVo.cs

@@ -31,6 +31,12 @@ namespace Vo.Admin
         public int databaseId { get; set; }
 
 
+        /// <summary>
+        /// 排序
+        /// </summary>
+        public string orderBy { get; set; }
+
+
 
     }
 }

+ 14 - 0
Util/PrizeDo.cs

@@ -400,6 +400,11 @@ namespace Util
                         }
                     }
                     sql = "select " + fields + " from " + tableEnName + " where 1=1" + condi;
+                    if(!string.IsNullOrEmpty(queryTable.tableEnName))
+                    {
+                        sql += " " + queryTable.tableEnName;
+                    }
+                    sql += " limit 1";
                 }
                 else
                 {
@@ -717,6 +722,10 @@ namespace Util
                 if(!string.IsNullOrEmpty(groupBy)) groupBy = " group by " + groupBy.TrimEnd(',') + " order by " + groupBy.TrimEnd(',');
 
                 var db = initDb(queryTable.databaseId);
+                if(!string.IsNullOrEmpty(queryTable.tableEnName))
+                {
+                    groupBy += " " + queryTable.tableEnName;
+                }
                 string sql = "select " + fields + " from " + tableEnName + " where 1=1" + condi + groupBy + " limit " + skip + "," + size;
                 var items = db.Ado.GetDataTable(sql);
                 return items;
@@ -2159,6 +2168,11 @@ namespace Util
 
                 var db = initDb(queryTable.databaseId);
                 string sql = "select " + fields + " from " + tableEnName + " where 1=1" + condi;
+                if(!string.IsNullOrEmpty(queryTable.tableEnName))
+                {
+                    sql += " " + queryTable.tableEnName;
+                }
+                sql += " limit 1";
                 var items = db.Ado.GetDataTable(sql);
                 if(items.Rows.Count > 0)
                 {