Browse Source

update

master
shenjiachi 1 month ago
parent
commit
980be92ee6
5 changed files with 40 additions and 14 deletions
  1. +1
    -0
      src/dao/im_send_red_package_ord_dao.go
  2. +3
    -1
      src/dao/user_tag_records_dao.go
  3. +8
    -0
      src/implement/im_send_red_package_ord_implement.go
  4. +22
    -3
      src/implement/user_tag_records_implement.go
  5. +6
    -10
      src/model/user_tag_records.go

+ 1
- 0
src/dao/im_send_red_package_ord_dao.go View File

@@ -9,4 +9,5 @@ type ImSendRedPackageOrdDao interface {
//TODO:: You can add specific method definitions here
ImSendRedPackageOrdGetOneByParams(params map[string]interface{}) (*model.ImSendRedPackageOrd, error)
ImSendRedPackageOrdUpdateBySession(session *xorm.Session, id interface{}, user *model.ImSendRedPackageOrd, forceColumns ...string) (int64, error)
ImSendRedPackageOrdInsertBySession(session *xorm.Session, m *model.ImSendRedPackageOrd) (int64, error)
}

+ 3
- 1
src/dao/user_tag_records_dao.go View File

@@ -9,5 +9,7 @@ type UserTagRecordsDao interface {
//TODO:: You can add specific method definitions here
UserTagRecordsGetOneByParams(params map[string]interface{}) (*model.UserTagRecords, error)
UserTagRecordsUpdateBySession(session *xorm.Session, uid interface{}, user *model.UserTagRecords, forceColumns ...string) (int64, error)
UserTagRecordDeleteBySession(session *xorm.Session, tagID int64) (int64, error)
UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error)
UserTagRecordsBatchInsert(userTagRecord []*model.UserTagRecords) (int64, error)
UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error)
}

+ 8
- 0
src/implement/im_send_red_package_ord_implement.go View File

@@ -40,3 +40,11 @@ func (i ImSendRedPackageOrdDb) ImSendRedPackageOrdUpdateBySession(session *xorm.
}
return affected, nil
}

func (i ImSendRedPackageOrdDb) ImSendRedPackageOrdInsertBySession(session *xorm.Session, m *model.ImSendRedPackageOrd) (int64, error) {
_, err := session.Insert(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

+ 22
- 3
src/implement/user_tag_records_implement.go View File

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

+ 6
- 10
src/model/user_tag_records.go View File

@@ -1,14 +1,10 @@
package model

import (
"time"
)

type UserTagRecords struct {
Id int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
TagId int `json:"tag_id" xorm:"not null default 0 INT(11)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('关联UserID') BIGINT(20)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') CHAR(50)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Id int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
TagId int `json:"tag_id" xorm:"not null default 0 INT(11)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('关联UserID') BIGINT(20)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') CHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Loading…
Cancel
Save