<%_ if (position === 'import') { _%>
    <%_ if (userIdTypeName === 'UUID') { _%>
import java.util.UUID;
    <%_ } _%>
    <%_ 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") <%= userIdTypeName %> userId);
    <%_ } else { _%>

    @Query("select vp from ViewPermission vp join vp.authorities authority join authority.users user where user.login = :username")
    <%= reactive ? 'Flux' : 'List' %><ViewPermission> findAllViewPermissionsByCurrentUser(@Param("username") String username);
    <%_ } _%>
<%_ } _%>
