mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add json 2 sql demo
This commit is contained in:
parent
0230fafba2
commit
65201f28bc
@ -81,6 +81,40 @@ namespace Test
|
|||||||
var x1 = jsonToSqlClient.Queryable(json).ToSqlList();
|
var x1 = jsonToSqlClient.Queryable(json).ToSqlList();
|
||||||
var list1 = jsonToSqlClient.Context.Ado.SqlQuery<dynamic>(x1[0].Sql, x1[0].Parameters);
|
var list1 = jsonToSqlClient.Context.Ado.SqlQuery<dynamic>(x1[0].Sql, x1[0].Parameters);
|
||||||
}
|
}
|
||||||
|
private static void JoinTest2(JsonClient jsonToSqlClient)
|
||||||
|
{
|
||||||
|
var onList =
|
||||||
|
new ObjectFuncModel()
|
||||||
|
{
|
||||||
|
FuncName = "Format",
|
||||||
|
Parameters = new List<object>{
|
||||||
|
"d.orderid","=","{int}:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
var onList2 =
|
||||||
|
new ObjectFuncModel()
|
||||||
|
{
|
||||||
|
FuncName = "Format",
|
||||||
|
Parameters = new List<object>{
|
||||||
|
"c.orderid","=","{int}:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
var selectItems = new List<SelectModel>() {
|
||||||
|
new SelectModel()
|
||||||
|
{
|
||||||
|
AsName = "id",
|
||||||
|
FiledName = "o.id"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var x = jsonToSqlClient.Context.Queryable<object>()
|
||||||
|
.AS("order", "o")
|
||||||
|
.AddJoinInfo("orderdetail", "d", onList, JoinType.Left)
|
||||||
|
.AddJoinInfo("orderdetail", "c", onList2, JoinType.Left)
|
||||||
|
.Select(selectItems)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
private static void GroupByTest(JsonClient jsonToSqlClient)
|
private static void GroupByTest(JsonClient jsonToSqlClient)
|
||||||
{
|
{
|
||||||
jsonToSqlClient.Context.Queryable<object>()
|
jsonToSqlClient.Context.Queryable<object>()
|
||||||
|
Loading…
Reference in New Issue
Block a user