v2_system
This commit is contained in:
@@ -13,6 +13,11 @@ import (
|
||||
)
|
||||
|
||||
type ConfigBiz interface {
|
||||
Create(ctx context.Context, arg *db.CreateSysConfigParams) error
|
||||
Update(ctx context.Context, arg *db.UpdateSysConfigByKeyParams) error
|
||||
Get(ctx context.Context, id int32) (*db.SysConfig, error)
|
||||
List(ctx context.Context, q dto.SearchDto) ([]*db.SysConfig, int64, error)
|
||||
|
||||
ConfigExpansion
|
||||
}
|
||||
|
||||
@@ -34,6 +39,36 @@ func NewConfig(store db.Store, redis redis.IRedis) *configBiz {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *configBiz) Create(ctx context.Context, arg *db.CreateSysConfigParams) error {
|
||||
return b.store.CreateSysConfig(ctx, arg)
|
||||
}
|
||||
|
||||
func (b *configBiz) Update(ctx context.Context, arg *db.UpdateSysConfigByKeyParams) error {
|
||||
return b.store.UpdateSysConfigByKey(ctx, arg)
|
||||
}
|
||||
|
||||
func (b *configBiz) Get(ctx context.Context, id int32) (*db.SysConfig, error) {
|
||||
return b.store.GetSysConfig(ctx, id)
|
||||
}
|
||||
|
||||
func (b *configBiz) List(ctx context.Context, q dto.SearchDto) ([]*db.SysConfig, int64, error) {
|
||||
count, err := b.store.CountSysConfigCondition(ctx, q.SearchKey)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
configs, err := b.store.ListSysConfigCondition(ctx, &db.ListSysConfigConditionParams{
|
||||
Key: q.SearchName,
|
||||
Skip: (int32(q.Page) - 1) * int32(q.Rows),
|
||||
Size: int32(q.Rows),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return configs, count, nil
|
||||
}
|
||||
|
||||
func (b *configBiz) Pear(ctx context.Context) (*dto.PearConfig, error) {
|
||||
// 判断redis是否存储
|
||||
key := keys.GetManageKey(ctx, keys.PearAdmin)
|
||||
|
||||
Reference in New Issue
Block a user