| 
									
										
										
										
											2025-10-07 22:45:18 +08:00
										 |  |  | SELECT tm.id as id, t.uid as team_uid, t.id as team_id, u.uid as user_uid, u.id as user_id, tm.created, tm.updated, tm.permission
 | 
					
						
							| 
									
										
										
										
											2024-08-28 20:15:26 +08:00
										 |  |  | FROM {{ .Ident .TeamMemberTable }} tm
 | 
					
						
							| 
									
										
										
										
											2024-08-27 14:31:29 +08:00
										 |  |  | INNER JOIN {{ .Ident .TeamTable }} t ON tm.team_id = t.id
 | 
					
						
							|  |  |  | INNER JOIN {{ .Ident .UserTable }} u ON tm.user_id  = u.id
 | 
					
						
							|  |  |  | WHERE
 | 
					
						
							| 
									
										
										
										
											2025-10-03 21:48:51 +08:00
										 |  |  |   tm.org_id = {{ .Arg .Query.OrgID}}
 | 
					
						
							| 
									
										
										
										
											2025-10-07 22:45:18 +08:00
										 |  |  |   {{ if .Query.TeamID }}
 | 
					
						
							|  |  |  |     AND tm.team_id = {{ .Arg .Query.TeamID }}
 | 
					
						
							|  |  |  |   {{ end }}
 | 
					
						
							|  |  |  |   {{ if .Query.UserID }}
 | 
					
						
							|  |  |  |     AND tm.user_id = {{ .Arg .Query.UserID }}
 | 
					
						
							| 
									
										
										
										
											2025-10-03 21:48:51 +08:00
										 |  |  |   {{ end }}
 | 
					
						
							|  |  |  |   {{- if .Query.Pagination.Continue }}
 | 
					
						
							|  |  |  |     AND tm.id >= {{ .Arg .Query.Pagination.Continue }}
 | 
					
						
							|  |  |  |   {{- end }}
 | 
					
						
							| 
									
										
										
										
											2024-08-28 16:30:23 +08:00
										 |  |  | AND NOT tm.external
 | 
					
						
							| 
									
										
										
										
											2025-10-03 21:48:51 +08:00
										 |  |  | ORDER BY t.id ASC
 | 
					
						
							|  |  |  | LIMIT {{ .Arg .Query.Pagination.Limit }};
 |