<%_ if (position === 'import') { _%>
    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
import org.apache.ibatis.annotations.Select;
    <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>
    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>

    @Select("select self.* from view_permission self left join rel_jhi_authority__view_permissions avp on self.id = avp.view_permissions_id " +
        "left join rel_jhi_user__authorities jua on jua.authorities_id = avp.jhi_authority_id " +
        "where jua.jhi_user_id = #{userId}")
    List<ViewPermission> findAllViewPermissionsByUserId(@Param("userId") Long userId);
    <%_ } else { _%>

    @Query("select authority.viewPermissions from User u join u.authorities authority where u.login = ?#{principal.username}")
    <%= reactive ? 'Flux' : 'List' %><ViewPermission> findAllViewPermissionsByCurrentUser();
    <%_ } _%>
<%_ } _%>
