diff --git a/src/dao/admin_dao.go b/src/dao/admin_dao.go index d3abd8f..1f3ebd5 100644 --- a/src/dao/admin_dao.go +++ b/src/dao/admin_dao.go @@ -16,6 +16,7 @@ type AdminDao interface { UpdateAdmin(m *model.Admin, columns ...string) (int64, error) AdminInsert(m *model.Admin) (int64, error) FindAdminRolePermissionGroup(admId int) (list []*AdminRolePermissionGroup, total int64, err error) + AdminFindByParams(params map[string]interface{}) ([]model.Admin, error) } type AdminRolePermissionGroup struct { diff --git a/src/dao/egg_friend_circle_user_black_list_dao.go b/src/dao/egg_friend_circle_user_black_list_dao.go index d055e11..8286f20 100644 --- a/src/dao/egg_friend_circle_user_black_list_dao.go +++ b/src/dao/egg_friend_circle_user_black_list_dao.go @@ -1,5 +1,9 @@ package dao +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + type EggFriendCircleUserBlackListDao interface { //TODO:: You can add specific method definitions here + EggFriendCircleUserBlackListInsert(m *model.EggFriendCircleUserBlackList) (int, error) + EggFriendCircleUserBlackListDeleteById(id int) (int64, error) } diff --git a/src/implement/admin_implement.go b/src/implement/admin_implement.go index fcbae86..0375a7e 100644 --- a/src/implement/admin_implement.go +++ b/src/implement/admin_implement.go @@ -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 +} diff --git a/src/implement/egg_friend_circle_user_black_list_implement.go b/src/implement/egg_friend_circle_user_black_list_implement.go index 5e90d1d..35b2007 100644 --- a/src/implement/egg_friend_circle_user_black_list_implement.go +++ b/src/implement/egg_friend_circle_user_black_list_implement.go @@ -2,6 +2,8 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" "xorm.io/xorm" ) @@ -12,3 +14,18 @@ func NewEggFriendCircleUserBlackListDb(engine *xorm.Engine) dao.EggFriendCircleU type EggFriendCircleUserBlackListDb struct { Db *xorm.Engine } + +func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListInsert(m *model.EggFriendCircleUserBlackList) (int, error) { + _, err := e.Db.InsertOne(m) + if err != nil { + return 0, zhios_order_relate_logx.Error(err.Error()) + } + return m.Id, nil +} +func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListDeleteById(id int) (int64, error) { + affected, err := e.Db.Where("id = ? ", id).Delete(model.EggFriendCircleUserBlackList{}) + if err != nil { + return 0, zhios_order_relate_logx.Error(err.Error()) + } + return affected, nil +} diff --git a/src/model/egg_friend_circle_user_black_list.go b/src/model/egg_friend_circle_user_black_list.go index 2d50660..bad0269 100644 --- a/src/model/egg_friend_circle_user_black_list.go +++ b/src/model/egg_friend_circle_user_black_list.go @@ -2,8 +2,9 @@ package model type EggFriendCircleUserBlackList struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - Uid int64 `json:"uid" xorm:"not null default 1 BIGINT(20)"` - AdmId int `json:"adm_id" xorm:"not null default 1 INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 1 comment('用户id') BIGINT(20)"` + AdmId int `json:"adm_id" xorm:"not null default 1 comment('管理员id') INT(11)"` + Memo string `json:"memo" xorm:"not null comment('备注') TEXT"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` }