模块化上传驱动,使用泛型优化工具库降低冗余

This commit is contained in:
孟帅
2023-06-02 20:29:08 +08:00
parent fdc48b9335
commit 62ecbb7f26
96 changed files with 1276 additions and 1483 deletions

View File

@@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sys
import (
@@ -21,7 +20,7 @@ var (
type cAttachment struct{}
// Delete 删除
// Delete 删除附件
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
var in sysin.AttachmentDeleteInp
if err = gconv.Scan(req, &in); err != nil {
@@ -32,30 +31,7 @@ func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (re
return
}
// Edit 更新
func (c *cAttachment) Edit(ctx context.Context, req *attachment.EditReq) (res *attachment.EditRes, err error) {
var in sysin.AttachmentEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysAttachment().Edit(ctx, in)
return
}
// MaxSort 最大排序
func (c *cAttachment) MaxSort(ctx context.Context, req *attachment.MaxSortReq) (res *attachment.MaxSortRes, err error) {
data, err := service.SysAttachment().MaxSort(ctx, sysin.AttachmentMaxSortInp{Id: req.Id})
if err != nil {
return
}
res = new(attachment.MaxSortRes)
res.Sort = data.Sort
return
}
// View 获取指定信息
// View 获取指定附件信息
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *attachment.ViewRes, err error) {
data, err := service.SysAttachment().View(ctx, sysin.AttachmentViewInp{Id: req.Id})
if err != nil {
@@ -67,7 +43,7 @@ func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *a
return
}
// List 查看列表
// List 查看附件列表
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
var in sysin.AttachmentListInp
if err = gconv.Scan(req, &in); err != nil {
@@ -86,14 +62,3 @@ func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *a
res.PerPage = req.PerPage
return
}
// Status 更新部门状态
func (c *cAttachment) Status(ctx context.Context, req *attachment.StatusReq) (res *attachment.StatusRes, err error) {
var in sysin.AttachmentStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysAttachment().Status(ctx, in)
return
}