We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
有两个字段通过连表查询获取,恰巧这两个字段名一样,在对连表的第二个字段进行筛选操作时,获取不到结果。此时sql语句打印出来的where语句拼写的第一个连表的表名。
能够正常筛选出结果
info.AddField("角色", "description", db.Varchar).FieldJoin(types.Join{ Table: "gcf_role", // 连表的表名 Field: "role_id", // 要连表的字段 JoinField: "id", // 连表的表的字段 }).FieldFilterable(types.FilterType{Operator: types.FilterOperatorLike}) info.AddField("资源", "description", db.Varchar).FieldJoin(types.Join{ Table: "gcf_permission", // 连表的表名 Field: "permission_id", // 要连表的字段 JoinField: "id", // 连表的表的字段 }).FieldFilterable(types.FilterType{Operator: types.FilterOperatorLike})
/plugins/admin/modules/table/table.go 650~660行, 判断拼接哪个field时,应该增加join 表的判断.
keys := strings.Split(key, "_goadmin_join_") if len(keys) > 1 { if field := tb.info.FieldList.GetFieldByFieldName(keys[1]); field.Exist() && field.Join.Table != "" { wheres += field.Join.Table + "." + filterFiled(keys[1], connection.GetDelimiter()) + " " + op.String() + " ? and " if op == types.FilterOperatorLike && !strings.Contains(value, "%") { whereArgs = append(whereArgs, "%"+value+"%") } else { whereArgs = append(whereArgs, value) } } }
完全可能出现连接两个不同的表,file name相同
The text was updated successfully, but these errors were encountered:
时间有点久,新版本中这个问题应该已被解决。
Sorry, something went wrong.
No branches or pull requests
bug 描述
有两个字段通过连表查询获取,恰巧这两个字段名一样,在对连表的第二个字段进行筛选操作时,获取不到结果。此时sql语句打印出来的where语句拼写的第一个连表的表名。
期望结果
能够正常筛选出结果
复现代码 [提供可复现的代码,仓库,或线上示例]
版本信息:
出现问题原因
/plugins/admin/modules/table/table.go 650~660行, 判断拼接哪个field时,应该增加join 表的判断.
完全可能出现连接两个不同的表,file name相同
The text was updated successfully, but these errors were encountered: