leap.orm.query.Query.list()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中leap.orm.query.Query.list方法的一些代码示例,展示了Query.list的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.list方法的具体详情如下:
包路径:leap.orm.query.Query
类名称:Query
方法名:list

Query.list介绍

[英]Executes this query and return all the rows as a immutable List object.

Returns a empty immutable List if no result returned.
[中]执行此查询并将所有行作为不可变列表对象返回。
如果没有返回结果,则返回空的不可变列表。

代码示例

代码示例来源:origin: org.leapframework/jmms-core

public List<Record> queryList(String sql, Map<String, Object> params) {
  return createQuery(sql, params).list();
}

代码示例来源:origin: org.leapframework/leap-oauth2-server

@Override
public List<AuthzSSOLogin> loadLoginsInSession(AuthzSSOSession session) {
  List<AuthzSSOLoginEntity> entities = null;
  if(null != loadLoginsInSessionCommand) {
    entities = dao.createQuery(AuthzSSOLoginEntity.class, loadLoginsInSessionCommand).list();
  }else{
    entities = dao.createCriteriaQuery(AuthzSSOLoginEntity.class).where("session_id = ?", session.getId()).list();
  }
  List<AuthzSSOLogin> logins = new ArrayList<>();
  for(AuthzSSOLoginEntity entity : entities) {
    logins.add(createLoginFromEntity(entity));
  }
  return logins;
}

代码示例来源:origin: org.leapframework/leap-oauth2

@Override
public List<AuthzSSOLogin> loadLoginsInSession(AuthzSSOSession session) {
  List<AuthzSSOLoginEntity> entities = null;
  if(null != loadLoginsInSessionCommand) {
    entities = dao.createQuery(AuthzSSOLoginEntity.class, loadLoginsInSessionCommand).list();
  }else{
    entities = dao.createCriteriaQuery(AuthzSSOLoginEntity.class).where("session_id = ?", session.getId()).list();
  }
  List<AuthzSSOLogin> logins = new ArrayList<>();
  for(AuthzSSOLoginEntity entity : entities) {
    logins.add(createLoginFromEntity(entity));
  }
  return logins;
}

代码示例来源:origin: org.leapframework/leap-webapi

@Override
public Object apply(ActionParams params) {
  Map<String,Object> map = params.toMap();
  Object result;
  if(command.getMetadata().isSelect()) {
    //todo: page query, total count
    Query query = dao.createQuery(command).params(map);
    if(null != returnType) {
      if(returnType.isSimpleType()) {
        result = Converts.convert(query.scalarValueOrNull(), returnType.asSimpleType().getJavaType());
      }else if(returnType.isCollectionType() && returnType.asCollectionType().getElementType().isSimpleType()) {
        result = query.scalars().list(returnType.asCollectionType().getElementType().asSimpleType().getJavaType());
      }else {
        result = query.list();
      }
    }else {
      result = query.list();
    }
  }else{
    //todo: the return type must be simple type
    result = dao.executeUpdate(command, map);
    if(null != returnType) {
      result = Converts.convert(result, returnType.asSimpleType().getJavaType());
    }
  }
  return ApiResponse.of(result);
}

相关文章