Kaynağa Gözat

update

master
shenjiachi 3 gün önce
ebeveyn
işleme
ae1be0db6a
4 değiştirilmiş dosya ile 21 ekleme ve 0 silme
  1. +1
    -0
      src/dao/user_tag_dao.go
  2. +1
    -0
      src/dao/user_tag_records_dao.go
  3. +10
    -0
      src/implement/user_tag_implement.go
  4. +9
    -0
      src/implement/user_tag_records_implement.go

+ 1
- 0
src/dao/user_tag_dao.go Dosyayı Görüntüle

@@ -12,4 +12,5 @@ type UserTagDao interface {
UserTagUpdate(id interface{}, userTag *model.UserTag, forceColumns ...string) (int64, error)
UserTagDeleteBySession(session *xorm.Session, tagID interface{}) (int64, error)
UserTagInsert(userTag *model.UserTag) (int, error)
UserTagGetOneByParams(params map[string]interface{}) (*model.UserTag, error)
}

+ 1
- 0
src/dao/user_tag_records_dao.go Dosyayı Görüntüle

@@ -14,4 +14,5 @@ type UserTagRecordsDao interface {
UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error)
UserTagRecordsExist(uid int64, tagId int) (bool, error)
UserTagRecordsDelete(uid int64, tagId int) (int64, error)
UserTagRecordsIsUsedBySession(session *xorm.Session, tagId int) (bool, error)
}

+ 10
- 0
src/implement/user_tag_implement.go Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"reflect"
"xorm.io/xorm"
)
@@ -65,3 +66,12 @@ func (u UserTagDb) UserTagInsert(userTag *model.UserTag) (int, error) {
}
return userTag.Id, nil
}

func (u UserTagDb) UserTagGetOneByParams(params map[string]interface{}) (*model.UserTag, error) {
var m model.UserTag
var query = fmt.Sprintf("%s = ?", params["key"])
if has, err := u.Db.Where(query, params["value"]).Get(&m); err != nil || has == false {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

+ 9
- 0
src/implement/user_tag_records_implement.go Dosyayı Görüntüle

@@ -93,3 +93,12 @@ func (u UserTagRecordsDb) UserTagRecordsDelete(uid int64, tagId int) (int64, err
}
return affected, nil
}

func (u UserTagRecordsDb) UserTagRecordsIsUsedBySession(session *xorm.Session, tagId int) (bool, error) {
var m model.UserTagRecords
exist, err := session.Where("tag_id = ?", tagId).Exist(&m)
if err != nil {
return false, zhios_order_relate_logx.Error(err)
}
return exist, nil
}

Yükleniyor…
İptal
Kaydet