浏览代码

update

master
shenjiachi 3 天前
父节点
当前提交
ae1be0db6a
共有 4 个文件被更改,包括 21 次插入0 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存