mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-17 17:41:28 +08:00
Rich query
This commit is contained in:
@@ -284,6 +284,12 @@ namespace OrmTest.Demo
|
||||
var getUnionAllList2 = db.UnionAll(db.Queryable<Student>(), db.Queryable<Student>()).ToList();
|
||||
|
||||
var test1 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Where(st=>st.CreateTime>SqlFunc.GetDate()).Select((st, sc) => SqlFunc.ToInt64(sc.Id)).ToList();
|
||||
//var test2= db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id)
|
||||
// .Where(st=>
|
||||
// SqlFunc.IF(st.Id>1)
|
||||
// .Return(st.Id)
|
||||
// .ElseIF(st.Id==1)
|
||||
// .Return(st.SchoolId).End(st.Id)==1).ToList();
|
||||
}
|
||||
public static void Page()
|
||||
{
|
||||
|
||||
@@ -40,6 +40,10 @@ namespace OrmTest.Demo
|
||||
List<ConditionalModel> conModels = new List<ConditionalModel>();
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "1" });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Like, FieldValue = "1" });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.IsNullOrEmpty });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.In,FieldValue="1,2,3" });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.NotIn, FieldValue = "1,2,3" });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.NoEqual, FieldValue = "1,2,3" });
|
||||
var student = db.Queryable<Student>().Where(conModels).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user