Browse Source

update

master
shenjiachi 1 day ago
parent
commit
2fadc60eff
1 changed files with 14 additions and 5 deletions
  1. +14
    -5
      src/implement/user_tag_records_implement.go

+ 14
- 5
src/implement/user_tag_records_implement.go View File

@@ -3,6 +3,7 @@ package implement
import ( import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt" "fmt"
"reflect" "reflect"
@@ -44,10 +45,10 @@ func (u UserTagRecordsDb) UserTagRecordsUpdateBySession(session *xorm.Session, u


func (u UserTagRecordsDb) UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error) { func (u UserTagRecordsDb) UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error) {
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { if reflect.TypeOf(params["value"]).Kind() == reflect.Slice {
return session.In(zhios_order_relate_logx.AnyToString(params["key"]), params["value"]).Delete(model.UserTag{})
return session.In(zhios_order_relate_logx.AnyToString(params["key"]), params["value"]).Delete(model.UserTagRecords{})
} else { } else {
var query = fmt.Sprintf("%s =?", params["key"]) var query = fmt.Sprintf("%s =?", params["key"])
return session.Where(query, params["value"]).Delete(model.UserTag{})
return session.Where(query, params["value"]).Delete(model.UserTagRecords{})
} }
} }


@@ -61,9 +62,17 @@ func (u UserTagRecordsDb) UserTagRecordsBatchInsert(userTagRecord []*model.UserT


func (u UserTagRecordsDb) UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error) { func (u UserTagRecordsDb) UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error) {
var m []model.UserTagRecords var m []model.UserTagRecords
var query = fmt.Sprintf("%s = ?", params["key"])
if err := u.Db.Where(query, params["value"]).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice {
//指定In查询
if err := u.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Warn(err)
}
} else {
var query = fmt.Sprintf("%s =?", params["key"])
err := u.Db.Where(query, params["value"]).Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
} }
return &m, nil return &m, nil
} }

Loading…
Cancel
Save