init: taotie-api 项目初始化

This commit is contained in:
2026-05-16 00:14:19 +08:00
commit eb15ef4b87
33 changed files with 1746 additions and 0 deletions

39
repo/userrepo.go Normal file
View File

@@ -0,0 +1,39 @@
package repo
import (
"context"
"taotie-api/common"
"taotie-api/model/po"
)
type UserRepo[T IEntity] struct {
BaseRepo[T]
}
func NewUserRepo(mdb *MongoDb) *UserRepo[*po.TUser] {
return &UserRepo[*po.TUser]{
BaseRepo[*po.TUser]{
mdb: mdb,
tableName: "tuser",
},
}
}
func (rp *UserRepo[T]) FindOneByTenantIdAndUserName(ctx context.Context, tenantId string, userName string) (result T, err error) {
result, err = rp.RawFindOne(ctx, &QueryParams{
Where: common.Map{
"tenantId": tenantId,
"userName": userName,
},
})
if err != nil {
return result, err
}
return result, nil
}
func (rp *UserRepo[T]) Update(ctx context.Context, qp *QueryParams, setData map[string]any) error {
return nil
}