dengbiao 1 month ago
parent
commit
a3dd3d4a9d
4 changed files with 15 additions and 11 deletions
  1. +0
    -1
      go.mod
  2. +1
    -0
      src/dao/user_tag_dao.go
  3. +8
    -0
      src/implement/user_tag_implement.go
  4. +6
    -10
      src/model/user_tag.go

+ 0
- 1
go.mod View File

@@ -20,7 +20,6 @@ require (
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect


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

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

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

@@ -57,3 +57,11 @@ func (u UserTagDb) UserTagDeleteBySession(session *xorm.Session, tagID interface
return session.Where("id = ?", tagID).Delete(model.UserTag{})
}
}

func (u UserTagDb) UserTagInsert(userTag *model.UserTag) (int, error) {
_, err := u.Db.InsertOne(userTag)
if err != nil {
return 0, zhios_order_relate_logx.Error(err)
}
return userTag.Id, nil
}

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

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

import (
"time"
)

type UserTag struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
TagName string `json:"tag_name" xorm:"not null default '' comment('tag名') index VARCHAR(16)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(80)"`
IsPunish int `json:"is_punish" xorm:"not null default 0 comment('是否为处罚标签(0:否 1:是)') TINYINT(1)"`
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 INT(11)"`
TagName string `json:"tag_name" xorm:"not null default '' comment('tag名') index VARCHAR(16)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(80)"`
IsPunish int `json:"is_punish" xorm:"not null default 0 comment('是否为处罚标签(0:否 1:是)') TINYINT(1)"`
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