8000 Or函数拼接条件时没有带括号,多条件时会有问题 · Issue #3358 · go-gorm/gorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Or函数拼接条件时没有带括号,多条件时会有问题 #3358
Closed
@qimer

Description

@qimer

GORM Playground Link

go-gorm/playground#1

Description

调用方式:
req.Where("uuid1=? and uuid2=? and uuid3=? and biz_id in (?,'')", uuid1, uuid2, uuid3, bizId). Or("uuid1=? and uuid2=? and uuid3=? and biz_id=?", uuid1, uuid2, uuid3, bizId). First(&m1)
sql:
SELECT * FROM test_mysqlWHERE uuid1="TG2_DnnYM" and uuid2="HG2_YccDpp" and uuid3="HJlVYcnYpH" and biz_id in(9073505431267684724,'') OR uuid1="TG2_DnnYM" and uuid2="HG2_YccDpp" and uuid3="HJlVYcnYpH" and biz_id=9073505431267684724 AND user_id = '1010486059' AND tenant_id = "1053623233" ANDtest_mysql.deleted_atIS NULL ANDtest_mysql.id= 544 ORDER BYtest_mysql.id LIMIT 1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0