面包店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 rivejä
826 B

  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils/logx"
  5. "xorm.io/xorm"
  6. )
  7. type AgentBase struct {
  8. Session *xorm.Session
  9. AgentBase *model.RegionalAgentBase
  10. }
  11. func NewAgentBase(session *xorm.Session, agentBase *model.RegionalAgentBase) *AgentBase {
  12. return &AgentBase{
  13. Session: session,
  14. AgentBase: agentBase,
  15. }
  16. }
  17. func (a AgentBase) GetAgentBaseInfo() bool {
  18. isHas, err := a.Session.Get(a.AgentBase)
  19. if err != nil {
  20. return false
  21. }
  22. if !isHas {
  23. return false
  24. }
  25. return true
  26. }
  27. // GetCountByRegionalAgentBase 通过传入的参数查询数据(单条)
  28. func GetCountByRegionalAgentBase(Db *xorm.Engine) (*model.RegionalAgentBase, error) {
  29. var m model.RegionalAgentBase
  30. get, err := Db.Get(&m)
  31. if err != nil {
  32. return &m, err
  33. }
  34. if !get {
  35. return &m, logx.Warn("Not found")
  36. }
  37. return &m, nil
  38. }