当前位置: 首页>>代码示例>>Java>>正文


Java NumberExpression类代码示例

本文整理汇总了Java中com.querydsl.core.types.dsl.NumberExpression的典型用法代码示例。如果您正苦于以下问题:Java NumberExpression类的具体用法?Java NumberExpression怎么用?Java NumberExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NumberExpression类属于com.querydsl.core.types.dsl包,在下文中一共展示了NumberExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Override
public Expression<?> visit(Add node) {
    List<de.fraunhofer.iosb.ilt.sta.query.expression.Expression> params = node.getParameters();
    Expression<?> p1 = params.get(0).accept(this);
    Expression<?> p2 = params.get(1).accept(this);
    if (p1 instanceof TimeExpression) {
        TimeExpression ti1 = (TimeExpression) p1;
        return ti1.add(p2);
    }
    if (p2 instanceof TimeExpression) {
        TimeExpression ti2 = (TimeExpression) p2;
        return ti2.add(p1);
    }
    NumberExpression n1 = getSingleOfType(NumberExpression.class, p1);
    NumberExpression n2 = getSingleOfType(NumberExpression.class, p2);
    return n1.add(n2);
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:18,代码来源:PgExpressionHandler.java

示例2: fetchChanged

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
private List<HuntingClubAreaChangedExcelView.ExcelRow> fetchChanged(final @Nonnull GISZone zoneEntity) {
    final SQZonePalsta zonePalsta = new SQZonePalsta("zp");
    final SQPalstaalue pa1 = new SQPalstaalue("pa1"); // Current
    final SQPalstaalue pa2 = new SQPalstaalue("pa2"); // New

    final NumberPath<Integer> pathPalstaId = zonePalsta.palstaId;
    final NumberPath<Integer> pathPalstaIdNew = zonePalsta.newPalstaId;

    final NumberPath<Long> pathPalstaTunnus = zonePalsta.palstaTunnus;
    final NumberPath<Long> pathPalstaTunnusNew = zonePalsta.newPalstaTunnus;

    final NumberPath<Double> pathAreaDiff = zonePalsta.diffArea;
    final NumberExpression<Double> pathAreaSize = zonePalsta.geom.asMultiPolygon().area();

    return sqlQueryFactory
            .from(zonePalsta)
            .leftJoin(pa1).on(pa1.id.eq(pathPalstaId))
            .leftJoin(pa2).on(pa2.id.eq(pathPalstaIdNew))
            .where(zonePalsta.zoneId.eq(zoneEntity.getId())
                    .and(zonePalsta.isChanged.isTrue()))
            .select(Projections.constructor(HuntingClubAreaChangedExcelView.ExcelRow.class,
                    pathPalstaTunnus, pathPalstaTunnusNew,
                    pathAreaSize, pathAreaDiff))
            .orderBy(pathPalstaTunnus.asc(), pathPalstaId.asc())
            .fetch();
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:27,代码来源:HuntingClubAreaExcelFeature.java

示例3: findAmendmentAmountsByOriginalPermitId

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
private Map<Long, Float> findAmendmentAmountsByOriginalPermitId(final List<HarvestPermit> originalPermits,
                                                                final int speciesCode,
                                                                final int huntingYear) {

    final QHarvestPermitSpeciesAmount speciesAmount = QHarvestPermitSpeciesAmount.harvestPermitSpeciesAmount;
    final QGameSpecies species = QGameSpecies.gameSpecies;
    final QHarvestPermit amendmentPermit = new QHarvestPermit("amendmentPermit");

    final NumberPath<Long> originalPermitId = amendmentPermit.originalPermit.id;
    final NumberExpression<Float> sumOfAmendmentPermitAmounts = speciesAmount.amount.sum();

    return jpqlQueryFactory.select(originalPermitId, sumOfAmendmentPermitAmounts)
            .from(speciesAmount)
            .join(speciesAmount.gameSpecies, species)
            .join(speciesAmount.harvestPermit, amendmentPermit)
            .where(amendmentPermit.originalPermit.in(originalPermits),
                    species.officialCode.eq(speciesCode),
                    speciesAmount.validOnHuntingYear(huntingYear))
            .groupBy(originalPermitId)
            .transform(groupBy(originalPermitId).as(sumOfAmendmentPermitAmounts));
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:22,代码来源:MoosePermitStatisticsService.java

示例4: countClubHarvestAmountGroupByGameSpeciesId

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
/**
 * Filter criteria includes:
 * - If harvest is linked to groups hunting day, it is included always
 * Otherwise:
 * - Person must have occupation in given club
 * - Occupation must be valid on the day of harvest
 * - If harvest.harvest_report_required=true then harvest must have accepted harvest report
 * - Harvest species must not be any the given mooselikes (those are included by hunting days)
 * - Harvest location must intersect with active area for club
 */
@Override
@Transactional(readOnly = true)
public Map<Long, Integer> countClubHarvestAmountGroupByGameSpeciesId(final HuntingClub huntingClub,
                                                                     final int huntingYear,
                                                                     final Interval interval,
                                                                     final Set<Integer> mooselike) {
    final SQHarvest harvest = SQHarvest.harvest;
    final BooleanExpression predicate1 = harvest.groupHuntingDayId.isNull()
            .and(harvest.harvestId.in(harvestOfClubMemberInsideClubHuntingArea(
                    huntingClub.getId(), interval, huntingYear, mooselike)));

    final BooleanExpression predicate2 = harvest.groupHuntingDayId.isNotNull()
            .and(harvest.groupHuntingDayId.in(harvestLinkedToClubHuntingDay(huntingClub.getId(), huntingYear)));

    final NumberPath<Long> keyPath = harvest.gameSpeciesId;
    final NumberExpression<Integer> valuePath = harvest.amount.sum();

    return sqlQueryFactory.from(harvest)
            .select(keyPath, valuePath)
            .where(predicate1.or(predicate2))
            .groupBy(keyPath)
            .transform(GroupBy.groupBy(keyPath).as(valuePath));
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:34,代码来源:HarvestRepositoryImpl.java

示例5: applyGlobalSearch

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
/**
 * Adds a global contains text filter on the provided attributes.
 * WARNING: this creates a very inefficient query. If you have many entity
 * instances to query, use instead an indexed text search solution for better
 * performance.
 * @param text the text to look for
 * @param query
 * @param globalSearchAttributes the list of attributes to perform the
 *        filter on
 * @return the updated query
 */
protected JPQLQuery<T> applyGlobalSearch(String text, JPQLQuery<T> query,
    Path<?>... globalSearchAttributes) {
  if (text != null && !StringUtils.isEmpty(text) && globalSearchAttributes.length > 0) {
    BooleanBuilder searchCondition = new BooleanBuilder();
    for (int i = 0; i < globalSearchAttributes.length; i++) {
      Path<?> path = globalSearchAttributes[i];
      if (path instanceof StringPath) {
        StringPath stringPath = (StringPath) path;
        searchCondition.or(stringPath.containsIgnoreCase(text));
      } else if (path instanceof NumberExpression) {
        searchCondition.or(((NumberExpression<?>) path).like("%".concat(text).concat("%")));
      }
    }
    return query.where(searchCondition);
  }
  return query;
}
 
开发者ID:DISID,项目名称:springlets,代码行数:29,代码来源:QueryDslRepositorySupportExt.java

示例6: getOtherType

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
/**
 * The (json) type of the other expression.
 *
 * @param e
 * @return
 */
private CompareType getOtherType(Expression<?> e) {
    if (e instanceof NumberExpression) {
        return CompareType.NUMBER;
    }
    if (e instanceof BooleanExpression) {
        return CompareType.BOOLEAN;
    }
    return CompareType.STRING;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:16,代码来源:JsonExpressionFactory.java

示例7: resolvePublicHolidayYears

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
private List<Integer> resolvePublicHolidayYears(final long schemeId) {
  return querydslSupport.execute((connection, configuration) -> {
    QPublicHoliday qPublicHoliday = QPublicHoliday.publicHoliday;
    NumberExpression<Integer> yearExpression =
        qPublicHoliday.date.year().as("public_holiday_year");
    return new SQLQuery<Integer>(connection, configuration)
        .select(yearExpression)
        .from(qPublicHoliday)
        .groupBy(yearExpression)
        .orderBy(yearExpression.asc())
        .where(qPublicHoliday.holidaySchemeId.eq(schemeId))
        .fetch();
  });
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:15,代码来源:HolidaySchemesServlet.java

示例8: weekdaySumForReplacementDay

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
private static Expression<Long> weekdaySumForReplacementDay(final NumberPath<Long> workSchemeId,
    final NumberExpression<Integer> dayOfWeek) {
  QWeekdayWork qWeekdayWork = new QWeekdayWork("exp_work_repl_wdw");
  SQLQuery<Long> query = new SQLQuery<>();
  query.select(qWeekdayWork.duration.sum())
      .from(qWeekdayWork)
      .where(qWeekdayWork.workSchemeId.eq(workSchemeId)
          .and(
              Expressions.path(Integer.class, qWeekdayWork.weekday.getMetadata()).eq(dayOfWeek)));
  return query;
}
 
开发者ID:everit-org,项目名称:jira-hr-admin,代码行数:12,代码来源:QueryUtil.java

示例9: customize

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Override
    default public void customize(QuerydslBindings bindings, QCustomer cust) {

//        bindings.bind(cust.firstName).first(StringExpression::containsIgnoreCase);

        bindings
                .bind(String.class)
                .first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase);

        bindings
                .bind(Long.class)
                .first((SingleValueBinding<NumberPath<Long>, Long>) NumberExpression::goe);

//        bindings.excluding(cust.lastName);
    }
 
开发者ID:Nandtel,项目名称:spring-data-jpa-querydsl-gradle-starter,代码行数:16,代码来源:CustomerRepository.java

示例10: countIf

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
public static <T> NumberExpression<Integer> countIf(BooleanExpression condition) {
	/**
	 * We use Expressions.* rather than constants, in order to avoid introducing request parameters.
	 * Otherwise, Hibernate would freak out because it can't guess the CASE expression data type
	 * (which seems legitimate).
	 */
	return new CaseBuilder().when(condition).then(Expressions.ONE).otherwise(Expressions.ZERO).sum();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:9,代码来源:Expressions2.java

示例11: sumIf

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
public static <T> NumberExpression<Integer> sumIf(NumberExpression<Integer> expression, BooleanExpression condition) {
	if (condition == null) {
		return expression.sum();
	} else {
		/**
		 * We use Expressions.* rather than constants, in order to avoid introducing request parameters.
		 * Otherwise, Hibernate would freak out because it can't guess the CASE expression data type
		 * (which seems legitimate).
		 */
		return new CaseBuilder().when(condition).then(expression).otherwise(Expressions.ZERO).sum();
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:13,代码来源:Expressions2.java

示例12: testAppendGoeTwoArguments

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Test
public void testAppendGoeTwoArguments() {
    SingleIntegerArgument argument = SingleIntegerArgument.of(200);
    BooleanBuilder builder = new BooleanBuilder();
    argument.append(builder, NumberExpression::goe, QPerson.person.oneInteger, QPerson.person.anotherInteger);
    Person result = new JPAQuery<Void>(entityManager).select(QPerson.person).from(QPerson.person).where(builder).fetchOne();
    assertThat(result.getAnotherInteger()).isEqualTo(321);
}
 
开发者ID:yanaga,项目名称:querydsl-args,代码行数:9,代码来源:SingleIntegerArgumentTest.java

示例13: testAppendGoeTwoArgumentsWithNoResult

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Test
public void testAppendGoeTwoArgumentsWithNoResult() {
    SingleIntegerArgument argument = SingleIntegerArgument.of(400);
    BooleanBuilder builder = new BooleanBuilder();
    argument.append(builder, NumberExpression::goe, QPerson.person.oneInteger, QPerson.person.anotherInteger);
    Person result = new JPAQuery<Void>(entityManager).select(QPerson.person).from(QPerson.person).where(builder).fetchOne();
    assertThat(result).isNull();
}
 
开发者ID:yanaga,项目名称:querydsl-args,代码行数:9,代码来源:SingleIntegerArgumentTest.java

示例14: testAppendLoeCustomNumberTypeAndInteger

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Test
public void testAppendLoeCustomNumberTypeAndInteger() {
    SingleIntegerArgument argument = SingleIntegerArgument.of(250);
    BooleanBuilder builder = new BooleanBuilder();
    argument.append(builder, NumberExpression::loe, QPerson.person.oneCustomNumberType.intValue(), QPerson.person.anotherInteger);
    Person result = new JPAQuery<Void>(entityManager).select(QPerson.person).from(QPerson.person).where(builder).fetchOne();
    Assertions.assertThat(result.getOneCustomNumberType()).isEqualTo(CustomNumberType.of(new BigDecimal("222")));
}
 
开发者ID:yanaga,项目名称:querydsl-args,代码行数:9,代码来源:SingleIntegerArgumentTest.java

示例15: testAppendGoeTwoArguments

import com.querydsl.core.types.dsl.NumberExpression; //导入依赖的package包/类
@Test
public void testAppendGoeTwoArguments() {
    SingleBigDecimalArgument argument = SingleBigDecimalArgument.of(new BigDecimal("200"));
    BooleanBuilder builder = new BooleanBuilder();
    argument.append(builder, NumberExpression::goe, QPerson.person.oneBigDecimal, QPerson.person.anotherBigDecimal);
    Person result = new JPAQuery<Void>(entityManager).select(QPerson.person).from(QPerson.person).where(builder).fetchOne();
    assertThat(result.getAnotherBigDecimal()).isEqualTo(new BigDecimal("321"));
}
 
开发者ID:yanaga,项目名称:querydsl-args,代码行数:9,代码来源:SingleBigDecimalArgumentTest.java


注:本文中的com.querydsl.core.types.dsl.NumberExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。