v0.1
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"tyapi-server/internal/domains/user/entities"
|
||||
)
|
||||
|
||||
// ContractInfoRepository 合同信息仓储接口
|
||||
type ContractInfoRepository interface {
|
||||
// 基础CRUD操作
|
||||
Save(ctx context.Context, contract *entities.ContractInfo) error
|
||||
FindByID(ctx context.Context, contractID string) (*entities.ContractInfo, error)
|
||||
Delete(ctx context.Context, contractID string) error
|
||||
|
||||
// 查询方法
|
||||
FindByEnterpriseInfoID(ctx context.Context, enterpriseInfoID string) ([]*entities.ContractInfo, error)
|
||||
FindByUserID(ctx context.Context, userID string) ([]*entities.ContractInfo, error)
|
||||
FindByContractType(ctx context.Context, enterpriseInfoID string, contractType entities.ContractType) ([]*entities.ContractInfo, error)
|
||||
ExistsByContractFileID(ctx context.Context, contractFileID string) (bool, error)
|
||||
ExistsByContractFileIDExcludeID(ctx context.Context, contractFileID, excludeID string) (bool, error)
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"tyapi-server/internal/domains/user/entities"
|
||||
"tyapi-server/internal/shared/interfaces"
|
||||
)
|
||||
|
||||
// EnterpriseInfoRepository 企业信息仓储接口
|
||||
type EnterpriseInfoRepository interface {
|
||||
interfaces.Repository[entities.EnterpriseInfo]
|
||||
|
||||
// 基础查询
|
||||
GetByUserID(ctx context.Context, userID string) (*entities.EnterpriseInfo, error)
|
||||
GetByUnifiedSocialCode(ctx context.Context, unifiedSocialCode string) (*entities.EnterpriseInfo, error)
|
||||
|
||||
// 业务操作
|
||||
CheckUnifiedSocialCodeExists(ctx context.Context, unifiedSocialCode string, excludeUserID string) (bool, error)
|
||||
UpdateVerificationStatus(ctx context.Context, userID string, isOCRVerified, isFaceVerified, isCertified bool) error
|
||||
UpdateOCRData(ctx context.Context, userID string, rawData string, confidence float64) error
|
||||
CompleteCertification(ctx context.Context, userID string) error
|
||||
}
|
||||
@@ -5,6 +5,10 @@ type ListUsersQuery struct {
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
Phone string `json:"phone"`
|
||||
UserType string `json:"user_type"` // 用户类型: user/admin
|
||||
IsActive *bool `json:"is_active"` // 是否激活
|
||||
IsCertified *bool `json:"is_certified"` // 是否已认证
|
||||
CompanyName string `json:"company_name"` // 企业名称
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
type UserStats struct {
|
||||
TotalUsers int64
|
||||
ActiveUsers int64
|
||||
CertifiedUsers int64
|
||||
TodayRegistrations int64
|
||||
TodayLogins int64
|
||||
}
|
||||
@@ -24,6 +25,12 @@ type UserRepository interface {
|
||||
GetByUsername(ctx context.Context, username string) (*entities.User, error)
|
||||
GetByUserType(ctx context.Context, userType string) ([]*entities.User, error)
|
||||
|
||||
// 关联查询
|
||||
GetByIDWithEnterpriseInfo(ctx context.Context, id string) (entities.User, error)
|
||||
|
||||
// 企业信息查询
|
||||
ExistsByUnifiedSocialCode(ctx context.Context, unifiedSocialCode string, excludeUserID string) (bool, error)
|
||||
|
||||
// 复杂查询 - 使用查询参数
|
||||
ListUsers(ctx context.Context, query *queries.ListUsersQuery) ([]*entities.User, int64, error)
|
||||
|
||||
@@ -72,3 +79,29 @@ type SMSCodeStats struct {
|
||||
SuccessRate float64
|
||||
TodaySent int64
|
||||
}
|
||||
|
||||
// EnterpriseInfoRepository 企业信息仓储接口
|
||||
type EnterpriseInfoRepository interface {
|
||||
interfaces.Repository[entities.EnterpriseInfo]
|
||||
|
||||
// 基础查询 - 直接使用实体
|
||||
GetByUserID(ctx context.Context, userID string) (*entities.EnterpriseInfo, error)
|
||||
GetByUnifiedSocialCode(ctx context.Context, unifiedSocialCode string) (*entities.EnterpriseInfo, error)
|
||||
CheckUnifiedSocialCodeExists(ctx context.Context, unifiedSocialCode string, excludeUserID string) (bool, error)
|
||||
|
||||
// 业务操作
|
||||
UpdateVerificationStatus(ctx context.Context, userID string, isOCRVerified, isFaceVerified, isCertified bool) error
|
||||
UpdateOCRData(ctx context.Context, userID string, rawData string, confidence float64) error
|
||||
CompleteCertification(ctx context.Context, userID string) error
|
||||
|
||||
// 批量操作
|
||||
CreateBatch(ctx context.Context, enterpriseInfos []entities.EnterpriseInfo) error
|
||||
GetByIDs(ctx context.Context, ids []string) ([]entities.EnterpriseInfo, error)
|
||||
UpdateBatch(ctx context.Context, enterpriseInfos []entities.EnterpriseInfo) error
|
||||
DeleteBatch(ctx context.Context, ids []string) error
|
||||
|
||||
// 统计和列表查询
|
||||
Count(ctx context.Context, options interfaces.CountOptions) (int64, error)
|
||||
List(ctx context.Context, options interfaces.ListOptions) ([]entities.EnterpriseInfo, error)
|
||||
Exists(ctx context.Context, id string) (bool, error)
|
||||
}
|
||||
Reference in New Issue
Block a user