37 lines
732 B
Go
37 lines
732 B
Go
package repo
|
|
|
|
import (
|
|
"context"
|
|
"taotie-api/common"
|
|
"taotie-api/model/po"
|
|
)
|
|
|
|
type TenantRepo[T IEntity] struct {
|
|
BaseRepo[T]
|
|
}
|
|
|
|
func NewTenantRepo(mdb *MongoDb) *TenantRepo[*po.TTenant] {
|
|
return &TenantRepo[*po.TTenant]{
|
|
BaseRepo: BaseRepo[*po.TTenant]{
|
|
mdb: mdb,
|
|
tableName: "ttenant",
|
|
},
|
|
}
|
|
}
|
|
|
|
func (rp *TenantRepo[T]) FindOneByTenantNo(ctx context.Context, tenantNo string) (result T, err error) {
|
|
return rp.RawFindOne(ctx, &QueryParams{
|
|
Where: common.Map{
|
|
"tenantNo": tenantNo,
|
|
},
|
|
})
|
|
}
|
|
|
|
func (rp *TenantRepo[T]) FindOneByTenantName(ctx context.Context, tenantName string) (result T, err error) {
|
|
return rp.RawFindOne(ctx, &QueryParams{
|
|
Where: common.Map{
|
|
"tenantName": tenantName,
|
|
},
|
|
})
|
|
}
|