diff --git a/Src/Asp.Net/SqlServerTest/Demos/8_JoinSql.cs b/Src/Asp.Net/SqlServerTest/Demos/8_JoinSql.cs index 490f11028..9aff48d3d 100644 --- a/Src/Asp.Net/SqlServerTest/Demos/8_JoinSql.cs +++ b/Src/Asp.Net/SqlServerTest/Demos/8_JoinSql.cs @@ -76,6 +76,15 @@ namespace OrmTest.Demo new KeyValuePair ( WhereType.And,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "2" }) } }); + conModels.Add(new ConditionalCollections() + { + ConditionalList = new List>()// (id=1 or id=2 and id=1) + { + new KeyValuePair( WhereType.And ,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "1" }), + new KeyValuePair (WhereType.Or,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "2" }), + new KeyValuePair ( WhereType.And,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "2" }) + } + }); var student = db.Queryable().Where(conModels).ToList(); } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs index adc0b23de..1132edcc3 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs @@ -466,7 +466,7 @@ namespace SqlSugar } List conModels = new List(); conModels.Add(con.Value); - var childSqlInfo = ConditionalModelToSql(conModels, 1000 * (1 + index)); + var childSqlInfo = ConditionalModelToSql(conModels, 1000 * (1 + index)+ models.IndexOf(item)); if (!isFirst) {