mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
fix cannot filter transfer in transaction with transaction tags (#82)
This commit is contained in:
@@ -1983,7 +1983,7 @@ func (s *TransactionService) appendFilterTagIdsConditionToQuery(sess *xorm.Sessi
|
|||||||
|
|
||||||
if noTags {
|
if noTags {
|
||||||
subQuery := builder.Select("transaction_id").From("transaction_tag_index").Where(subQueryCondition)
|
subQuery := builder.Select("transaction_id").From("transaction_tag_index").Where(subQueryCondition)
|
||||||
sess.NotIn("transaction_id", subQuery)
|
sess.NotIn("transaction_id", subQuery).NotIn("related_id", subQuery)
|
||||||
return sess
|
return sess
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1999,9 +1999,9 @@ func (s *TransactionService) appendFilterTagIdsConditionToQuery(sess *xorm.Sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if tagFilterType == models.TRANSACTION_TAG_FILTER_HAS_ANY || tagFilterType == models.TRANSACTION_TAG_FILTER_HAS_ALL {
|
if tagFilterType == models.TRANSACTION_TAG_FILTER_HAS_ANY || tagFilterType == models.TRANSACTION_TAG_FILTER_HAS_ALL {
|
||||||
sess.In("transaction_id", subQuery)
|
sess.And(builder.Or(builder.In("transaction_id", subQuery), builder.In("related_id", subQuery)))
|
||||||
} else if tagFilterType == models.TRANSACTION_TAG_FILTER_NOT_HAS_ANY || tagFilterType == models.TRANSACTION_TAG_FILTER_NOT_HAS_ALL {
|
} else if tagFilterType == models.TRANSACTION_TAG_FILTER_NOT_HAS_ANY || tagFilterType == models.TRANSACTION_TAG_FILTER_NOT_HAS_ALL {
|
||||||
sess.NotIn("transaction_id", subQuery)
|
sess.NotIn("transaction_id", subQuery).NotIn("related_id", subQuery)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sess
|
return sess
|
||||||
|
|||||||
Reference in New Issue
Block a user