Browse Source

Synchronization code

pull/33/head
sunkaixuan 1 year ago
parent
commit
90aff49603
  1. 12
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs
  2. 3
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/IDbMethods.cs
  3. 13
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs
  4. 6
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

12
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs

@ -28,6 +28,18 @@ namespace SqlSugar
{
return "SUM(" + model.Args[0].MemberName +") over()";
}
public string RowAvg(MethodCallExpressionModel model)
{
return "AVG(" + model.Args[0].MemberName + ") over()";
}
public string RowMin(MethodCallExpressionModel model)
{
return "Min(" + model.Args[0].MemberName + ") over()";
}
public string RowMax(MethodCallExpressionModel model)
{
return "Max(" + model.Args[0].MemberName + ") over()";
}
public virtual string IIF(MethodCallExpressionModel model)
{
var parameter = model.Args[0];

3
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/IDbMethods.cs

@ -91,6 +91,9 @@ namespace SqlSugar
string RowNumber(MethodCallExpressionModel model);
string RowCount(MethodCallExpressionModel model);
string RowSum(MethodCallExpressionModel model);
string RowMin(MethodCallExpressionModel model);
string RowMax(MethodCallExpressionModel model);
string RowAvg(MethodCallExpressionModel model);
string Exists(MethodCallExpressionModel model);
string GetDateString(string dateValue,string format);
string GetForXmlPath();

13
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs

@ -41,7 +41,18 @@ namespace SqlSugar
{
throw new NotSupportedException("Can only be used in expressions");
}
public static TRestult RowMax<TRestult>(TRestult filedName)
{
throw new NotSupportedException("Can only be used in expressions");
}
public static TRestult RowMin<TRestult>(TRestult filedName)
{
throw new NotSupportedException("Can only be used in expressions");
}
public static TRestult RowAvg<TRestult>(TRestult filedName)
{
throw new NotSupportedException("Can only be used in expressions");
}
public static string JsonField(object json,string fieldName)
{
throw new NotSupportedException("Can only be used in expressions");

6
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

@ -792,6 +792,12 @@ namespace SqlSugar
return this.Context.DbMehtods.RowCount(model);
case "RowSum":
return this.Context.DbMehtods.RowSum(model);
case "RowMax":
return this.Context.DbMehtods.RowMax(model);
case "RowMin":
return this.Context.DbMehtods.RowMin(model);
case "RowAvg":
return this.Context.DbMehtods.RowAvg(model);
case "Exists":
if (model.Args.Count > 1)
{

Loading…
Cancel
Save