Browse Source

Synchronization code

pull/33/head
sunkaixuan 2 years ago
parent
commit
f96fd22059
  1. 5
      Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs
  2. 1
      Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/IDbMethods.cs
  3. 4
      Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs
  4. 2
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs
  5. 4
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleExpressionContext.cs

5
Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs

@ -817,5 +817,10 @@ namespace SqlSugar
{
return $"{dataBaseName}.{tableName}";
}
public virtual string Modulo(MethodCallExpressionModel model)
{
return "("+model.Args[0].MemberName + " % "+ model.Args[1].MemberName+")";
}
}
}

1
Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/IDbMethods.cs

@ -107,5 +107,6 @@ namespace SqlSugar
string SplitIn(MethodCallExpressionModel model);
string ListAny(MethodCallExpressionModel model);
string GetTableWithDataBase(string databaseName,string tableName);
string Modulo(MethodCallExpressionModel mode);
}
}

4
Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs

@ -9,6 +9,10 @@ namespace SqlSugar
{
public partial class SqlFunc
{
public static int Modulo(decimal numA, decimal numB)
{
throw new NotSupportedException("Can only be used in expressions");
}
public static int CompareTo(decimal numA, decimal numB)
{
throw new NotSupportedException("Can only be used in expressions");

2
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

@ -835,6 +835,8 @@ namespace SqlSugar
case "ListAny":
this.Context.Parameters.RemoveAll(it => model.Args[0].MemberName.ObjToString().Contains(it.ParameterName));
return this.Context.DbMehtods.ListAny(model);
case "Modulo":
return this.Context.DbMehtods.Modulo(model);
default:
break;
}

4
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleExpressionContext.cs

@ -72,6 +72,10 @@ namespace SqlSugar
}
public partial class OracleMethod : DefaultDbMethod, IDbMethods
{
public override string Modulo(MethodCallExpressionModel model)
{
return " MOD(" + model.Args[0].MemberName+ " , " + model.Args[1].MemberName+")";
}
public override string GetStringJoinSelector(string result, string separator)
{
return $"listagg(to_char({result}),'{separator}') within group(order by {result}) ";

Loading…
Cancel
Save