Synchronization code

This commit is contained in:
sunkaixuan
2023-05-17 16:28:45 +08:00
parent b5f68685c7
commit f96fd22059
5 changed files with 16 additions and 0 deletions

View File

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

View File

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

View File

@@ -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");

View File

@@ -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;
}

View File

@@ -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}) ";