58 lines
1.8 KiB
Go
58 lines
1.8 KiB
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
|
)
|
|
|
|
// List 查看通知日志列表
|
|
func (c *ControllerV1) TNotifyLogList(ctx context.Context, req *v1.TNotifyLogListReq) (res *v1.TNotifyLogListRes, err error) {
|
|
list, totalCount, err := service.CommonTNotifyLog().List(ctx, &req.TNotifyLogListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.TNotifyLogListModel{}
|
|
}
|
|
|
|
res = new(v1.TNotifyLogListRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
// Export 导出通知日志列表
|
|
func (c *ControllerV1) TNotifyLogExport(ctx context.Context, req *v1.TNotifyLogExportReq) (res *v1.TNotifyLogExportRes, err error) {
|
|
err = service.CommonTNotifyLog().Export(ctx, &req.TNotifyLogListParam)
|
|
return
|
|
}
|
|
|
|
// Edit 更新通知日志
|
|
func (c *ControllerV1) TNotifyLogEdit(ctx context.Context, req *v1.TNotifyLogEditReq) (res *v1.TNotifyLogEditRes, err error) {
|
|
err = service.CommonTNotifyLog().Edit(ctx, &req.TNotifyLogEditParam)
|
|
return
|
|
}
|
|
|
|
// View 获取指定通知日志信息
|
|
func (c *ControllerV1) TNotifyLogView(ctx context.Context, req *v1.TNotifyLogViewReq) (res *v1.TNotifyLogViewRes, err error) {
|
|
data, err := service.CommonTNotifyLog().View(ctx, &req.TNotifyLogViewParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = new(v1.TNotifyLogViewRes)
|
|
res.TNotifyLogViewModel = data
|
|
return
|
|
}
|
|
|
|
// Delete 删除通知日志
|
|
func (c *ControllerV1) TNotifyLogDelete(ctx context.Context, req *v1.TNotifyLogDeleteReq) (res *v1.TNotifyLogDeleteRes, err error) {
|
|
err = service.CommonTNotifyLog().Delete(ctx, &req.TNotifyLogDeleteParam)
|
|
return
|
|
}
|