mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	fix: model.FillBaseInfo遗漏调整完善等
This commit is contained in:
		@@ -199,7 +199,7 @@ func (br *RepoImpl[T]) GetModel() T {
 | 
			
		||||
// 从上下文获取登录账号信息,并赋值至实体
 | 
			
		||||
func (br *RepoImpl[T]) fillBaseInfo(ctx context.Context, e T) T {
 | 
			
		||||
	if la := contextx.GetLoginAccount(ctx); la != nil {
 | 
			
		||||
		// 默认使用数据库id策略, 若要改变则实体结构体自行覆盖SetBaseInfo方法。可参考 sys/entity.Resource
 | 
			
		||||
		// 默认使用数据库id策略, 若要改变则实体结构体自行覆盖FillBaseInfo方法。可参考 sys/entity.Resource
 | 
			
		||||
		e.FillBaseInfo(model.IdGenTypeNone, la)
 | 
			
		||||
	}
 | 
			
		||||
	return e
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ type CreateModel struct {
 | 
			
		||||
	Creator    string     `json:"creator"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *CreateModel) SetBaseInfo(idGenType IdGenType, account *LoginAccount) {
 | 
			
		||||
func (m *CreateModel) FillBaseInfo(idGenType IdGenType, account *LoginAccount) {
 | 
			
		||||
	if !m.IsCreate() {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -95,7 +95,7 @@ type Model struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 设置基础信息. 如创建时间,修改时间,创建者,修改者信息
 | 
			
		||||
func (m *Model) SetBaseInfo(idGenType IdGenType, account *LoginAccount) {
 | 
			
		||||
func (m *Model) FillBaseInfo(idGenType IdGenType, account *LoginAccount) {
 | 
			
		||||
	nowTime := time.Now()
 | 
			
		||||
	isCreate := m.IsCreate()
 | 
			
		||||
	if isCreate {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user