From 5eb7d8513c6a7f107f759b4f6e22c9d620b1dedd Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Sat, 7 Dec 2024 10:11:44 +0800 Subject: [PATCH] update --- src/dao/user_tag_records_dao.go | 2 ++ src/implement/user_tag_records_implement.go | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/dao/user_tag_records_dao.go b/src/dao/user_tag_records_dao.go index ba20c60..5ed1966 100644 --- a/src/dao/user_tag_records_dao.go +++ b/src/dao/user_tag_records_dao.go @@ -12,4 +12,6 @@ type UserTagRecordsDao interface { UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error) UserTagRecordsBatchInsertBySession(session *xorm.Session, userTagRecord []*model.UserTagRecords) (int64, error) UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error) + UserTagRecordsExist(uid int64, tagId int) (bool, error) + UserTagRecordsDelete(uid int64, tagId int) (int64, error) } diff --git a/src/implement/user_tag_records_implement.go b/src/implement/user_tag_records_implement.go index c156ce7..881da62 100644 --- a/src/implement/user_tag_records_implement.go +++ b/src/implement/user_tag_records_implement.go @@ -76,3 +76,20 @@ func (u UserTagRecordsDb) UserTagRecordsFindByParams(params map[string]interface } return &m, nil } + +func (u UserTagRecordsDb) UserTagRecordsExist(uid int64, tagId int) (bool, error) { + var m model.UserTagRecords + exist, err := u.Db.Where("uid = ?", uid).And("tag_id = ?", tagId).Exist(m) + if err != nil { + return false, zhios_order_relate_logx.Error(err) + } + return exist, nil +} + +func (u UserTagRecordsDb) UserTagRecordsDelete(uid int64, tagId int) (int64, error) { + affected, err := u.Db.Where("uid = ?", uid).And("tag_id = ?", tagId).Delete(model.UserTagRecords{}) + if err != nil { + return 0, zhios_order_relate_logx.Error(err) + } + return affected, nil +}