Synchronization code

This commit is contained in:
sunkaixuan
2023-06-29 18:53:53 +08:00
parent 95c977ff0e
commit eada2c5454
4 changed files with 21 additions and 1 deletions

View File

@@ -755,7 +755,16 @@ namespace SqlSugar
return $" ({likeString1} or {likeString2} or {likeString3} or {fullString}={value} ) "; return $" ({likeString1} or {likeString2} or {likeString3} or {fullString}={value} ) ";
} }
public string Like(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
var parameter2 = model.Args[1];
return string.Format(" ({0} like {1} ) ", parameter.MemberName, parameter2.MemberName);
}
public string ToSingle(MethodCallExpressionModel model)
{
return ToDecimal(model);
}
public string ListAny(MethodCallExpressionModel model) public string ListAny(MethodCallExpressionModel model)
{ {
if (IsArrayAnyParameter(model)) if (IsArrayAnyParameter(model))

View File

@@ -111,5 +111,7 @@ namespace SqlSugar
string ListAny(MethodCallExpressionModel model); string ListAny(MethodCallExpressionModel model);
string GetTableWithDataBase(string databaseName,string tableName); string GetTableWithDataBase(string databaseName,string tableName);
string Modulo(MethodCallExpressionModel mode); string Modulo(MethodCallExpressionModel mode);
string Like(MethodCallExpressionModel mode);
string ToSingle(MethodCallExpressionModel mode);
} }
} }

View File

@@ -9,6 +9,10 @@ namespace SqlSugar
{ {
public partial class SqlFunc public partial class SqlFunc
{ {
public static bool Like(string fieldName, string likeValue)
{
throw new NotSupportedException("Can only be used in expressions");
}
public static int Modulo(decimal numA, decimal numB) public static int Modulo(decimal numA, decimal numB)
{ {
throw new NotSupportedException("Can only be used in expressions"); throw new NotSupportedException("Can only be used in expressions");
@@ -228,6 +232,7 @@ namespace SqlSugar
public static string MergeString(string value1, string value2, string value3, string value4, string value5,string value6) { throw new NotSupportedException("Can only be used in expressions"); } public static string MergeString(string value1, string value2, string value3, string value4, string value5,string value6) { throw new NotSupportedException("Can only be used in expressions"); }
public static string MergeString(string value1, string value2, string value3, string value4, string value5, string value6,string value7) { throw new NotSupportedException("Can only be used in expressions"); } public static string MergeString(string value1, string value2, string value3, string value4, string value5, string value6,string value7) { throw new NotSupportedException("Can only be used in expressions"); }
public static int ToInt32(object value) { return value.ObjToInt(); } public static int ToInt32(object value) { return value.ObjToInt(); }
public static float ToSingle(object value) { return Convert.ToSingle(value); }
public static long ToInt64(object value) { return Convert.ToInt64(value); } public static long ToInt64(object value) { return Convert.ToInt64(value); }
/// <summary> /// <summary>
/// yyyy-MM-dd HH:mm:ss.fff /// yyyy-MM-dd HH:mm:ss.fff

View File

@@ -846,6 +846,10 @@ namespace SqlSugar
return this.Context.DbMehtods.ListAny(model); return this.Context.DbMehtods.ListAny(model);
case "Modulo": case "Modulo":
return this.Context.DbMehtods.Modulo(model); return this.Context.DbMehtods.Modulo(model);
case "Like":
return this.Context.DbMehtods.Like(model);
case "ToSingle":
return this.Context.DbMehtods.ToSingle(model);
default: default:
break; break;
} }