|
|
@@ -3,7 +3,9 @@ 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" |
|
|
|
"fmt" |
|
|
|
"reflect" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
@@ -124,3 +126,20 @@ func (a AdminDb) FindAdminRolePermissionGroup(admId int) (list []*dao.AdminRoleP |
|
|
|
FindAndCount(&list) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (a AdminDb) AdminFindByParams(params map[string]interface{}) ([]model.Admin, error) { |
|
|
|
var m []model.Admin |
|
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
|
//指定In查询 |
|
|
|
if err := a.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Warn(err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
err := a.Db.Where(query, params["value"]).Find(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |