【问题标题】:Using namedQueries with the multi-tenant-single-db plugin将 namedQueries 与 multi-tenant-single-db 插件一起使用
【发布时间】:2012-09-10 07:21:21
【问题描述】:

可以说我有一个域类

class ListItem {
  Long tenantId
}

我想创建一个这样的命名查询

active {
   Long currentTenantId = ?????????;
   or {             
      isNull('tenantId')
      eq ('tenantId', currentTenantId);
  }
}

换句话说,我希望有 ListItem 记录每个人都可以访问的内容,而 listItem 记录只有租户可以访问。

浏览插件的源代码我看不到如何在不添加服务引用的情况下找到当前租户。

这可能吗?

编辑:目的是 currentTentantId 不作为参数传递。可能是我太理想化了。

【问题讨论】:

    标签: grails grails-plugin


    【解决方案1】:

    像这样?

    active { Long currentTenantId ->
       or {             
          isNull 'tenantId'
          eq 'tenantId', currentTenantId
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-22
      • 2020-11-01
      • 2018-08-11
      • 1970-01-01
      相关资源
      最近更新 更多