chore: 并入 iotlcm-app 历史到 app/(原提交 f40bda9)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-app/api/system/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetConfigList(ctx context.Context, req *v1.GetConfigListReq) (res *v1.GetConfigListRes, err error) {
|
||||
|
||||
items, total, err := service.SysConfig().List(ctx, &req.SysConfigListParam)
|
||||
res = &v1.GetConfigListRes{
|
||||
Data: items,
|
||||
PageResult: response.PageResult{
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) AddConfig(ctx context.Context, req *v1.AddConfigReq) (res *v1.AddConfigRes, err error) {
|
||||
output, err := service.SysConfig().Add(ctx, &req.SysConfigAddParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.AddConfigRes{
|
||||
SysConfigAddModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) EditConfig(ctx context.Context, req *v1.EditConfigReq) (res *v1.EditConfigRes, err error) {
|
||||
output, err := service.SysConfig().Edit(ctx, &req.SysConfigEditParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.EditConfigRes{
|
||||
SysConfigEditModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) DeleteConfig(ctx context.Context, req *v1.DeleteConfigReq) (res *v1.DeleteConfigRes, err error) {
|
||||
output, err := service.SysConfig().Delete(ctx, &req.SysConfigDeleteParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.DeleteConfigRes{
|
||||
SysConfigDeleteModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) GetConfigById(ctx context.Context, req *v1.GetConfigByIdReq) (res *v1.GetConfigByIdRes, err error) {
|
||||
output, err := service.SysConfig().View(ctx, &req.SysConfigViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.GetConfigByIdRes{
|
||||
SysConfigViewModel: *output,
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user