fix(api): 修复分销商查询时销售员ID筛选条件错误
- 修改SQL查询,添加 salesmen_id 作为筛选条件 - 传递salesman_id对应的参数,确保查询参数正确 - 保持原有creator参数传递逻辑不变 - 解决遗漏salesman_id参数引起的查询异常问题
This commit is contained in:
parent
a8b7c77e03
commit
c45cabbfdc
|
|
@ -46,11 +46,15 @@ func (a *ResellersAPI) list(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
ph := strings.Repeat("?,", len(creators))
|
||||
ph = strings.TrimSuffix(ph, ",")
|
||||
sql1 := "SELECT id, COALESCE(name,'') AS name FROM reseller WHERE creator IN (" + ph + ")"
|
||||
sql1 := "SELECT id, COALESCE(name,'') AS name FROM reseller WHERE (creator IN (" + ph + ") OR salesman_id IN (" + ph + "))"
|
||||
args := []interface{}{}
|
||||
for _, c := range creators {
|
||||
args = append(args, c)
|
||||
}
|
||||
// salesman_id IN 需要再传一次参数
|
||||
for _, c := range creators {
|
||||
args = append(args, c)
|
||||
}
|
||||
if q != "" {
|
||||
sql1 += " AND (CAST(id AS CHAR) LIKE ? OR name LIKE ?)"
|
||||
like := "%" + q + "%"
|
||||
|
|
|
|||
Loading…
Reference in New Issue