mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-01 20:26:39 +08:00
fix: sql字符串拼接改为占位符形式,防sql注入
This commit is contained in:
@@ -217,7 +217,7 @@ func GetPageBySql(sql string, param *PageParam, toModel interface{}, args ...int
|
||||
}
|
||||
// 分页查询
|
||||
limitSql := sql + " LIMIT " + strconv.Itoa((param.PageNum-1)*param.PageSize) + ", " + strconv.Itoa(param.PageSize)
|
||||
err = db.Raw(limitSql).Scan(toModel).Error
|
||||
err = db.Raw(limitSql, args...).Scan(toModel).Error
|
||||
biz.ErrIsNil(err, "查询失败: %s")
|
||||
return &PageResult{Total: int64(count), List: toModel}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user