<%_ if (position === 'import') { _%>
    <%_ if (databaseTypeMongodb) { _%>
import org.springframework.data.mongodb.repository.Query;
    <%_ } _%>
    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    <%_ } _%>
    <%_ if (reactive) { _%>
import org.springframework.data.repository.query.Param;
    <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>

    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
    default Optional<Authority> findFirstByCode(String code) {
        return Optional.ofNullable(this.selectOne(new LambdaQueryWrapper<Authority>().eq(Authority::getCode, code)));
    }
    <%_ } else { _%>
    <%= reactive ? 'Mono' : 'Optional' %><Authority> findFirstByCode(String code);

    @Query("select user.authorities from User user where user.id =:userId")
    <%= reactive ? 'Flux' : 'List'%><Authority> findByUsersId(@Param("userId") <%= databaseTypeSql ? 'Long' : 'String'%> userId);
    <%_ } _%>
<%_ } _%>
