|
|
@@ -5,6 +5,7 @@ import ( |
|
|
|
"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" |
|
|
|
) |
|
|
|
|
|
|
@@ -41,10 +42,28 @@ func (u UserTagRecordsDb) UserTagRecordsUpdateBySession(session *xorm.Session, u |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserTagRecordsDb) UserTagRecordDeleteBySession(session *xorm.Session, tagID int64) (int64, error) { |
|
|
|
affected, err := session.Where("tag_id = ?", tagID).Delete(model.UserTagRecords{}) |
|
|
|
func (u UserTagRecordsDb) UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error) { |
|
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
|
return session.In(zhios_order_relate_logx.AnyToString(params["key"]), params["value"]).Delete(model.UserTag{}) |
|
|
|
} else { |
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
return session.Where(query, params["value"]).Delete(model.UserTag{}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserTagRecordsDb) UserTagRecordsBatchInsert(userTagRecord []*model.UserTagRecords) (int64, error) { |
|
|
|
affected, err := u.Db.Insert(userTagRecord) |
|
|
|
if err != nil { |
|
|
|
return 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
return 0, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserTagRecordsDb) UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error) { |
|
|
|
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) |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |