@@ -3,6 +3,7 @@ package dao | |||||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | import "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
type AgentWithMediumDao interface { | type AgentWithMediumDao interface { | ||||
AgentWithMediumInsert(m *model.AgentWithMedium) (int64, error) | |||||
FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) | FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) | ||||
GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) | GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) | ||||
FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) | FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) | ||||
@@ -0,0 +1,5 @@ | |||||
package dao | |||||
type UserListDao interface { | |||||
//TODO:: You can add specific method definitions here | |||||
} |
@@ -14,6 +14,14 @@ type AgentWithMediumDb struct { | |||||
Db *xorm.Engine | 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) { | func (a AgentWithMediumDb) GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) { | ||||
medium = new(model.AgentWithMedium) | medium = new(model.AgentWithMedium) | ||||
get, err := a.Db.Where("medium_id=? and agent_id=?", mediumId, agentId).Get(medium) | get, err := a.Db.Where("medium_id=? and agent_id=?", mediumId, agentId).Get(medium) | ||||
@@ -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 | |||||
} |
@@ -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"` | |||||
} |