shenjiachi 5 dni temu
rodzic
commit
5eb7d8513c
2 zmienionych plików z 19 dodań i 0 usunięć
  1. +2
    -0
      src/dao/user_tag_records_dao.go
  2. +17
    -0
      src/implement/user_tag_records_implement.go

+ 2
- 0
src/dao/user_tag_records_dao.go Wyświetl plik

@@ -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)
}

+ 17
- 0
src/implement/user_tag_records_implement.go Wyświetl plik

@@ -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
}

Ładowanie…
Anuluj
Zapisz