Skip to content

Commit

Permalink
feat(sqlbuilderzero): fix pageByCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Aug 22, 2024
1 parent 6a5009b commit ea25651
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .template/go-zero/model/customized.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ func (m *custom{{.upperStartCamelObject}}Model) PageByCondition(ctx context.Cont
countsb := sqlbuilder.Select("count(*)").From(m.table)

condition.ApplySelect(sb, conds...)
condition.ApplySelect(countsb, conds...)

var countConds []condition.Condition
for _, cond := range conds {
if cond.Operator != condition.Limit && cond.Operator != condition.Offset {
countConds = append(countConds, cond)
}
}
condition.ApplySelect(countsb, countConds...)

var resp []*{{.upperStartCamelObject}}

Expand Down

0 comments on commit ea25651

Please sign in to comment.