mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 13:13:51 +08:00
1、泛型化参数,预留泛型约束,方便以后代码扩展的类型安全校验
2、升级goframe至v2.7.3
This commit is contained in:
@@ -55,7 +55,7 @@ func (s *sSysAttachment) View(ctx context.Context, in *sysin.AttachmentViewInp)
|
||||
// List 获取附件列表
|
||||
func (s *sSysAttachment) List(ctx context.Context, in *sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error) {
|
||||
mod := s.Model(ctx)
|
||||
memberId := contexts.GetUserId(ctx)
|
||||
memberId := contexts.GetUserId[any](ctx)
|
||||
|
||||
// 超管允许查看指定用户的附件
|
||||
if service.AdminMember().VerifySuperId(ctx, memberId) && in.MemberId > 0 {
|
||||
@@ -108,7 +108,7 @@ func (s *sSysAttachment) List(ctx context.Context, in *sysin.AttachmentListInp)
|
||||
|
||||
// ClearKind 清空上传类型
|
||||
func (s *sSysAttachment) ClearKind(ctx context.Context, in *sysin.AttachmentClearKindInp) (err error) {
|
||||
memberId := contexts.GetUserId(ctx)
|
||||
memberId := contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx).Where(dao.SysAttachment.Columns().MemberId, memberId).Where(dao.SysAttachment.Columns().Kind, in.Kind).Delete(); err != nil {
|
||||
err = gerror.Wrap(err, "删除附件上传类型失败,请稍后重试!")
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func (s *sSysCurdDemo) Export(ctx context.Context, in *sysin.CurdDemoListInp) (e
|
||||
return
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
|
||||
err = excel.ExportByStructs[any](ctx, tags, exports, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (s *sSysCurdDemo) Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err
|
||||
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
in.UpdatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx).
|
||||
Fields(sysin.CurdDemoUpdateFields{}).
|
||||
WherePri(in.Id).Data(in).Update(); err != nil {
|
||||
@@ -149,7 +149,7 @@ func (s *sSysCurdDemo) Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err
|
||||
}
|
||||
|
||||
// 新增
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
in.CreatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).
|
||||
Fields(sysin.CurdDemoInsertFields{}).
|
||||
Data(in).OmitEmptyData().Insert(); err != nil {
|
||||
@@ -163,7 +163,7 @@ func (s *sSysCurdDemo) Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err
|
||||
func (s *sSysCurdDemo) Delete(ctx context.Context, in *sysin.CurdDemoDeleteInp) (err error) {
|
||||
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(g.Map{
|
||||
dao.SysGenCurdDemo.Columns().DeletedBy: contexts.GetUserId(ctx),
|
||||
dao.SysGenCurdDemo.Columns().DeletedBy: contexts.GetUserId[any](ctx),
|
||||
dao.SysGenCurdDemo.Columns().DeletedAt: gtime.Now(),
|
||||
}).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "删除CURD列表失败,请稍后重试!")
|
||||
@@ -200,7 +200,7 @@ func (s *sSysCurdDemo) View(ctx context.Context, in *sysin.CurdDemoViewInp) (res
|
||||
func (s *sSysCurdDemo) Status(ctx context.Context, in *sysin.CurdDemoStatusInp) (err error) {
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(g.Map{
|
||||
dao.SysGenCurdDemo.Columns().Status: in.Status,
|
||||
dao.SysGenCurdDemo.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
dao.SysGenCurdDemo.Columns().UpdatedBy: contexts.GetUserId[any](ctx),
|
||||
}).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "更新CURD列表状态失败,请稍后重试!")
|
||||
return
|
||||
@@ -222,7 +222,7 @@ func (s *sSysCurdDemo) Switch(ctx context.Context, in *sysin.CurdDemoSwitchInp)
|
||||
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(g.Map{
|
||||
in.Key: in.Value,
|
||||
dao.SysGenCurdDemo.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
dao.SysGenCurdDemo.Columns().UpdatedBy: contexts.GetUserId[any](ctx),
|
||||
}).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "更新CURD列表开关失败,请稍后重试!")
|
||||
return
|
||||
|
||||
@@ -210,7 +210,7 @@ func (s *sSysEmsLog) newView(ctx context.Context, in *sysin.SendEmsInp, config *
|
||||
|
||||
var (
|
||||
username string
|
||||
user = contexts.GetUser(ctx)
|
||||
user = contexts.GetUser[any](ctx)
|
||||
request = ghttp.RequestFromCtx(ctx)
|
||||
ip = location.GetClientIp(request)
|
||||
)
|
||||
|
||||
@@ -101,7 +101,7 @@ func (s *sSysLog) Export(ctx context.Context, in *sysin.LogListInp) (err error)
|
||||
exportList = append(exportList, row)
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, titleList, exportList, fileName, sheetName)
|
||||
err = excel.ExportByStructs[any](ctx, titleList, exportList, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func (s *sSysLog) AutoLog(ctx context.Context) error {
|
||||
// AnalysisLog 解析日志数据
|
||||
func (s *sSysLog) AnalysisLog(ctx context.Context) entity.SysLog {
|
||||
var (
|
||||
mctx = contexts.Get(ctx)
|
||||
mctx = contexts.Get[any](ctx)
|
||||
response = mctx.Response
|
||||
user = mctx.User
|
||||
request = ghttp.RequestFromCtx(ctx)
|
||||
|
||||
@@ -115,7 +115,7 @@ func (s *sSysLoginLog) Export(ctx context.Context, in *sysin.LoginLogListInp) (e
|
||||
return
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
|
||||
err = excel.ExportByStructs[any](ctx, tags, exports, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ func (s *sSysNormalTreeDemo) Edit(ctx context.Context, in *sysin.NormalTreeDemoE
|
||||
}
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
in.UpdatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx).
|
||||
Fields(sysin.NormalTreeDemoUpdateFields{}).
|
||||
WherePri(in.Id).Data(in).Update(); err != nil {
|
||||
@@ -110,7 +110,7 @@ func (s *sSysNormalTreeDemo) Edit(ctx context.Context, in *sysin.NormalTreeDemoE
|
||||
}
|
||||
|
||||
// 新增
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
in.CreatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).
|
||||
Fields(sysin.NormalTreeDemoInsertFields{}).
|
||||
Data(in).OmitEmptyData().Insert(); err != nil {
|
||||
|
||||
@@ -100,7 +100,7 @@ func (s *sSysOptionTreeDemo) Edit(ctx context.Context, in *sysin.OptionTreeDemoE
|
||||
}
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
in.UpdatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx).
|
||||
Fields(sysin.OptionTreeDemoUpdateFields{}).
|
||||
WherePri(in.Id).Data(in).Update(); err != nil {
|
||||
@@ -110,7 +110,7 @@ func (s *sSysOptionTreeDemo) Edit(ctx context.Context, in *sysin.OptionTreeDemoE
|
||||
}
|
||||
|
||||
// 新增
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
in.CreatedBy = contexts.GetUserId[any](ctx)
|
||||
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).
|
||||
Fields(sysin.OptionTreeDemoInsertFields{}).
|
||||
Data(in).OmitEmptyData().Insert(); err != nil {
|
||||
|
||||
@@ -123,7 +123,7 @@ func (s *sSysServeLicense) Export(ctx context.Context, in *sysin.ServeLicenseLis
|
||||
return
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
|
||||
err = excel.ExportByStructs[any](ctx, tags, exports, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ func (s *sSysServeLog) List(ctx context.Context, in *sysin.ServeLogListInp) (lis
|
||||
return
|
||||
}
|
||||
|
||||
err = mod.Fields(fields).Handler(handler.FilterAuth).Page(in.Page, in.PerPage).OrderDesc(dao.SysServeLog.Columns().Id).Scan(&list)
|
||||
err = mod.Fields(fields).Handler(handler.FilterAuth[any]).Page(in.Page, in.PerPage).OrderDesc(dao.SysServeLog.Columns().Id).Scan(&list)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ func (s *sSysServeLog) Export(ctx context.Context, in *sysin.ServeLogListInp) (e
|
||||
return err
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
|
||||
err = excel.ExportByStructs[any](ctx, tags, exports, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user