From 2345c97fc95a2761d345cffaea131a6cc36eeed5 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 18 Sep 2024 21:05:41 +0800 Subject: [PATCH 1/2] 1 --- src/super/dao/agent_with_medium_dao.go | 1 + src/super/implement/agent_with_medium_db.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/super/dao/agent_with_medium_dao.go b/src/super/dao/agent_with_medium_dao.go index 6bcc57a..327cd1b 100644 --- a/src/super/dao/agent_with_medium_dao.go +++ b/src/super/dao/agent_with_medium_dao.go @@ -3,6 +3,7 @@ package dao import "code.fnuoos.com/zhimeng/model.git/src/super/model" type AgentWithMediumDao interface { + AgentWithMediumInsert(m *model.AgentWithMedium) (int64, error) FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) diff --git a/src/super/implement/agent_with_medium_db.go b/src/super/implement/agent_with_medium_db.go index 280052c..6552f0a 100644 --- a/src/super/implement/agent_with_medium_db.go +++ b/src/super/implement/agent_with_medium_db.go @@ -14,6 +14,14 @@ type AgentWithMediumDb struct { Db *xorm.Engine } +func (a AgentWithMediumDb) AgentWithMediumInsert(m *model.AgentWithMedium) (int64, error) { + insertAffected, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return insertAffected, nil +} + func (a AgentWithMediumDb) GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) { medium = new(model.AgentWithMedium) get, err := a.Db.Where("medium_id=? and agent_id=?", mediumId, agentId).Get(medium) From abf78f48200d602896dc8bc625708949e52aba19 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Fri, 20 Sep 2024 17:41:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/super/dao/user_list_dao.go | 5 +++++ src/super/implement/user_list_implement.go | 14 ++++++++++++++ src/super/model/user_list.go | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/super/dao/user_list_dao.go create mode 100644 src/super/implement/user_list_implement.go create mode 100644 src/super/model/user_list.go diff --git a/src/super/dao/user_list_dao.go b/src/super/dao/user_list_dao.go new file mode 100644 index 0000000..ba8058c --- /dev/null +++ b/src/super/dao/user_list_dao.go @@ -0,0 +1,5 @@ +package dao + +type UserListDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/super/implement/user_list_implement.go b/src/super/implement/user_list_implement.go new file mode 100644 index 0000000..0c106d3 --- /dev/null +++ b/src/super/implement/user_list_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/zhimeng/model.git/src/super/dao" + "xorm.io/xorm" +) + +func NewUserListDb(engine *xorm.Engine) dao.UserListDao { + return &UserListDb{Db: engine} +} + +type UserListDb struct { + Db *xorm.Engine +} diff --git a/src/super/model/user_list.go b/src/super/model/user_list.go new file mode 100644 index 0000000..2761aa6 --- /dev/null +++ b/src/super/model/user_list.go @@ -0,0 +1,13 @@ +package model + +import ( + "time" +) + +type UserList struct { + Uuid int `json:"uuid" xorm:"not null default 0 comment('msater_id') INT(10)"` + Name string `json:"name" xorm:"not null default '' comment('昵称') VARCHAR(32)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态0未激活,1正常.2禁用') TINYINT(1)"` + DeleteAt time.Time `json:"delete_at" xorm:"comment('删除时间') TIMESTAMP"` +}