mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-27 09:56:35 +08:00
fix: sql字符串拼接改为占位符形式,防sql注入
This commit is contained in:
@@ -20,11 +20,12 @@ func (a *accountRepoImpl) GetAccount(condition *entity.Account, cols ...string)
|
||||
func (m *accountRepoImpl) GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
sql := "SELECT * FROM t_sys_account "
|
||||
username := condition.Username
|
||||
values := make([]interface{}, 0)
|
||||
if username != "" {
|
||||
sql = sql + " WHERE username LIKE '%" + username + "%'"
|
||||
sql = sql + " WHERE username LIKE ?"
|
||||
values = append(values, "%"+username+"%")
|
||||
}
|
||||
return model.GetPageBySql(sql, pageParam, toEntity)
|
||||
// return model.GetPage(pageParam, condition, toEntity, orderBy...)
|
||||
return model.GetPageBySql(sql, pageParam, toEntity, values...)
|
||||
}
|
||||
|
||||
func (m *accountRepoImpl) Insert(account *entity.Account) {
|
||||
|
||||
Reference in New Issue
Block a user