Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

连表的时候右边软删除字段没生效 #883

Open
huyangcheng opened this issue Jun 12, 2023 · 0 comments · May be fixed by #1199
Open

连表的时候右边软删除字段没生效 #883

huyangcheng opened this issue Jun 12, 2023 · 0 comments · May be fixed by #1199
Assignees

Comments

@huyangcheng
Copy link

逻辑删除采用的是 0/1,A B表单表查询软删除都生效的

IsDeleted soft_delete.DeletedAt gorm:"column:is_deleted;softDelete:flag" json:"isDeleted" // 逻辑删除

联表的代码(现在联调右表被删除的字段也被查询出来了)
qc := dao.Q.WithContext(d.ctx) qc.A.Join(dao.B, dao.B.DatasourceID.EqCol(dao.A.ID)).Where(conds...).Find()

并且 dao.DatasourcePermission.IsDeleted.Eq 需要传递是参数类型为 driver.Valuer
我现在不知道怎么创建 0/1 的driver.Valuer 变量

临时解决办法,把B表的 isDelete = A 表的 isDelete 并加入到 conds 中
dao.B.IsDeleted.EqCol(dao.A.IsDeleted)

请求各位设置右表 isDeleted = 0 或者默认让右表软删除字段生效

@YukiMichishita YukiMichishita linked a pull request Aug 29, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants