code refactor

This commit is contained in:
MaysWind
2020-12-22 23:01:33 +08:00
parent 024960f767
commit 5ba83192b0
6 changed files with 21 additions and 5 deletions
+3 -1
View File
@@ -286,7 +286,9 @@ func (s *TransactionCategoryService) DeleteCategory(uid int64, categoryId int64)
exists, err := sess.Cols("uid", "deleted", "category_id").Where("uid=? AND deleted=?", uid, false).In("category_id", categoryAndSubCategoryIds).Limit(1).Exist(&models.Transaction{})
if exists {
if err != nil {
return err
} else if exists {
return errs.ErrTransactionCategoryInUseCannotBeDeleted
}