作者 郑周

1 系统消息,条件查询补充

... ... @@ -121,13 +121,13 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("id desc")
if v, ok := queryOptions["companyId"]; ok {
tx.Where("company_id = ?", v)
}
if v, ok := queryOptions["recipientId"]; ok {
tx.Where("recipient_id = ?", v)
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
if v, ok := queryOptions["companyId"]; ok {
tx.Where("company_id = ?", v)
}
if v, ok := queryOptions["recipientId"]; ok {
tx.Where("recipient_id = ?", v)
}
return dms, tx.Error
}
return dms, nil
... ...