Public Sub GetUsers3(UserId As Long, Columns() As String, PageNumber As Int, PageSize As Int) As Query
Dim Users As Query
Users.Initialize("users")
Users = Users _
.PrimaryKey("id") _
.SelectColumns(Columns) _
.Join("user_relations", Expression.Create2("user_relations", "user_id").Eq3("users", "id")) _
.Where(Expression.Create2("user_relations", "user_profile_id").Eq(UserId)) _
.Skip((PageNumber - 1) * PageSize) _
.Take(PageSize)
Return Users
End Sub
Public Sub GetUsers3(UserId As Long, Columns() As String, PageNumber As Int, PageSize As Int) As Query
Dim Expression1 As ExpressionBuilder
Expression1.Initialize
Expression1.TableName = "user_relations"
Expression1.ColumnName = "user_id"
Expression1 = Expression1.Eq3("users", "id")
Dim Expression2 As ExpressionBuilder
Expression2.Initialize
Expression2.TableName = "user_relations"
Expression2.ColumnName = "user_profile_id"
Expression2 = Expression2.Eq(UserId)
Dim Users As Query
Users.Initialize("users")
Users = Users _
.PrimaryKey("id") _
.SelectColumns(Columns) _
.Join("user_relations", Expression1) _
.Where(Expression2) _
.Skip((PageNumber - 1) * PageSize) _
.Take(PageSize)
Return Users
End Sub