Skip to content

[Bug]: 自动生成中代码列名为关键字会出现错误 #2113

@jxc1690

Description

@jxc1690

gin-vue-admin 版本

2.8.5

Node 版本

20

Golang 版本

1.20

是否依旧存在

可以

bug描述

如果在创建表的时候有mysql的关键字有bug

  1. 搜索的时候有这个关键字会报错
  2. 在排序的时候有这个会报错

目前我只发现了这么多 可能还存在其他的

修改建议

	if info.Lock != nil {
		db = db.Where("`lock` < ?", *info.Lock)
	}
	if orderMap[info.Sort] {
		OrderStr = fmt.Sprintf("`%s`", info.Sort)
		if info.Order == "descending" {
			OrderStr = OrderStr + " desc"
		}
		db = db.Order(OrderStr)
	}

我不清楚自动生成代码的模版在哪 不然直接提交分支了
或者直接点 创建表的时候 禁止创建mysql的关键字作为表名

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions