From 035e7587f16e6fa60d4d3225e5465dab6afc04f4 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 14 Dec 2020 00:24:44 +0800 Subject: [PATCH] code refactor --- pkg/services/accounts.go | 6 +++--- pkg/services/transaction_categories.go | 2 +- pkg/services/transaction_tags.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index 2843c9e4..18f12a45 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -211,7 +211,7 @@ func (s *AccountService) HideAccount(uid int64, ids []int64, hidden bool) error } return s.UserDataDB(uid).DoTransaction(func(sess *xorm.Session) error { - updatedRows, err := sess.Cols("hidden", "updated_unix_time").In("account_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) + updatedRows, err := sess.Cols("hidden", "updated_unix_time").Where("uid=? AND deleted=?", uid, false).In("account_id", ids).Update(updateModel) if err != nil { return err @@ -261,7 +261,7 @@ func (s *AccountService) DeleteAccounts(uid int64, ids []int64) error { } return s.UserDataDB(uid).DoTransaction(func(sess *xorm.Session) error { - deletedRows, err := sess.Cols("deleted", "deleted_unix_time").In("account_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) + deletedRows, err := sess.Cols("deleted", "deleted_unix_time").Where("uid=? AND deleted=?", uid, false).In("account_id", ids).Update(updateModel) if err != nil { return err @@ -269,7 +269,7 @@ func (s *AccountService) DeleteAccounts(uid int64, ids []int64) error { return errs.ErrAccountNotFound } - _, err = sess.Cols("deleted", "deleted_unix_time").In("parent_account_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) + _, err = sess.Cols("deleted", "deleted_unix_time").Where("uid=? AND deleted=?", uid, false).In("parent_account_id", ids).Update(updateModel) return err }) diff --git a/pkg/services/transaction_categories.go b/pkg/services/transaction_categories.go index 0caa02cc..1375604d 100644 --- a/pkg/services/transaction_categories.go +++ b/pkg/services/transaction_categories.go @@ -219,7 +219,7 @@ func (s *TransactionCategoryService) HideCategory(uid int64, ids []int64, hidden } return s.UserDataDB(uid).DoTransaction(func(sess *xorm.Session) error { - updatedRows, err := sess.Cols("hidden", "updated_unix_time").In("category_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) + updatedRows, err := sess.Cols("hidden", "updated_unix_time").Where("uid=? AND deleted=?", uid, false).In("category_id", ids).Update(updateModel) if err != nil { return err diff --git a/pkg/services/transaction_tags.go b/pkg/services/transaction_tags.go index 8e2cefcf..7998c6d0 100644 --- a/pkg/services/transaction_tags.go +++ b/pkg/services/transaction_tags.go @@ -169,7 +169,7 @@ func (s *TransactionTagService) HideTag(uid int64, ids []int64, hidden bool) err } return s.UserDataDB(uid).DoTransaction(func(sess *xorm.Session) error { - updatedRows, err := sess.Cols("hidden", "updated_unix_time").In("tag_id", ids).Where("uid=?", uid).Update(updateModel) + updatedRows, err := sess.Cols("hidden", "updated_unix_time").Where("uid=?", uid).In("tag_id", ids).Update(updateModel) if err != nil { return err