org.hswebframework.ezorm.core.dsl.Query类的使用及代码示例

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

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

Query介绍

[英]查询条件构造器,用于构造 QueryParam 以及设置执行器进行执行
[中]查询条件构造器,用于构造 QueryParam以及设置执行器进行执行

代码示例

代码示例来源:origin: hs-web/hsweb-framework

@Override
@Cacheable(key = "'define-id:'+#processDefineId+'-'+#activityId")
public ActivityConfigEntity selectByProcessDefineIdAndActivityId(String processDefineId, String activityId) {
  return createQuery()
      .where("processDefineId", processDefineId)
      .and("activityId", activityId)
      .single();
}

代码示例来源:origin: hs-web/hsweb-framework

private List<AuthorizationSettingEntity> getUserSetting(String userId) {
  Map<String, List<SettingInfo>> settingInfo =
      authorizationSettingTypeSuppliers.stream()
          .map(supplier -> supplier.get(userId))
          .flatMap(Set::stream)
          .collect(Collectors.groupingBy(SettingInfo::getType));
  Stream<Map.Entry<String, List<SettingInfo>>> settingInfoStream = settingInfo.entrySet().stream();
  //大于1 使用并行处理
  if (settingInfo.size() > 1) {
    settingInfoStream = settingInfoStream.parallel();
  }
  return settingInfoStream
      .map(entry ->
          createQuery()
              // where type = ? and setting_for in (?,?,?....)
              .where(type, entry.getKey())
              .and()
              .in(settingFor, entry.getValue().stream().map(SettingInfo::getSettingFor).collect(Collectors.toList()))
              .listNoPaging())
      .flatMap(List::stream)
      .collect(Collectors.toList());
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
  @Cacheable(key = "'id-or-md5:'+#idOrMd5", condition = "#idOrMd5!=null")
  public FileInfoEntity selectByIdOrMd5(String idOrMd5) {
    if (null == idOrMd5) {
      return null;
    }
    return createQuery().where(FileInfoEntity.md5, idOrMd5).or(FileInfoEntity.id, idOrMd5).single();
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Cacheable(key = "'all-defaults'")
  public List<DashBoardConfigEntity> selectAllDefaults() {
    return createQuery().where("defaultConfig", true).or().isNull("defaultConfig").listNoPaging();
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
@Cacheable(key = "'all'")
public List<DistrictEntity> select() {
  return createQuery().where().orderByAsc(DistrictEntity.sortIndex).listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

public OAuth2UserTokenEntity selectByAccessToken(String accessToken) {
    Assert.notNull(accessToken, "token can not be null!");
    return createQuery().where(OAuth2UserTokenEntity.accessToken, accessToken)
        .single();
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public List<AuthorizationSettingMenuEntity> selectBySettingId(List<String> settingId) {
  if(CollectionUtils.isEmpty(settingId)){
    return new ArrayList<>();
  }
  return createQuery().where().in(AuthorizationSettingMenuEntity.settingId, settingId).listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
  @Cacheable(key = "'define-key-latest:'+#processDefineKey")
  public ProcessDefineConfigEntity selectByLatestProcessDefineKey(String processDefineKey) {
    return createQuery()
        .where("processDefineKey", Objects.requireNonNull(processDefineKey, "参数[processDefineKey]不能为空"))
        .and("status", DataStatus.STATUS_ENABLED)
        .orderByDesc("updateTime")
        .single();
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public List<AuthorizationSettingMenuEntity> selectBySettingId(String settingId) {
  Objects.requireNonNull(settingId);
  return createQuery().where(AuthorizationSettingMenuEntity.settingId, settingId).listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
@Cacheable(key = "'user:'+#userId+'.'+#key")
public List<UserSettingEntity> selectByUser(String userId, String key) {
  Objects.requireNonNull(userId);
  Objects.requireNonNull(key);
  return createQuery().where("userId", userId).and("key", key).listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public List<Permission> initPermission(String type, String settingFor) {
  AuthorizationSettingEntity entity = select(type, settingFor);
  if (entity == null) {
    return new ArrayList<>();
  }
  List<AuthorizationSettingDetailEntity> detailList = DefaultDSLQueryService
      .createQuery(authorizationSettingDetailDao)
      .where(status, STATE_OK)
      .and().is(settingId, entity.getId())
      .listNoPaging();
  if (CollectionUtils.isEmpty(detailList)) {
    return new ArrayList<>();
  }
  return initPermission(detailList);
}

代码示例来源:origin: hs-web/hsweb-framework

.where()
.in(TreeSupportEntity.id, rootIds)
.listNoPaging();
  .createQuery(dao)
  .each(root, (query, data) -> query.or().like$(TreeSupportEntity.path, data.getPath()))
  .listNoPaging();

代码示例来源:origin: hs-web/hsweb-framework

@Override
  @Transactional(propagation = Propagation.NOT_SUPPORTED)
  @Caching(put = {
      @CachePut(cacheNames = "oauth2-access-token", key = "'refresh:'+#result.refreshToken"),
      @CachePut(cacheNames = "oauth2-access-token", key = "'token:'+#result.accessToken"),
      @CachePut(cacheNames = "oauth2-access-token", key = "'cgo'+#result.clientId+#result.grantType+#result.ownerId")
  })
  public OAuth2AccessToken saveOrUpdateToken(OAuth2AccessToken token) {
    Assert.notNull(token, "token can not be null!");
    int total = DefaultDSLQueryService
        .createQuery(oAuth2AccessDao)
        .where("clientId", token.getClientId())
        .and("grantType", token.getGrantType())
        .and("ownerId", token.getOwnerId()).total();
    token.setUpdateTime(System.currentTimeMillis());
    if (total > 0) {
      DefaultDSLUpdateService
          .createUpdate(oAuth2AccessDao, token)
          .where("clientId", token.getClientId())
          .and("grantType", token.getGrantType())
          .and("ownerId", token.getOwnerId())
          .exec();
    } else {
      token.setCreateTime(System.currentTimeMillis());
      oAuth2AccessDao.insert(((OAuth2AccessEntity) token));
    }

    return token;
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public DepartmentEntity deleteByPk(String id) {
  if (DefaultDSLQueryService.createQuery(positionDao)
      .where(PositionEntity.departmentId, id)
      .total() > 0) {
    throw new BusinessException("部门下存在职位信息,无法删除!");
  }
  publisher.publishEvent(new ClearPersonCacheEvent());
  return super.deleteByPk(id);
}

代码示例来源:origin: hs-web/hsweb-framework

public List<OAuth2UserTokenEntity> selectByServerIdAndGrantType(String serverId, String grantType) {
  Assert.notNull(serverId, "serverId can not be null!");
  Assert.notNull(grantType, "grantType can not be null!");
  return createQuery()
      .where(OAuth2UserTokenEntity.serverId, serverId)
      .is(OAuth2UserTokenEntity.grantType, grantType)
      .listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

(currentType.equals("or") ? conditional.orNest() : conditional.nest()) :
        (currentType.equals("or") ? nest.orNest() : nest.nest()));
    len = 0;
        nest.accept(new String(currentColumn), convertTermType(currentTermType), new String(currentValue));
      } else {
        conditional.accept(new String(currentColumn), convertTermType(currentTermType), new String(currentValue));
          nest.or();
        } else {
          conditional.or();
          nest.and();
        } else {
          conditional.and();
    nest.accept(new String(currentColumn), convertTermType(currentTermType), new String(currentValue));
  } else {
    conditional.accept(new String(currentColumn), convertTermType(currentTermType), new String(currentValue));
return conditional.getParam().getTerms();

代码示例来源:origin: hs-web/hsweb-framework

@Override
public List<RoleEntity> getUserRole(String userId) {
  Assert.hasLength(userId, "参数不能为空");
  List<UserRoleEntity> roleEntities = userRoleDao.selectByUserId(userId);
  if (roleEntities.isEmpty()) {
    return new ArrayList<>();
  }
  List<String> roleIdList = roleEntities.stream().map(UserRoleEntity::getRoleId).collect(Collectors.toList());
  return DefaultDSLQueryService
      .createQuery(roleDao).where()
      .in(GenericEntity.id, roleIdList)
      .noPaging()
      .list();
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
@Transactional(readOnly = true)
public List<E> selectAllChildNode(PK parentId) {
  assertNotNull(parentId);
  E old = selectByPk(parentId);
  if (null == old) {
    return new ArrayList<>();
  }
  return createQuery()
      .where()
      .like$(TreeSupportEntity.path, old.getPath())
      .listNoPaging();
}

代码示例来源:origin: hs-web/hsweb-framework

if (info.matchNullOrEmpty) {
      if (value == null) {
        query.isNull(info.getField());
      } else {
        query.isEmpty(info.getField());
    query.and(info.getField(), termType, value);
T result = query.single();

代码示例来源:origin: hs-web/hsweb-framework

.where(PersonPositionEntity.personId, personId)
    .listNoPaging().stream()
    .map(PersonPositionEntity::getPositionId)
    .collect(Collectors.toSet());
    .where(RelationInfoEntity.relationFrom, personId)
    .or(RelationInfoEntity.relationTo, personId)
    .listNoPaging();
List<Relation> relations = relationInfoList.stream()
    .map(info -> {

相关文章