<%_ if (position === 'import') { _%>
<%_ } _%>
<%_ if (position === 'methodInterface') { _%>

    <%= reactive ? 'Mono' : 'Optional' %><AuthorityDTO> findFirstByCode(String code);

    <%_ if (databaseTypeSql && ormTool !== 'mybatis') { _%>
    <%= reactive ? 'Flux' : 'List' %><AuthorityDTO> findByUserId(<%= databaseTypeSql ? 'Long' : 'String'%> userId);
    <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>

    /**
     * Get one authority by code.
     *
     * @param code the id of the entity.
     * @return the entity.
     */
    <%_ if (databaseTypeSql && ormTool === 'hibernate') { _%>
    @Transactional(readOnly = true)
    <%_ } _%>
    public <%= reactive ? 'Mono' : 'Optional' %><AuthorityDTO> findFirstByCode(String code) {
        log.debug("Request to get Authority : {}", code);
        return authorityRepository.findFirstByCode(code).map(authorityMapper::toDto);
    }

    <%_ if (databaseTypeSql && ormTool !== 'mybatis') { _%>
    <%_ if (databaseTypeSql) { _%>
    @Transactional(readOnly = true)
    <%_ } _%>
    public <%= reactive ? 'Flux' : 'List' %><AuthorityDTO> findByUserId(<%= databaseTypeSql ? 'Long' : 'String'%> userId) {
        <%_ if (reactive) { _%>
        return authorityRepository.findByUsersId(userId).map(authorityMapper::toDto);
        <%_ } else { _%>
        return authorityMapper.toDto(authorityRepository.findByUsersId(userId));
        <%_ } _%>
    }
    <%_ } _%>
<%_ } _%>
