dengbiao 4 months ago
parent
commit
3a2975debe
6 changed files with 36 additions and 4 deletions
  1. +2
    -1
      src/super/dao/agent_list_dao.go
  2. +2
    -1
      src/super/dao/medium_list_dao.go
  3. +15
    -1
      src/super/implement/agent_list_implement.go
  4. +15
    -1
      src/super/implement/medium_list_implement.go
  5. +1
    -0
      src/super/model/agent_list.go
  6. +1
    -0
      src/super/model/medium_list.go

+ 2
- 1
src/super/dao/agent_list_dao.go View File

@@ -1,4 +1,4 @@
package dao
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

@@ -6,4 +6,5 @@ type AgentListDao interface {
GetAgentList(agentId int) (medium *model.AgentList, err error)
AgentListInsert(m *model.AgentList) (int64, error)
UpdateAgentList(m *model.AgentList, columns ...string) (int64, error)
FindAgentList(name, state string, page, limit int) (list []model.AgentList, total int64, err error)
}

+ 2
- 1
src/super/dao/medium_list_dao.go View File

@@ -1,4 +1,4 @@
package dao
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

@@ -6,4 +6,5 @@ type MediumListDao interface {
GetMediumList(mediumId int) (medium *model.MediumList, err error)
MediumListInsert(m *model.MediumList) (int64, error)
UpdateMediumList(m *model.MediumList, columns ...string) (int64, error)
FindMediumList(name, state string, page, limit int) (list []model.MediumList, total int64, err error)
}

+ 15
- 1
src/super/implement/agent_list_implement.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
@@ -42,3 +42,17 @@ func (a AgentListDb) UpdateAgentList(m *model.AgentList, columns ...string) (int
}
return affected, nil
}
func (a AgentListDb) FindAgentList(name, state string, page, limit int) (list []model.AgentList, total int64, err error) {
sess := a.Db.Where("state>0").Desc("id").Limit(limit, (page-1)*limit)
if name != "" {
sess.And("company_name like ?", "%"+name+"%")
}
if state != "" {
sess.And("state = ?", state)
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 15
- 1
src/super/implement/medium_list_implement.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
@@ -42,3 +42,17 @@ func (m MediumListDb) UpdateMediumList(medium *model.MediumList, columns ...stri
}
return affected, nil
}
func (m MediumListDb) FindMediumList(name, state string, page, limit int) (list []model.MediumList, total int64, err error) {
sess := m.Db.Where("state>0").Desc("id").Limit(limit, (page-1)*limit)
if name != "" {
sess.And("company_name like ?", "%"+name+"%")
}
if state != "" {
sess.And("state = ?", state)
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 1
- 0
src/super/model/agent_list.go View File

@@ -22,4 +22,5 @@ type AgentList struct {
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') 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"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
}

+ 1
- 0
src/super/model/medium_list.go View File

@@ -22,4 +22,5 @@ type MediumList struct {
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') 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"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
}

Loading…
Cancel
Save