This commit is contained in:
parent
1451aa19aa
commit
b7653affe3
|
|
@ -539,16 +539,12 @@ func (dao *NewsDAO) QueryPullNew(cond *NewsPullNewCondition) (dos []*models.News
|
||||||
)
|
)
|
||||||
|
|
||||||
if cond != nil && len(cond.Pairs) > 0 {
|
if cond != nil && len(cond.Pairs) > 0 {
|
||||||
orgIDs := make([]interface{}, 0, len(cond.Pairs))
|
orgIDs := make([]string, 0, len(cond.Pairs))
|
||||||
for _, p := range cond.Pairs {
|
for _, p := range cond.Pairs {
|
||||||
orgIDs = append(orgIDs, p.OrgId)
|
orgIDs = append(orgIDs, fmt.Sprintf("%d", p.OrgId))
|
||||||
}
|
}
|
||||||
placeholders := make([]string, len(orgIDs))
|
notInClause := fmt.Sprintf("org_id NOT IN (%s)", strings.Join(orgIDs, ","))
|
||||||
for i := range orgIDs {
|
e = e.Where(notInClause)
|
||||||
placeholders[i] = "?"
|
|
||||||
}
|
|
||||||
whereClause := fmt.Sprintf("%s NOT IN (%s)", models.NEWS_COLUMN_ORG_ID, strings.Join(placeholders, ","))
|
|
||||||
e = e.Where(whereClause, orgIDs...) // 必须 e = e.Where
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, total, err = e.QueryEx()
|
_, total, err = e.QueryEx()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue