mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
Synchronization code
This commit is contained in:
@@ -968,5 +968,11 @@ namespace SqlSugar
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $" DATE_PART('week', {parameterNameA})+1 ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -113,5 +113,6 @@ namespace SqlSugar
|
|||||||
string Modulo(MethodCallExpressionModel mode);
|
string Modulo(MethodCallExpressionModel mode);
|
||||||
string Like(MethodCallExpressionModel mode);
|
string Like(MethodCallExpressionModel mode);
|
||||||
string ToSingle(MethodCallExpressionModel mode);
|
string ToSingle(MethodCallExpressionModel mode);
|
||||||
|
string WeekOfYear(MethodCallExpressionModel mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class SqlFunc
|
public partial class SqlFunc
|
||||||
{
|
{
|
||||||
|
public static int WeekOfYear(DateTime fieldName)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
|
}
|
||||||
public static bool Like(string fieldName, string likeValue)
|
public static bool Like(string fieldName, string likeValue)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Can only be used in expressions");
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
|
@@ -855,6 +855,10 @@ namespace SqlSugar
|
|||||||
case "ToSingle":
|
case "ToSingle":
|
||||||
return this.Context.DbMehtods.ToSingle(model);
|
return this.Context.DbMehtods.ToSingle(model);
|
||||||
default:
|
default:
|
||||||
|
if (typeof(IDbMethods).GetMethods().Any(it => it.Name == name))
|
||||||
|
{
|
||||||
|
return this.Context.DbMehtods.GetType().GetMethod(name).Invoke(this.Context.DbMehtods,new object[] { model});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public partial class DmMethod : DefaultDbMethod, IDbMethods
|
public partial class DmMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $"TO_NUMBER(TO_CHAR({parameterNameA}, 'WW')) ";
|
||||||
|
}
|
||||||
public override string ParameterKeyWord { get; set; } = ":";
|
public override string ParameterKeyWord { get; set; } = ":";
|
||||||
public override string GetStringJoinSelector(string result, string separator)
|
public override string GetStringJoinSelector(string result, string separator)
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public class MySqlMethod : DefaultDbMethod, IDbMethods
|
public class MySqlMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $" WEEK({parameterNameA}) ";
|
||||||
|
}
|
||||||
public override string GetStringJoinSelector(string result, string separator)
|
public override string GetStringJoinSelector(string result, string separator)
|
||||||
{
|
{
|
||||||
return $"group_concat({result} separator '{separator}') ";
|
return $"group_concat({result} separator '{separator}') ";
|
||||||
|
@@ -76,6 +76,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public partial class OracleMethod : DefaultDbMethod, IDbMethods
|
public partial class OracleMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $"TO_NUMBER(TO_CHAR({parameterNameA}, 'WW')) ";
|
||||||
|
}
|
||||||
public override string BitwiseAnd(MethodCallExpressionModel model)
|
public override string BitwiseAnd(MethodCallExpressionModel model)
|
||||||
{
|
{
|
||||||
var parameter = model.Args[0];
|
var parameter = model.Args[0];
|
||||||
|
@@ -20,6 +20,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
|
public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $"DATEPART(WEEK, {parameterNameA}) ";
|
||||||
|
}
|
||||||
public override string GetTableWithDataBase(string dataBaseName, string tableName)
|
public override string GetTableWithDataBase(string dataBaseName, string tableName)
|
||||||
{
|
{
|
||||||
return $"{dataBaseName}.dbo.{tableName}";
|
return $"{dataBaseName}.dbo.{tableName}";
|
||||||
|
@@ -17,12 +17,17 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public class SqliteMethod : DefaultDbMethod, IDbMethods
|
public class SqliteMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||||
|
{
|
||||||
|
var parameterNameA = mode.Args[0].MemberName;
|
||||||
|
return $"STRFTIME('%W', {parameterNameA})+1 ";
|
||||||
|
}
|
||||||
public override string Equals(MethodCallExpressionModel model)
|
public override string Equals(MethodCallExpressionModel model)
|
||||||
{
|
{
|
||||||
var result = base.Equals(model);
|
var result= base.Equals(model);
|
||||||
if (model.Args.Count == 3 && result.Trim().Last() == ')')
|
if (model.Args.Count == 3&& result.Trim().Last()==')')
|
||||||
{
|
{
|
||||||
result = (" " + result.Trim().TrimEnd(')') + " COLLATE NOCASE ) ");
|
result = (" "+result.Trim().TrimEnd(')') + " COLLATE NOCASE ) ");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user