From 776b3375095329207517b1393a11811ca09d0b4f Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 29 Nov 2024 13:43:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/user_real_name_auth_dao.go | 1 + .../user_real_name_auth_implement.go | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/dao/user_real_name_auth_dao.go b/src/dao/user_real_name_auth_dao.go index 1c8c702..6a38d1a 100644 --- a/src/dao/user_real_name_auth_dao.go +++ b/src/dao/user_real_name_auth_dao.go @@ -10,4 +10,5 @@ type UserRealNameAuthDao interface { GetRealNameAuthCount(uid int, cardNo string) (int64, error) GetRealNameAuthByOid(oid string) (*model.UserRealNameAuth, error) GetRealNameAuth(uid int) (*model.UserRealNameAuth, error) + FindRealNameAndTotal(page, limit, uid, name, idNo, state string) (*[]model.UserRealNameAuth, int64, error) } diff --git a/src/implement/user_real_name_auth_implement.go b/src/implement/user_real_name_auth_implement.go index a6d89ca..eb93b3d 100644 --- a/src/implement/user_real_name_auth_implement.go +++ b/src/implement/user_real_name_auth_implement.go @@ -3,6 +3,7 @@ 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" ) @@ -60,3 +61,25 @@ func (u UserRealNameAuthDb) GetRealNameAuth(uid int) (*model.UserRealNameAuth, e } return &m, nil } +func (u UserRealNameAuthDb) FindRealNameAndTotal(page, limit, uid, name, idNo, state string) (*[]model.UserRealNameAuth, int64, error) { + var m []model.UserRealNameAuth + sess := u.Db.Where("1=1") + if uid != "" { + sess.And("uid=?", uid) + } + if name != "" { + sess.And("real_name=?", name) + } + if idNo != "" { + sess.And("card_no=?", idNo) + } + if state != "" { + sess.And("state=?", state) + } + 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 +}