acmestack / gorm-plus

Gorm-plus是基于Gorm的增强版,类似Mybatis-plus语法。Gorm-plus is based on an enhanced version of Gorm, similar to Mybatis-plus syntax.
https://github.com/acmestack/gorm-plus/wiki
Apache License 2.0
285 stars 44 forks source link

嵌套结构体会在构造查询条件得适合错误 #38

Closed aixj1984 closed 1 year ago

aixj1984 commented 1 year ago

Enviornment (please complete the following information):

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

定义如下结构体

type Base struct { Id int64 CreatedAt time.Time json:"createdAt" UpdatedAt time.Time json:"updatedAt" }

type User struct { Base Username string gorm:"column:username" Password string Address string Age int Phone string Score int Dept string }

在更新的时候,会直接使用base作为参数名

Expected behavior A clear and concise description of what you expected to happen.

afumu commented 1 year ago

Enviornment (please complete the following information):

  • OS: [Linux: uname -a]
  • envcd version [e.g. v0.0.1]

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

定义如下结构体

type Base struct { Id int64 CreatedAt time.Time json:"createdAt" UpdatedAt time.Time json:"updatedAt" }

type User struct { Base Username string gorm:"column:username" Password string Address string Age int Phone string Score int Dept string }

在更新的时候,会直接使用base作为参数名

Expected behavior A clear and concise description of what you expected to happen.

感谢你的反馈,问题已复现,有时间我们改一下,或者你感兴趣话,可以提交pr来修复它

afumu commented 1 year ago

Enviornment (please complete the following information):

  • OS: [Linux: uname -a]
  • envcd version [e.g. v0.0.1]

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

定义如下结构体

type Base struct { Id int64 CreatedAt time.Time json:"createdAt" UpdatedAt time.Time json:"updatedAt" }

type User struct { Base Username string gorm:"column:username" Password string Address string Age int Phone string Score int Dept string }

在更新的时候,会直接使用base作为参数名

Expected behavior A clear and concise description of what you expected to happen.

问题已解决,可以查看这里 https://github.com/acmestack/gorm-plus/pull/39