feat: 添加用户租户管理功能,优化用户列表和租户信息展示,增强查询过滤条件
This commit is contained in:
60
backend/app/http/super/dto/user_tenant.go
Normal file
60
backend/app/http/super/dto/user_tenant.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/pkg/consts"
|
||||
|
||||
"go.ipao.vip/gen/types"
|
||||
)
|
||||
|
||||
type UserTenantPageFilter struct {
|
||||
requests.Pagination `json:",inline" query:",inline"`
|
||||
|
||||
TenantID *int64 `json:"tenant_id,omitempty" query:"tenant_id"`
|
||||
Code *string `json:"code,omitempty" query:"code"`
|
||||
Name *string `json:"name,omitempty" query:"name"`
|
||||
|
||||
// Role filters tenant_users.role containing a role (tenant_admin/member).
|
||||
Role *consts.TenantUserRole `json:"role,omitempty" query:"role"`
|
||||
// Status filters tenant_users.status.
|
||||
Status *consts.UserStatus `json:"status,omitempty" query:"status"`
|
||||
|
||||
CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"`
|
||||
CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"`
|
||||
}
|
||||
|
||||
func (f *UserTenantPageFilter) CodeTrimmed() string {
|
||||
if f == nil || f.Code == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.ToLower(strings.TrimSpace(*f.Code))
|
||||
}
|
||||
|
||||
func (f *UserTenantPageFilter) NameTrimmed() string {
|
||||
if f == nil || f.Name == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(*f.Name)
|
||||
}
|
||||
|
||||
type UserTenantItem struct {
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
|
||||
TenantStatus consts.TenantStatus `json:"tenant_status"`
|
||||
TenantStatusDescription string `json:"tenant_status_description,omitempty"`
|
||||
ExpiredAt time.Time `json:"expired_at"`
|
||||
|
||||
Owner *TenantOwnerUserLite `json:"owner,omitempty"`
|
||||
|
||||
Role types.Array[consts.TenantUserRole] `json:"role"`
|
||||
|
||||
MemberStatus consts.UserStatus `json:"member_status"`
|
||||
MemberStatusDescription string `json:"member_status_description,omitempty"`
|
||||
|
||||
JoinedAt time.Time `json:"joined_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user