广告平台(媒体使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
884 B

  1. package implement
  2. import (
  3. "applet/app/db/dao"
  4. "applet/app/db/model"
  5. "reflect"
  6. "xorm.io/xorm"
  7. )
  8. func NewRolePermissionGroupDb(engine *xorm.Engine) dao.RolePermissionGroupDao {
  9. return &RolePermissionGroupDb{Db: engine}
  10. }
  11. type RolePermissionGroupDb struct {
  12. Db *xorm.Engine
  13. }
  14. func (r RolePermissionGroupDb) RolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) {
  15. if reflect.TypeOf(roleId).Kind() == reflect.Slice {
  16. return session.In("role_id", roleId).Delete(model.RolePermissionGroup{})
  17. } else {
  18. return session.Where("role_id = ?", roleId).Delete(model.RolePermissionGroup{})
  19. }
  20. }
  21. func (r RolePermissionGroupDb) BatchAddRolePermissionGroupBySession(session *xorm.Session, mm []*model.RolePermissionGroup) (int64, error) {
  22. affected, err := session.Insert(mm)
  23. if err != nil {
  24. return 0, err
  25. }
  26. return affected, nil
  27. }