fix: sql执行记录根据关键词搜索问题修复等

This commit is contained in:
meilin.huang
2025-06-22 10:52:06 +08:00
parent 7eb4d064ea
commit 54d3a5b368
31 changed files with 305 additions and 322 deletions

View File

@@ -1,7 +1,6 @@
package base
import (
"cmp"
"context"
"mayfly-go/pkg/contextx"
"mayfly-go/pkg/gormx"
@@ -310,7 +309,7 @@ func (br *RepoImpl[T]) getModelType() reflect.Type {
// 从上下文获取登录账号信息,并赋值至实体
func (br *RepoImpl[T]) fillBaseInfo(ctx context.Context, e T) T {
// 默认使用数据库id策略, 若要改变则实体结构体自行覆盖FillBaseInfo方法。可参考 sys/entity.Resource
e.FillBaseInfo(model.IdGenTypeNone, cmp.Or(contextx.GetLoginAccount(ctx), model.SysAccount))
e.FillBaseInfo(model.IdGenTypeNone, contextx.GetLoginAccount(ctx))
return e
}

View File

@@ -96,10 +96,11 @@ func (m *CreateModelNLD) FillBaseInfo(idGenType IdGenType, account *LoginAccount
m.IdModel.FillBaseInfo(idGenType, account)
nowTime := time.Now()
m.CreateTime = &nowTime
if account != nil {
m.CreatorId = account.Id
m.Creator = account.Username
if account == nil {
account = SysAccount
}
m.CreatorId = account.Id
m.Creator = account.Username
}
// 含有删除、创建字段模型
@@ -118,10 +119,11 @@ func (m *CreateModel) FillBaseInfo(idGenType IdGenType, account *LoginAccount) {
m.DeletedModel.FillBaseInfo(idGenType, account)
nowTime := time.Now()
m.CreateTime = &nowTime
if account != nil {
m.CreatorId = account.Id
m.Creator = account.Username
if account == nil {
account = SysAccount
}
m.CreatorId = account.Id
m.Creator = account.Username
}
// 基础实体模型,数据表最基础字段,不包含逻辑删除
@@ -144,7 +146,11 @@ func (m *ModelNLD) FillBaseInfo(idGenType IdGenType, account *LoginAccount) {
m.UpdateTime = &nowTime
if account == nil {
return
if isCreate {
account = SysAccount
} else {
return
}
}
id := account.Id
name := account.Username
@@ -177,7 +183,11 @@ func (m *Model) FillBaseInfo(idGenType IdGenType, account *LoginAccount) {
m.UpdateTime = &nowTime
if account == nil {
return
if isCreate {
account = SysAccount
} else {
return
}
}
id := account.Id
name := account.Username

View File

@@ -52,7 +52,7 @@ func (i *LogInfo) WithLogResp() *LogInfo {
return i
}
const DefaultLogFrames = 10
const DefaultLogFrames = 18
func LogHandler(rc *Ctx) error {
if rc.Conf == nil || rc.Conf.logInfo == nil {