@@ -0,0 +1,9 @@ | |||||
package dao | |||||
import "code.fnuoos.com/zhimeng/model.git/src/model" | |||||
type AdminBindMediumDao interface { | |||||
FindAll(adminId int) (list []model.AdminBindMedium) | |||||
FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) | |||||
GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium) | |||||
} |
@@ -1,4 +1,4 @@ | |||||
package dao | |||||
package dao | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/model" | "code.fnuoos.com/zhimeng/model.git/src/model" | ||||
@@ -9,6 +9,7 @@ type AdminDao interface { | |||||
CreateAdminId() (admId int, err error) | CreateAdminId() (admId int, err error) | ||||
AdminDeleteBySession(session *xorm.Session, admId interface{}) (int64, error) | AdminDeleteBySession(session *xorm.Session, admId interface{}) (int64, error) | ||||
GetAdmin(id int) (m *model.Admin, err error) | GetAdmin(id int) (m *model.Admin, err error) | ||||
GetSuperAdmin() (m *model.Admin, err error) | |||||
GetAdminByUserName(userName string) (m *model.Admin, err error) | GetAdminByUserName(userName string) (m *model.Admin, err error) | ||||
GetAdminRolePermission(admId int) (list []*AdminRolePermission, total int64, err error) | GetAdminRolePermission(admId int) (list []*AdminRolePermission, total int64, err error) | ||||
FindAdmin(username string, state, page, limit int) (list []model.Admin, total int64, err error) | FindAdmin(username string, state, page, limit int) (list []model.Admin, total int64, err error) | ||||
@@ -15,6 +15,7 @@ type MediumDao interface { | |||||
GetMedium(id int) (m *model.Medium, err error) | GetMedium(id int) (m *model.Medium, err error) | ||||
FindMediumRolePermissionGroup(id int) (list []*MediumWithRolePermissionGroup, total int64, err error) | FindMediumRolePermissionGroup(id int) (list []*MediumWithRolePermissionGroup, total int64, err error) | ||||
FindSuperAdmin(username, memo string, page, limit int) (list []model.Medium, total int64, err error) | FindSuperAdmin(username, memo string, page, limit int) (list []model.Medium, total int64, err error) | ||||
FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error) | |||||
GetSuperAdmin(mediumId int) (list *model.Medium) | GetSuperAdmin(mediumId int) (list *model.Medium) | ||||
} | } | ||||
@@ -0,0 +1,44 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/dao" | |||||
"code.fnuoos.com/zhimeng/model.git/src/model" | |||||
"strings" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewAdminBindMediumDb(engine *xorm.Engine) dao.AdminBindMediumDao { | |||||
return &AdminBindMediumDb{Db: engine} | |||||
} | |||||
type AdminBindMediumDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (a AdminBindMediumDb) FindAll(adminId int) (list []model.AdminBindMedium) { | |||||
sess := a.Db.Where("admin_id=?", adminId) | |||||
err := sess.Find(&list) | |||||
if err != nil { | |||||
return nil | |||||
} | |||||
return | |||||
} | |||||
func (a AdminBindMediumDb) GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium) { | |||||
sess := a.Db.Where("medium_id=? and admin_id=?", mediumId, adminId) | |||||
get, err := sess.Get(&list) | |||||
if get == false || err != nil { | |||||
return nil | |||||
} | |||||
return | |||||
} | |||||
func (a AdminBindMediumDb) FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) { | |||||
sess := a.Db.Where("admin_id=?", adminId).Desc("id").Limit(limit, (page-1)*limit) | |||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
total, err = sess.FindAndCount(&list) | |||||
if err != nil { | |||||
return nil, 0, err | |||||
} | |||||
return | |||||
} |
@@ -1,4 +1,4 @@ | |||||
package implement | |||||
package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/dao" | "code.fnuoos.com/zhimeng/model.git/src/dao" | ||||
@@ -48,6 +48,17 @@ func (a AdminDb) GetAdmin(id int) (m *model.Admin, err error) { | |||||
} | } | ||||
return m, nil | return m, nil | ||||
} | } | ||||
func (a AdminDb) GetSuperAdmin() (m *model.Admin, err error) { | |||||
m = new(model.Admin) | |||||
has, err := a.Db.Where("is_super_administrator =?", 1).Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | |||||
func (a AdminDb) GetAdminByUserName(userName string) (m *model.Admin, err error) { | func (a AdminDb) GetAdminByUserName(userName string) (m *model.Admin, err error) { | ||||
m = new(model.Admin) | m = new(model.Admin) | ||||
@@ -5,6 +5,7 @@ import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/model" | "code.fnuoos.com/zhimeng/model.git/src/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"reflect" | "reflect" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -112,6 +113,17 @@ func (m MediumDb) FindSuperAdmin(username, memo string, page, limit int) (list [ | |||||
} | } | ||||
return | return | ||||
} | } | ||||
func (m MediumDb) FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error) { | |||||
sess := m.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit) | |||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
total, err = sess.FindAndCount(&list) | |||||
if err != nil { | |||||
return nil, 0, err | |||||
} | |||||
return | |||||
} | |||||
func (m MediumDb) GetSuperAdmin(mediumId int) (list *model.Medium) { | func (m MediumDb) GetSuperAdmin(mediumId int) (list *model.Medium) { | ||||
list = new(model.Medium) | list = new(model.Medium) | ||||
sess := m.Db.Where("is_super_administrator=1 and medium_id=?", mediumId) | sess := m.Db.Where("is_super_administrator=1 and medium_id=?", mediumId) | ||||
@@ -1,4 +1,4 @@ | |||||
package implement | |||||
package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/enum" | "code.fnuoos.com/zhimeng/model.git/enum" | ||||
@@ -26,7 +26,7 @@ func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, erro | |||||
func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) { | func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) { | ||||
var m []model.PermissionGroup | var m []model.PermissionGroup | ||||
if err := p.Db.Asc("id").Find(&m); err != nil { | |||||
if err := p.Db.OrderBy("sort desc,id asc").Find(&m); err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | return nil, zhios_order_relate_logx.Error(err) | ||||
} | } | ||||
return &m, nil | return &m, nil | ||||
@@ -0,0 +1,13 @@ | |||||
package model | |||||
import ( | |||||
"time" | |||||
) | |||||
type AdminBindMedium struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
AdminId int `json:"admin_id" xorm:"default 0 comment('管理员id') INT(11)"` | |||||
MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` | |||||
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"` | |||||
} |
@@ -8,4 +8,5 @@ type PermissionGroup struct { | |||||
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` | State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` | ||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
Sort int `json:"sort" xorm:"not null default 0 comment('') INT(11)"` | |||||
} | } |
@@ -9,6 +9,7 @@ type GenerateWxAdDataDao interface { | |||||
GenerateWxAdDataInsertBySession(session *xorm.Session, m *model.GenerateWxAdData) (int64, error) | GenerateWxAdDataInsertBySession(session *xorm.Session, m *model.GenerateWxAdData) (int64, error) | ||||
GetGenerateWxAdData(id int) (data *model.GenerateWxAdData, err error) | GetGenerateWxAdData(id int) (data *model.GenerateWxAdData, err error) | ||||
UpdateGenerateWxAdDataBySession(session *xorm.Session, m *model.GenerateWxAdData, columns ...string) (int64, error) | UpdateGenerateWxAdDataBySession(session *xorm.Session, m *model.GenerateWxAdData, columns ...string) (int64, error) | ||||
FindGenerateWxAdDataList(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) | |||||
FindGenerateWxAdDataListMedium(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) | |||||
FindGenerateWxAdDataList(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) | |||||
FindGenerateWxAdDataListMedium(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) | |||||
FindGenerateWxAdDataListMediumAll(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, err error) | |||||
} | } |
@@ -4,7 +4,7 @@ import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
type MediumBankInfoDao interface { | type MediumBankInfoDao interface { | ||||
GetMediumBankInfoList(MediumId int) (medium *model.MediumBankInfo, err error) | GetMediumBankInfoList(MediumId int) (medium *model.MediumBankInfo, err error) | ||||
FindMediumBankInfoList(uuid, name, state string, page, limit int) (list []MediumBankInfoGroup, total int64, err error) | |||||
FindMediumBankInfoList(uuid, name, mediumId, state string, page, limit int) (list []MediumBankInfoGroup, total int64, err error) | |||||
} | } | ||||
type MediumBankInfoGroup struct { | type MediumBankInfoGroup struct { | ||||
model.MediumBankInfo `xorm:"extends"` | model.MediumBankInfo `xorm:"extends"` | ||||
@@ -4,7 +4,7 @@ import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
type MediumContactInfoDao interface { | type MediumContactInfoDao interface { | ||||
GetMediumContactInfoList(MediumId int) (medium *model.MediumContactInfo, err error) | GetMediumContactInfoList(MediumId int) (medium *model.MediumContactInfo, err error) | ||||
FindMediumContactInfoList(uuid, name, state string, page, limit int) (list []MediumContactInfoGroup, total int64, err error) | |||||
FindMediumContactInfoList(uuid, name, mediumId, state string, page, limit int) (list []MediumContactInfoGroup, total int64, err error) | |||||
} | } | ||||
type MediumContactInfoGroup struct { | type MediumContactInfoGroup struct { | ||||
model.MediumContactInfo `xorm:"extends"` | model.MediumContactInfo `xorm:"extends"` | ||||
@@ -10,6 +10,6 @@ type MediumListDao interface { | |||||
GetMediumListBySession(session *xorm.Session, mediumId int) (medium *model.MediumList, err error) | GetMediumListBySession(session *xorm.Session, mediumId int) (medium *model.MediumList, err error) | ||||
MediumListInsert(m *model.MediumList) (int64, error) | MediumListInsert(m *model.MediumList) (int64, error) | ||||
UpdateMediumList(m *model.MediumList, columns ...string) (int64, error) | UpdateMediumList(m *model.MediumList, columns ...string) (int64, error) | ||||
FindMediumList(uuid, name, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) | |||||
FindMediumList(uuid, name, mediumId, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) | |||||
FindMediumListBySettleType(uuid, mediumId, settleType string, page, limit int) (list []model.MediumList, total int64, err error) | FindMediumListBySettleType(uuid, mediumId, settleType string, page, limit int) (list []model.MediumList, total int64, err error) | ||||
} | } |
@@ -67,10 +67,10 @@ func (a AgentSettlementDb) FindAgentSettlementList(uuid, agentId, appId, payStat | |||||
sess.And("state = ?", state) | sess.And("state = ?", state) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("start_date>=", startDate) | |||||
sess.And("start_date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("end_date<=", endDate) | |||||
sess.And("end_date<=?", endDate) | |||||
} | } | ||||
if appId != "" { | if appId != "" { | ||||
sess.In("app_id", strings.Split(appId, ",")) | sess.In("app_id", strings.Split(appId, ",")) | ||||
@@ -43,20 +43,23 @@ func (g GenerateWxAdDataDb) GenerateWxAdDataInsertBySession(session *xorm.Sessio | |||||
} | } | ||||
return insertAffected, nil | return insertAffected, nil | ||||
} | } | ||||
func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { | |||||
func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { | |||||
sess := g.Db.OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) | sess := g.Db.OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) | ||||
if uuid != "" { | if uuid != "" { | ||||
sess.And("uuid = ?", uuid) | sess.And("uuid = ?", uuid) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("date>=", startDate) | |||||
sess.And("date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("date<=", endDate) | |||||
sess.And("date<=?", endDate) | |||||
} | } | ||||
if appId != "" { | if appId != "" { | ||||
sess.In("app_id", strings.Split(appId, ",")) | sess.In("app_id", strings.Split(appId, ",")) | ||||
} | } | ||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if slotId != "" { | if slotId != "" { | ||||
sess.In("slot_id", strings.Split(slotId, ",")) | sess.In("slot_id", strings.Split(slotId, ",")) | ||||
} | } | ||||
@@ -66,20 +69,23 @@ func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, slotId, startD | |||||
} | } | ||||
return | return | ||||
} | } | ||||
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { | |||||
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { | |||||
sess := g.Db.Where("is_generate_report=1").OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) | sess := g.Db.Where("is_generate_report=1").OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) | ||||
if uuid != "" { | if uuid != "" { | ||||
sess.And("uuid = ?", uuid) | sess.And("uuid = ?", uuid) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("date>=", startDate) | |||||
sess.And("date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("date<=", endDate) | |||||
sess.And("date<=?", endDate) | |||||
} | } | ||||
if appId != "" { | if appId != "" { | ||||
sess.In("app_id", strings.Split(appId, ",")) | sess.In("app_id", strings.Split(appId, ",")) | ||||
} | } | ||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if slotId != "" { | if slotId != "" { | ||||
sess.In("slot_id", strings.Split(slotId, ",")) | sess.In("slot_id", strings.Split(slotId, ",")) | ||||
} | } | ||||
@@ -89,3 +95,29 @@ func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, slotId, | |||||
} | } | ||||
return | return | ||||
} | } | ||||
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMediumAll(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, err error) { | |||||
sess := g.Db.Where("is_generate_report=1").OrderBy("date asc,id asc").Limit(limit, (page-1)*limit) | |||||
if uuid != "" { | |||||
sess.And("uuid = ?", uuid) | |||||
} | |||||
if startDate != "" { | |||||
sess.And("date>=?", startDate) | |||||
} | |||||
if endDate != "" { | |||||
sess.And("date<=?", endDate) | |||||
} | |||||
if appId != "" { | |||||
sess.In("app_id", strings.Split(appId, ",")) | |||||
} | |||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if slotId != "" { | |||||
sess.In("slot_id", strings.Split(slotId, ",")) | |||||
} | |||||
err = sess.Find(&list) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
return | |||||
} |
@@ -57,10 +57,10 @@ func (m MasterDataStatisticsDb) FindMasterDataStatisticsList(uuid, startDate, en | |||||
sess.And("uuid = ?", uuid) | sess.And("uuid = ?", uuid) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("date>=", startDate) | |||||
sess.And("date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("date<=", endDate) | |||||
sess.And("date<=?", endDate) | |||||
} | } | ||||
total, err = sess.FindAndCount(&list) | total, err = sess.FindAndCount(&list) | ||||
if err != nil { | if err != nil { | ||||
@@ -4,6 +4,7 @@ import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | "code.fnuoos.com/zhimeng/model.git/src/super/dao" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -26,8 +27,11 @@ func (a MediumBankInfoDb) GetMediumBankInfoList(MediumId int) (medium *model.Med | |||||
} | } | ||||
return medium, nil | return medium, nil | ||||
} | } | ||||
func (a MediumBankInfoDb) FindMediumBankInfoList(uuid, name, state string, page, limit int) (list []dao.MediumBankInfoGroup, total int64, err error) { | |||||
func (a MediumBankInfoDb) FindMediumBankInfoList(uuid, name, mediumId, state string, page, limit int) (list []dao.MediumBankInfoGroup, total int64, err error) { | |||||
sess := a.Db.Where("medium_bank_info.state>0").Desc("medium_bank_info.id").Limit(limit, (page-1)*limit) | sess := a.Db.Where("medium_bank_info.state>0").Desc("medium_bank_info.id").Limit(limit, (page-1)*limit) | ||||
if mediumId != "" { | |||||
sess.In("medium_list.medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if name != "" { | if name != "" { | ||||
sess.And("medium_list.company_name like ?", "%"+name+"%") | sess.And("medium_list.company_name like ?", "%"+name+"%") | ||||
} | } | ||||
@@ -4,6 +4,7 @@ import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | "code.fnuoos.com/zhimeng/model.git/src/super/dao" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -26,8 +27,11 @@ func (a MediumContactInfoDb) GetMediumContactInfoList(MediumId int) (medium *mod | |||||
} | } | ||||
return medium, nil | return medium, nil | ||||
} | } | ||||
func (a MediumContactInfoDb) FindMediumContactInfoList(uuid, name, state string, page, limit int) (list []dao.MediumContactInfoGroup, total int64, err error) { | |||||
func (a MediumContactInfoDb) FindMediumContactInfoList(uuid, name, mediumId, state string, page, limit int) (list []dao.MediumContactInfoGroup, total int64, err error) { | |||||
sess := a.Db.Where("medium_contact_info.state>0").Desc("medium_contact_info.id").Limit(limit, (page-1)*limit) | sess := a.Db.Where("medium_contact_info.state>0").Desc("medium_contact_info.id").Limit(limit, (page-1)*limit) | ||||
if mediumId != "" { | |||||
sess.In("medium_list.medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if name != "" { | if name != "" { | ||||
sess.And("medium_list.company_name like ?", "%"+name+"%") | sess.And("medium_list.company_name like ?", "%"+name+"%") | ||||
} | } | ||||
@@ -52,8 +52,11 @@ func (m MediumListDb) UpdateMediumList(medium *model.MediumList, columns ...stri | |||||
} | } | ||||
return affected, nil | return affected, nil | ||||
} | } | ||||
func (m MediumListDb) FindMediumList(uuid, name, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) { | |||||
func (m MediumListDb) FindMediumList(uuid, name, mediumId, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) { | |||||
sess := m.Db.Desc("id").Limit(limit, (page-1)*limit) | sess := m.Db.Desc("id").Limit(limit, (page-1)*limit) | ||||
if mediumId != "" { | |||||
sess.In("medium_id", strings.Split(mediumId, ",")) | |||||
} | |||||
if name != "" { | if name != "" { | ||||
sess.And("company_name like ?", "%"+name+"%") | sess.And("company_name like ?", "%"+name+"%") | ||||
} | } | ||||
@@ -66,10 +66,10 @@ func (m MediumSettlementDb) FindMediumSettlementList(uuid, mediumId, appId, payS | |||||
sess.And("state = ?", state) | sess.And("state = ?", state) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("start_date>=", startDate) | |||||
sess.And("start_date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("end_date<=", endDate) | |||||
sess.And("end_date<=?", endDate) | |||||
} | } | ||||
if appId != "" { | if appId != "" { | ||||
sess.In("app_id", strings.Split(appId, ",")) | sess.In("app_id", strings.Split(appId, ",")) | ||||
@@ -60,10 +60,10 @@ func (o OriginalWxAdDataDb) FindOriginalWxAdDataList(uuid, appId, slotId, startD | |||||
sess.And("uuid = ?", uuid) | sess.And("uuid = ?", uuid) | ||||
} | } | ||||
if startDate != "" { | if startDate != "" { | ||||
sess.And("date>=", startDate) | |||||
sess.And("date>=?", startDate) | |||||
} | } | ||||
if endDate != "" { | if endDate != "" { | ||||
sess.And("date<=", endDate) | |||||
sess.And("date<=?", endDate) | |||||
} | } | ||||
if appId != "" { | if appId != "" { | ||||
sess.In("app_id", strings.Split(appId, ",")) | sess.In("app_id", strings.Split(appId, ",")) | ||||