This commit is contained in:
sunkaixuan 2017-09-07 17:44:22 +08:00
parent 539711b5a2
commit 9416c307ca
7 changed files with 19 additions and 7 deletions

View File

@ -166,6 +166,7 @@ namespace OrmTest.Demo
var getByFuns = db.Queryable<Student>().Where(it => SqlFunc.IsNullOrEmpty(it.Name)).ToList();
var sum = db.Queryable<Student>().Sum(it => it.Id);
var isAny = db.Queryable<Student>().Where(it => it.Id == -1).Any();
var date = db.Queryable<Student>().Where(it => it.CreateTime.Value.Date ==DateTime.Now.Date).ToList();
var isAny2 = db.Queryable<Student>().Any(it => it.Id == -1);
var getListByRename = db.Queryable<School>().AS("Student").ToList();
var in1 = db.Queryable<Student>().In(it => it.Id, new int[] { 1, 2, 3 }).ToList();

View File

@ -195,6 +195,7 @@ namespace OrmTest.Demo
var sum2 = db.Queryable<Student,School>((st,sc)=>st.SchoolId==sc.Id).Sum((st,sc) => sc.Id);
var isAny = db.Queryable<Student>().Where(it => it.Id == -1).Any();
var isAny2 = db.Queryable<Student>().Any(it => it.Id == -1);
var date = db.Queryable<Student>().Where(it => it.CreateTime.Value.Date == DateTime.Now.Date).ToList();
var getListByRename = db.Queryable<School>().AS("Student").ToList();
var in1 = db.Queryable<Student>().In(it => it.Id, new int[] { 1, 2, 3 }).ToList();
var in2 = db.Queryable<Student>().In(new int[] { 1, 2, 3 }).ToList();

View File

@ -399,7 +399,7 @@ namespace OrmTest.UnitTest
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
var value = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(value, pars, "( DateName(Year,[Datetime1]) +'-'+ DateName(Month,[Datetime1]) +'-'+ DateName(Day,[Datetime1]) > @Date0 )", new List<SugarParameter>()
base.Check(value, pars, "( CAST( DateName(Year,[Datetime1]) +'-'+ DateName(Month,[Datetime1]) +'-'+ DateName(Day,[Datetime1]) AS DATETIME) > @Date0 )", new List<SugarParameter>()
{
new SugarParameter("@Date0",DateTime.Now.Date),

View File

@ -107,12 +107,12 @@ namespace SqlSugar
new MethodCallExpressionArgs() { MemberName=DateType.Year, MemberValue=DateType.Year}
}
};
AppendMember(parameter, isLeft,this.Context.DbMehtods.MergeString(
AppendMember(parameter, isLeft, GetToDate(this.Context.DbMehtods.MergeString(
this.GetDateValue(parameter.CommonTempData, DateType.Year),
"+'-'+",
this.GetDateValue(parameter.CommonTempData, DateType.Month),
"+'-'+",
this.GetDateValue(parameter.CommonTempData, DateType.Day)));
this.GetDateValue(parameter.CommonTempData, DateType.Day))));
}
parameter.CommonTempData = oldCommonTempDate;
return;
@ -276,5 +276,15 @@ namespace SqlSugar
};
return this.Context.DbMehtods.DateValue(pars);
}
private string GetToDate(string value)
{
var pars = new MethodCallExpressionModel()
{
Args = new List<MethodCallExpressionArgs>() {
new MethodCallExpressionArgs() { MemberName=value, MemberValue=value },
}
};
return this.Context.DbMehtods.ToDate(pars);
}
}
}

View File

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.5.1.3")]
[assembly: AssemblyFileVersion("4.5.1.3")]
[assembly: AssemblyVersion("4.5.1.4")]
[assembly: AssemblyFileVersion("4.5.1.4")]

View File

@ -121,7 +121,7 @@ namespace SqlSugar
}
public override string MergeString(params string[] strings)
{
return " concat("+string.Join(",", strings)+") ";
return " concat("+string.Join(",", strings).Replace("+", "") + ") ";
}
}
}

View File

@ -194,7 +194,7 @@ namespace SqlSugar
public override string MergeString(params string[] strings)
{
return string.Join("||", strings) ;
return string.Join("||", strings).Replace("+","");
}
}
}