mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-26 05:32:53 +08:00
Update Core
This commit is contained in:
@@ -109,7 +109,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
var parameter3 = model.Args[2];
|
||||
return string.Format(" (DATEDIFF({2},{0},{1})=0) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberName);
|
||||
return string.Format(" (DATEDIFF({2},{0},{1})=0) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberValue);
|
||||
}
|
||||
|
||||
public virtual string DateAddByType(MethodCallExpressionModel model)
|
||||
@@ -117,7 +117,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
var parameter3 = model.Args[2];
|
||||
return string.Format(" (DATEADD({2},{1},{0})) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberName);
|
||||
return string.Format(" (DATEADD({2},{1},{0})) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberValue);
|
||||
}
|
||||
|
||||
public virtual string DateAddDay(MethodCallExpressionModel model)
|
||||
@@ -153,7 +153,7 @@ namespace SqlSugar
|
||||
{
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
return string.Format(" ({0}({1})) ", parameter2.MemberName, parameter.MemberName);
|
||||
return string.Format(" DateName({0},{1}) ", parameter2.MemberValue, parameter.MemberName);
|
||||
}
|
||||
|
||||
public virtual string ToInt32(MethodCallExpressionModel model)
|
||||
|
||||
@@ -61,12 +61,12 @@ namespace SqlSugar
|
||||
{
|
||||
return ((DateTime)date1).ToString("yyyy-MM-dd") == ((DateTime)date2).ToString("yyyy-MM-dd");
|
||||
}
|
||||
public static bool DateIsSame(DateTime date1, DateTime date2, DateType dataType) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static DateTime DateAdd(DateTime date, int addValue, DateType dataType) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static DateTime DateAdd(DateTime date, int addValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static int DateValue(DateTime date, DateType dataType) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static bool Between(object value, object start, object end) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult IIF<TResult>(bool Expression, TResult thenValue, TResult elseValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static bool DateIsSame(DateTime date1, DateTime date2, DateType dataType) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static DateTime DateAdd(DateTime date, int addValue, DateType dataType) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static DateTime DateAdd(DateTime date, int addValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static int DateValue(DateTime date, DateType dataType) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static bool Between(object value, object start, object end) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult IIF<TResult>(bool Expression, TResult thenValue, TResult elseValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static int ToInt32(object value) { return value.ObjToInt(); }
|
||||
public static long ToInt64(object value) { return Convert.ToInt64(value); }
|
||||
/// <summary>
|
||||
@@ -80,7 +80,7 @@ namespace SqlSugar
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static TimeSpan ToTime(object value) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TimeSpan ToTime(object value) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static string ToString(object value) { return value.ObjToString(); }
|
||||
public static decimal ToDecimal(object value) { return value.ObjToDecimal(); }
|
||||
public static Guid ToGuid(object value) { return Guid.Parse(value.ObjToString()); }
|
||||
@@ -89,18 +89,18 @@ namespace SqlSugar
|
||||
public static string Substring(object value, int index, int length) { return value.ObjToString().Substring(index, length); }
|
||||
public static string Replace(object value, string oldChar, string newChar) { return value.ObjToString().Replace(oldChar, newChar); }
|
||||
public static int Length(object value) { return value.ObjToString().Length; }
|
||||
public static TResult AggregateSum<TResult>(TResult thisValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult AggregateAvg<TResult>(TResult thisValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult AggregateMin<TResult>(TResult thisValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult AggregateCount<TResult>(TResult thisValue) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult MappingColumn<TResult>(TResult oldColumnName,string newColumnName) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult AggregateSum<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateAvg<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateMin<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateCount<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult MappingColumn<TResult>(TResult oldColumnName,string newColumnName) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
/// <summary>
|
||||
///Example: new NewT(){name=SqlFunc.GetSelfAndAutoFill(it)} Generated SQL it.*
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult GetSelfAndAutoFill<TResult>(TResult value) { throw new NotSupportedException("This method is not supported by the current parameter"); }
|
||||
public static TResult GetSelfAndAutoFill<TResult>(TResult value) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,33 @@ namespace SqlSugar
|
||||
this.Context.Result.Append(appendValue);
|
||||
}
|
||||
}
|
||||
else if ((oppoSiteExpression is UnaryExpression && (oppoSiteExpression as UnaryExpression).Operand is MemberExpression)) {
|
||||
string appendValue = Context.SqlParameterKeyWord
|
||||
+ ((MemberExpression)(oppoSiteExpression as UnaryExpression).Operand).Member.Name
|
||||
+ Context.ParameterIndex;
|
||||
if (value.ObjToString() != "NULL" && !parameter.ValueIsNull)
|
||||
{
|
||||
this.Context.Parameters.Add(new SugarParameter(appendValue, value));
|
||||
}
|
||||
else
|
||||
{
|
||||
appendValue = value.ObjToString();
|
||||
}
|
||||
Context.ParameterIndex++;
|
||||
appendValue = string.Format(" {0} ", appendValue);
|
||||
if (isLeft == true)
|
||||
{
|
||||
appendValue += ExpressionConst.Format1 + parameter.BaseParameter.Index;
|
||||
}
|
||||
if (this.Context.Result.Contains(ExpressionConst.Format0))
|
||||
{
|
||||
this.Context.Result.Replace(ExpressionConst.Format0, appendValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Context.Result.Append(appendValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var appendValue = this.Context.SqlParameterKeyWord + ExpressionConst.Const + Context.ParameterIndex;
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace SqlSugar
|
||||
if (lsbs && parameter.ValueIsNull)
|
||||
{
|
||||
base.Context.Result.Replace(ExpressionConst.Format1 + parameter.Index, isEqual ? "IS" : "IS NOT");
|
||||
base.Context.Result.Replace(ExpressionConst.Format1 + (parameter.Index+1), isEqual ? "IS" : "IS NOT");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -18,14 +18,15 @@ namespace SqlSugar
|
||||
var isBool = expression.Type == PubConst.BoolType;
|
||||
var isValueBool = isValue && isBool && parameter.BaseExpression == null;
|
||||
var isLength = expression.Member.Name == "Length" && (expression.Expression as MemberExpression).Type == PubConst.StringType;
|
||||
var isDateValue = expression.Member.Name.IsIn(Enum.GetNames(typeof(DateType))) && (expression.Expression as MemberExpression).Type == PubConst.DateType;
|
||||
if (isLength)
|
||||
{
|
||||
var oldCommonTempDate = parameter.CommonTempData;
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
this.Expression = expression.Expression;
|
||||
var isConst=this.Expression is ConstantExpression;
|
||||
var isConst = this.Expression is ConstantExpression;
|
||||
this.Start();
|
||||
var methodParamter = new MethodCallExpressionArgs() { IsMember = !isConst, MemberName = parameter.CommonTempData, MemberValue = null };
|
||||
var methodParamter = new MethodCallExpressionArgs() { IsMember = !isConst, MemberName = parameter.CommonTempData, MemberValue = null };
|
||||
var result = this.Context.DbMehtods.Length(new MethodCallExpressionModel()
|
||||
{
|
||||
Args = new List<MethodCallExpressionArgs>() {
|
||||
@@ -36,6 +37,24 @@ namespace SqlSugar
|
||||
parameter.CommonTempData = oldCommonTempDate;
|
||||
return;
|
||||
}
|
||||
else if (isDateValue) {
|
||||
var name = expression.Member.Name;
|
||||
var oldCommonTempDate = parameter.CommonTempData;
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
this.Expression = expression.Expression;
|
||||
var isConst = this.Expression is ConstantExpression;
|
||||
this.Start();
|
||||
var result = this.Context.DbMehtods.DateValue(new MethodCallExpressionModel()
|
||||
{
|
||||
Args = new List<MethodCallExpressionArgs>() {
|
||||
new MethodCallExpressionArgs() { IsMember = !isConst, MemberName = parameter.CommonTempData, MemberValue = null },
|
||||
new MethodCallExpressionArgs() { IsMember = true, MemberName = name, MemberValue = name }
|
||||
}
|
||||
});
|
||||
base.AppendMember(parameter, isLeft, result);
|
||||
parameter.CommonTempData = oldCommonTempDate;
|
||||
return;
|
||||
}
|
||||
else if (isValueBool)
|
||||
{
|
||||
isValue = false;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace SqlSugar
|
||||
appendArgs = new List<MethodCallExpressionArgs>();
|
||||
var dateType = MethodTimeMapping[methodName];
|
||||
string paramterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
appendArgs.Add(new MethodCallExpressionArgs() { IsMember=false, MemberName= paramterName, MemberValue=dateType });
|
||||
appendArgs.Add(new MethodCallExpressionArgs() { IsMember = false, MemberName = paramterName, MemberValue = dateType });
|
||||
this.Context.Parameters.Add(new SugarParameter(paramterName, dateType.ToString()));
|
||||
this.Context.ParameterIndex++;
|
||||
methodName = "DateAdd";
|
||||
@@ -47,7 +47,7 @@ namespace SqlSugar
|
||||
}
|
||||
if (isValidNativeMethod)
|
||||
{
|
||||
NativeExtensionMethod(parameter, express, isLeft, MethodMapping[methodName],appendArgs);
|
||||
NativeExtensionMethod(parameter, express, isLeft, MethodMapping[methodName], appendArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -77,11 +77,12 @@ namespace SqlSugar
|
||||
break;
|
||||
case ResolveExpressType.FieldSingle:
|
||||
case ResolveExpressType.FieldMultiple:
|
||||
Field(parameter, isLeft, name, args, model);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void NativeExtensionMethod(ExpressionParameter parameter, MethodCallExpression express, bool? isLeft, string name, List<MethodCallExpressionArgs> appendArgs = null)
|
||||
{
|
||||
var method = express.Method;
|
||||
@@ -110,26 +111,29 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private void Field(ExpressionParameter parameter, bool? isLeft, string name, IEnumerable<Expression> args, MethodCallExpressionModel model, List<MethodCallExpressionArgs> appendArgs = null)
|
||||
{
|
||||
if (this.Context.ResolveType == ResolveExpressType.FieldSingle)
|
||||
{
|
||||
this.Context.ResolveType = ResolveExpressType.WhereSingle;
|
||||
}
|
||||
else {
|
||||
this.Context.ResolveType = ResolveExpressType.WhereMultiple;
|
||||
}
|
||||
Where(parameter, isLeft, name, args, model);
|
||||
}
|
||||
private void Select(ExpressionParameter parameter, bool? isLeft, string name, IEnumerable<Expression> args, MethodCallExpressionModel model, List<MethodCallExpressionArgs> appendArgs = null)
|
||||
{
|
||||
if (name == "GetSelfAndAutoFill")
|
||||
{
|
||||
var memberValue = (args.First() as MemberExpression).Expression.ToString();
|
||||
model.Args.Add(new MethodCallExpressionArgs() { MemberValue= memberValue, IsMember=true, MemberName= memberValue });
|
||||
model.Args.Add(new MethodCallExpressionArgs() { MemberValue = memberValue, IsMember = true, MemberName = memberValue });
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in args)
|
||||
{
|
||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||
if (isBinaryExpression)
|
||||
{
|
||||
model.Args.Add(GetMethodCallArgs(parameter, item));
|
||||
}
|
||||
else
|
||||
{
|
||||
Default(parameter, model, item);
|
||||
}
|
||||
AppendItem(parameter, name, args, model, item);
|
||||
}
|
||||
if (appendArgs != null)
|
||||
{
|
||||
@@ -142,15 +146,7 @@ namespace SqlSugar
|
||||
{
|
||||
foreach (var item in args)
|
||||
{
|
||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||
if (isBinaryExpression)
|
||||
{
|
||||
model.Args.Add(GetMethodCallArgs(parameter, item));
|
||||
}
|
||||
else
|
||||
{
|
||||
Default(parameter, model, item);
|
||||
}
|
||||
AppendItem(parameter, name, args, model, item);
|
||||
}
|
||||
if (appendArgs != null)
|
||||
{
|
||||
@@ -159,7 +155,105 @@ namespace SqlSugar
|
||||
var methodValue = GetMdthodValue(name, model);
|
||||
base.AppendValue(parameter, isLeft, methodValue);
|
||||
}
|
||||
private void Default(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item)
|
||||
|
||||
private void AppendItem(ExpressionParameter parameter, string name, IEnumerable<Expression> args, MethodCallExpressionModel model, Expression item)
|
||||
{
|
||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||
var isConst = item is ConstantExpression;
|
||||
var isIIF= name == "IIF";
|
||||
var isIFFBoolMember = isIIF && (item is MemberExpression) && (item as MemberExpression).Type == PubConst.BoolType;
|
||||
var isIFFUnary = isIIF && (item is UnaryExpression) && (item as UnaryExpression).Operand.Type == PubConst.BoolType;
|
||||
var isIFFBoolBinary = isIIF && (item is BinaryExpression) && (item as BinaryExpression).Type == PubConst.BoolType;
|
||||
var isIFFBoolMethod = isIIF && (item is MethodCallExpression) && (item as MethodCallExpression).Type == PubConst.BoolType;
|
||||
var isFirst = item == args.First();
|
||||
if (isFirst && isIIF && isConst)
|
||||
{
|
||||
var value = (item as ConstantExpression).Value.ObjToBool() ? this.Context.DbMehtods.True() : this.Context.DbMehtods.False();
|
||||
var methodCallExpressionArgs = new MethodCallExpressionArgs()
|
||||
{
|
||||
IsMember = true,
|
||||
MemberName = value,
|
||||
MemberValue = value
|
||||
};
|
||||
model.Args.Add(methodCallExpressionArgs);
|
||||
}
|
||||
else if (isIFFUnary && !isFirst)
|
||||
{
|
||||
AppendModelByIIFMember(parameter, model, (item as UnaryExpression).Operand);
|
||||
}
|
||||
else if (isIFFBoolMember && !isFirst)
|
||||
{
|
||||
AppendModelByIIFMember(parameter, model, item);
|
||||
|
||||
}
|
||||
else if (isIFFBoolBinary && !isFirst)
|
||||
{
|
||||
AppendModelByIIFBinary(parameter, model, item);
|
||||
|
||||
}
|
||||
else if (isIFFBoolMethod && !isFirst) {
|
||||
AppendModelByIIFMethod(parameter, model, item);
|
||||
}
|
||||
else if (isBinaryExpression)
|
||||
{
|
||||
model.Args.Add(GetMethodCallArgs(parameter, item));
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendModel(parameter, model, item);
|
||||
}
|
||||
}
|
||||
private void AppendModelByIIFMember(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item)
|
||||
{
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
base.Expression = item;
|
||||
base.Start();
|
||||
var methodCallExpressionArgs = new MethodCallExpressionArgs()
|
||||
{
|
||||
IsMember = parameter.ChildExpression is MemberExpression,
|
||||
MemberName = parameter.CommonTempData
|
||||
};
|
||||
if (methodCallExpressionArgs.IsMember && parameter.ChildExpression != null && parameter.ChildExpression.ToString() == "DateTime.Now")
|
||||
{
|
||||
methodCallExpressionArgs.IsMember = false;
|
||||
}
|
||||
var value = methodCallExpressionArgs.MemberName;
|
||||
if (methodCallExpressionArgs.IsMember)
|
||||
{
|
||||
var childExpression = parameter.ChildExpression as MemberExpression;
|
||||
if (childExpression.Expression != null && childExpression.Expression is ConstantExpression)
|
||||
{
|
||||
methodCallExpressionArgs.IsMember = false;
|
||||
}
|
||||
}
|
||||
if (methodCallExpressionArgs.IsMember == false)
|
||||
{
|
||||
var parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.MethodConst + this.Context.ParameterIndex;
|
||||
this.Context.ParameterIndex++;
|
||||
methodCallExpressionArgs.MemberName = parameterName;
|
||||
methodCallExpressionArgs.MemberValue = value;
|
||||
this.Context.Parameters.Add(new SugarParameter(parameterName, value));
|
||||
}
|
||||
model.Args.Add(methodCallExpressionArgs);
|
||||
parameter.ChildExpression = null;
|
||||
}
|
||||
private void AppendModelByIIFBinary(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item)
|
||||
{
|
||||
Check.Exception(true, "The SqlFunc.IIF(arg1,arg2,arg3) , {0} argument do not support ", item.ToString());
|
||||
}
|
||||
private void AppendModelByIIFMethod(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item)
|
||||
{
|
||||
var methodExpression = item as MethodCallExpression;
|
||||
if (methodExpression.Method.Name.IsIn("ToBool", "ToBoolean","IIF"))
|
||||
{
|
||||
model.Args.Add(base.GetMethodCallArgs(parameter, item));
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Exception(true, "The SqlFunc.IIF(arg1,arg2,arg3) , {0} argument do not support ", item.ToString());
|
||||
}
|
||||
}
|
||||
private void AppendModel(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item)
|
||||
{
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
base.Expression = item;
|
||||
@@ -215,23 +309,33 @@ namespace SqlSugar
|
||||
case "Contains":
|
||||
return this.Context.DbMehtods.Contains(model);
|
||||
case "ContainsArray":
|
||||
var result = this.Context.DbMehtods.ContainsArray(model);
|
||||
var caResult = this.Context.DbMehtods.ContainsArray(model);
|
||||
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[0].MemberName.ObjToString());
|
||||
return result;
|
||||
return caResult;
|
||||
case "Equals":
|
||||
return this.Context.DbMehtods.Equals(model);
|
||||
case "DateIsSame":
|
||||
if (model.Args.Count == 2)
|
||||
return this.Context.DbMehtods.DateIsSameDay(model);
|
||||
else
|
||||
return this.Context.DbMehtods.DateIsSameByType(model);
|
||||
{
|
||||
var dsResult = this.Context.DbMehtods.DateIsSameByType(model);
|
||||
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[2].MemberName.ObjToString());
|
||||
return dsResult;
|
||||
}
|
||||
case "DateAdd":
|
||||
if (model.Args.Count == 2)
|
||||
return this.Context.DbMehtods.DateAddDay(model);
|
||||
else
|
||||
return this.Context.DbMehtods.DateAddByType(model);
|
||||
{
|
||||
var daResult = this.Context.DbMehtods.DateAddByType(model);
|
||||
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[2].MemberName.ObjToString());
|
||||
return daResult;
|
||||
}
|
||||
case "DateValue":
|
||||
return this.Context.DbMehtods.DateValue(model);
|
||||
var dvResult = this.Context.DbMehtods.DateValue(model);
|
||||
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[1].MemberName.ObjToString());
|
||||
return dvResult;
|
||||
case "Between":
|
||||
return this.Context.DbMehtods.Between(model);
|
||||
case "StartsWith":
|
||||
@@ -280,7 +384,7 @@ namespace SqlSugar
|
||||
return mappingColumnResult;
|
||||
case "GetSelfAndAutoFill":
|
||||
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[0].MemberName.ObjToString());
|
||||
return this.Context.DbMehtods.GetSelfAndAutoFill(model.Args[0].MemberValue.ObjToString(),this.Context.IsSingle);
|
||||
return this.Context.DbMehtods.GetSelfAndAutoFill(model.Args[0].MemberValue.ObjToString(), this.Context.IsSingle);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,13 @@ namespace SqlSugar
|
||||
base.Expression = expression.Operand;
|
||||
var isMember = expression.Operand is MemberExpression;
|
||||
var isConst = expression.Operand is ConstantExpression;
|
||||
if (baseParameter.CurrentExpression is NewArrayExpression)
|
||||
var offsetIsNull = (parameter.OppsiteExpression is ConstantExpression)
|
||||
&&(parameter.OppsiteExpression as ConstantExpression).Value==null
|
||||
&&ExpressionTool.IsComparisonOperator(expression.Operand);
|
||||
if (isMember && offsetIsNull) {
|
||||
Append(parameter, nodeType);
|
||||
}
|
||||
else if (baseParameter.CurrentExpression is NewArrayExpression)
|
||||
{
|
||||
Result(parameter, nodeType);
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ using System.Runtime.InteropServices;
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("1c022a5c-4e4d-4026-a8a3-f659b9740a1a")]
|
||||
[assembly: AssemblyVersion("4.3.2.5")]
|
||||
[assembly: AssemblyFileVersion("4.3.2.5")]
|
||||
[assembly: AssemblyVersion("4.3.2.6")]
|
||||
[assembly: AssemblyFileVersion("4.3.2.6")]
|
||||
|
||||
@@ -54,6 +54,12 @@ namespace SqlSugar
|
||||
}
|
||||
public class MySqlMethod : DefaultDbMethod, IDbMethods
|
||||
{
|
||||
public override string DateValue(MethodCallExpressionModel model)
|
||||
{
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
return string.Format(" {0}({1}) ", parameter2.MemberValue, parameter.MemberName);
|
||||
}
|
||||
|
||||
public override string Contains(MethodCallExpressionModel model)
|
||||
{
|
||||
@@ -88,7 +94,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
var parameter3 = model.Args[2];
|
||||
return string.Format(" (TIMESTAMPDIFF({2},{0},{1})=0) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberName);
|
||||
return string.Format(" (TIMESTAMPDIFF({2},{0},{1})=0) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberValue);
|
||||
}
|
||||
|
||||
public override string DateAddByType(MethodCallExpressionModel model)
|
||||
@@ -96,7 +102,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
var parameter3 = model.Args[2];
|
||||
return string.Format(" (DATE_ADD({1} INTERVAL {2} {0})) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberName);
|
||||
return string.Format(" (DATE_ADD({1} , INTERVAL {2} {0})) ", parameter3.MemberValue, parameter.MemberName, parameter2.MemberName);
|
||||
}
|
||||
|
||||
public override string DateAddDay(MethodCallExpressionModel model)
|
||||
|
||||
@@ -162,42 +162,40 @@ namespace SqlSugar
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
|
||||
#region 9-12
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8,T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8,T9, object[]>> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8,T9>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),typeof(T9) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9>(base.CurrentConnectionConfig);
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9,T10, object[]>> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9,T10>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9),typeof(T10) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10>(base.CurrentConnectionConfig);
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9, T10>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11, object[]>> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9, T10,T11>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10),typeof(T11) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11>(base.CurrentConnectionConfig);
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9, T10, T11>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12, object[]>> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9, T10, T11,T12>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11),typeof(T12) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12>(base.CurrentConnectionConfig);
|
||||
InitMppingInfo<T, T2, T3, T4, T5, T6, T8, T9, T10, T11, T12>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) };
|
||||
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(base.CurrentConnectionConfig);
|
||||
base.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, bool>> joinExpression) where T : class, new()
|
||||
{
|
||||
InitMppingInfo<T, T2>();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>sqlSugarCore</id>
|
||||
<version>4.3.2.5</version>
|
||||
<version>4.3.2.6</version>
|
||||
<authors>sunkaixuan</authors>
|
||||
<owners>Landa</owners>
|
||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||
|
||||
Reference in New Issue
Block a user