mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-16 04:59:34 +08:00
Update .net core project
This commit is contained in:
parent
e3e4026e91
commit
81fceb8247
@ -265,6 +265,17 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var listItem in list)
|
||||||
|
{
|
||||||
|
if (navObjectNamePropety.GetValue(listItem) == null)
|
||||||
|
{
|
||||||
|
var newinstance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true) as IList;
|
||||||
|
navObjectNamePropety.SetValue(listItem,newinstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SkipTakeIList(SqlInfo sql, IList instanceCast, IList newinstance)
|
private static void SkipTakeIList(SqlInfo sql, IList instanceCast, IList newinstance)
|
||||||
|
@ -1143,7 +1143,8 @@ namespace SqlSugar
|
|||||||
this.QueryBuilder.OrderByValue == null &&
|
this.QueryBuilder.OrderByValue == null &&
|
||||||
this.QueryBuilder.PartitionByValue == null&&
|
this.QueryBuilder.PartitionByValue == null&&
|
||||||
this.QueryBuilder.SelectValue==null&&
|
this.QueryBuilder.SelectValue==null&&
|
||||||
this.QueryBuilder.Includes == null)
|
this.QueryBuilder.Includes == null&&
|
||||||
|
this.QueryBuilder.IsDistinct==false)
|
||||||
{
|
{
|
||||||
|
|
||||||
return this.Clone().Select<int>(" COUNT(1) ").ToList().First();
|
return this.Clone().Select<int>(" COUNT(1) ").ToList().First();
|
||||||
@ -2154,7 +2155,8 @@ namespace SqlSugar
|
|||||||
this.QueryBuilder.OrderByValue == null &&
|
this.QueryBuilder.OrderByValue == null &&
|
||||||
this.QueryBuilder.PartitionByValue == null &&
|
this.QueryBuilder.PartitionByValue == null &&
|
||||||
this.QueryBuilder.SelectValue == null &&
|
this.QueryBuilder.SelectValue == null &&
|
||||||
this.QueryBuilder.Includes == null)
|
this.QueryBuilder.Includes == null&&
|
||||||
|
this.QueryBuilder.IsDistinct==false)
|
||||||
{
|
{
|
||||||
var list = await this.Clone().Select<int>(" COUNT(1) ").ToListAsync();
|
var list = await this.Clone().Select<int>(" COUNT(1) ").ToListAsync();
|
||||||
return list.First();
|
return list.First();
|
||||||
|
@ -121,6 +121,8 @@ namespace SqlSugar
|
|||||||
AppendNot(parameter.CommonTempData);
|
AppendNot(parameter.CommonTempData);
|
||||||
base.Start();
|
base.Start();
|
||||||
parameter.BaseParameter.CommonTempData = parameter.CommonTempData;
|
parameter.BaseParameter.CommonTempData = parameter.CommonTempData;
|
||||||
|
if (nodeType == ExpressionType.Negate&& parameter.BaseParameter.CommonTempData is int)
|
||||||
|
parameter.BaseParameter.CommonTempData =Convert.ToInt32(parameter.BaseParameter.CommonTempData)*-1;
|
||||||
parameter.BaseParameter.ChildExpression = base.Expression;
|
parameter.BaseParameter.ChildExpression = base.Expression;
|
||||||
parameter.CommonTempData = null;
|
parameter.CommonTempData = null;
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,11 @@ namespace SqlSugar
|
|||||||
var type = UtilMethods.GetUnderType(value.GetType());
|
var type = UtilMethods.GetUnderType(value.GetType());
|
||||||
if (type == UtilConstants.DateType)
|
if (type == UtilConstants.DateType)
|
||||||
{
|
{
|
||||||
var date = value.ObjToDate();
|
return GetDateTimeString(value);
|
||||||
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
|
||||||
{
|
|
||||||
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
|
||||||
}
|
}
|
||||||
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
else if (value is DateTimeOffset)
|
||||||
|
{
|
||||||
|
return GetDateTimeOffsetString(value);
|
||||||
}
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
@ -84,6 +83,27 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeOffsetString(object value)
|
||||||
|
{
|
||||||
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeString(object value)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
private string GetString(object value)
|
private string GetString(object value)
|
||||||
{
|
{
|
||||||
var result = value.ToString();
|
var result = value.ToString();
|
||||||
|
@ -106,12 +106,11 @@ namespace SqlSugar
|
|||||||
var type = UtilMethods.GetUnderType(value.GetType());
|
var type = UtilMethods.GetUnderType(value.GetType());
|
||||||
if (type == UtilConstants.DateType)
|
if (type == UtilConstants.DateType)
|
||||||
{
|
{
|
||||||
var date = value.ObjToDate();
|
return GetDateTimeString(value);
|
||||||
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
|
||||||
{
|
|
||||||
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
|
||||||
}
|
}
|
||||||
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
else if (value is DateTimeOffset)
|
||||||
|
{
|
||||||
|
return GetDateTimeOffsetString(value);
|
||||||
}
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
@ -154,6 +153,27 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeString(object value)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeOffsetString(object value)
|
||||||
|
{
|
||||||
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
private string GetString(object value)
|
private string GetString(object value)
|
||||||
{
|
{
|
||||||
var result = value.ToString();
|
var result = value.ToString();
|
||||||
|
@ -25,6 +25,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (item.Value != null &&Regex.IsMatch(item.Value.Trim(), @"^\w+\,\@\w+\,$"))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
sql = sql.Replace(item.Value, item.Value.Replace("@", UtilConstants.ReplaceKey));
|
sql = sql.Replace(item.Value, item.Value.Replace("@", UtilConstants.ReplaceKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user