|
|
@@ -0,0 +1,41 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewAdminLogDb(engine *xorm.Engine) dao.AdminLogDao { |
|
|
|
return &AdminLogDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type AdminLogDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (a AdminLogDb) FindAdminLogAndTotal(page, limit, types, memo, startTime, endTime string) (*[]model.AdminLog, int64, error) { |
|
|
|
var m []model.AdminLog |
|
|
|
sess := a.Db.Where("1=1") |
|
|
|
|
|
|
|
if startTime != "" { |
|
|
|
sess.And("time>=?", startTime) |
|
|
|
} |
|
|
|
if endTime != "" { |
|
|
|
sess.And("time<=?", endTime) |
|
|
|
} |
|
|
|
if types != "" { |
|
|
|
sess.And("type=?", types) |
|
|
|
} |
|
|
|
if memo != "" { |
|
|
|
sess.And("memo like ?", "%"+memo+"%") |
|
|
|
} |
|
|
|
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) |
|
|
|
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, count, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &m, count, nil |
|
|
|
} |