@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof OrgAuthorizationScope)) { return false; } OrgAuthorizationScope that = (OrgAuthorizationScope) o; return Objects.equals(getOrganization(), that.getOrganization()); }
/** * 根据代表指定机构的机构授权范围。如果不存在则创建一个 * * @param organization 机构 * @return 代表该机构的机构授权范围 */ public static OrgAuthorizationScope of(Organization organization) { OrgAuthorizationScope scope = createCriteriaQuery(OrgAuthorizationScope.class) .eq("organization", organization) .isFalse("disabled") .singleResult(); if (scope == null) { scope = new OrgAuthorizationScope(organization); scope.save(); } return scope; }