• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SQLExpressions类的典型用法和代码示例

java 2次浏览

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

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

示例1: moderatedGroups

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private SQLQuery<Long> moderatedGroups(final Collection<Long> includedGameSpeciesIds, final int huntingYear) {
    final SQBasicClubHuntingSummary bchs = new SQBasicClubHuntingSummary("bchs");
    final SQHarvestPermitSpeciesAmount hpsa = new SQHarvestPermitSpeciesAmount("hpsa");
    final SQOrganisation group = new SQOrganisation("group");

    return SQLExpressions
            .select(group.organisationId)
            .from(bchs)
            .join(hpsa).on(hpsa.harvestPermitSpeciesAmountId.eq(bchs.speciesAmountId))
            .join(group).on(
                    group.parentOrganisationId.eq(bchs.clubId),
                    group.organisationType.eq(Expressions.asString(OrganisationType.CLUBGROUP.name())),
                    group.gameSpeciesId.eq(hpsa.gameSpeciesId),
                    group.harvestPermitId.eq(hpsa.harvestPermitId))
            .where(hpsa.gameSpeciesId.in(includedGameSpeciesIds),
                    bchs.moderatorOverride.isTrue(),
                    bchs.huntingFinished.isTrue(),
                    sqlDateInsideHuntingYear(bchs.huntingEndDate, huntingYear),
                    group.huntingYear.eq(huntingYear));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:21,
代码来源:AdminMooselikeHuntingMetricsService.java

示例2: findGroupHarvest

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
/**
 * Filter criteria includes:
 * 1) Person must have occupation in ClubGroup
 * 2) Person must have occupation in Club (to ignore invitations)
 * 2) Harvest location must intersect with defined area for ClubGroup
 * OR harvest must be linked to GroupHuntingDay
 * 3) OR Harvest is rejected by the group
 */
@Override
@Transactional(readOnly = true)
public List<Harvest> findGroupHarvest(final HuntingClubGroup huntingClubGroup, final Interval interval) {

    final SQHarvest harvest = new SQHarvest("harvest");
    final QHarvest harvestEntity = new QHarvest("harvest");
    final SQGroupHarvestRejection rejection = groupHarvestRejection;

    final SubQueryExpression<Long> subQuery1 =
            harvestForGroupMemberInsideGroupHuntingArea(huntingClubGroup.getId(), interval);

    final SubQueryExpression<Long> subQuery2 =
            harvestLinkedToGroupHuntingDay(huntingClubGroup.getId());

    final BooleanExpression rejected = SQLExpressions.selectOne().from(rejection)
            .where(rejection.huntingClubGroupId.eq(huntingClubGroup.getId())
                    .and(rejection.harvestId.eq(harvest.harvestId)))
            .exists();

    return new JPASQLQuery<Harvest>(entityManager, sqlTemplates)
            .from(harvest).select(harvestEntity)
            .where(harvest.harvestId.in(union(asList(subQuery1, subQuery2))).or(rejected))
            .orderBy(harvest.pointOfTime.desc(), harvest.harvestId.desc())
            .fetch();
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:34,
代码来源:HarvestRepositoryImpl.java

示例3: harvestLinkedToGroupHuntingDay

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> harvestLinkedToGroupHuntingDay(final long huntingGroupId) {
    /*
    SELECT h3.harvest_id
    FROM harvest h3
    WHERE h3.group_hunting_day_id IN (
      SELECT group_hunting_day_id
      FROM group_hunting_day
      WHERE hunting_group_id = :huntingGroupId)
    */
    final SQHarvest harvest = new SQHarvest("h3");
    final SQGroupHuntingDay groupHuntingDay = SQGroupHuntingDay.groupHuntingDay;

    final SQLQuery<Long> groupHuntingDayIds = SQLExpressions.selectOne()
            .from(groupHuntingDay)
            .where(groupHuntingDay.huntingGroupId.eq(huntingGroupId))
            .select(groupHuntingDay.groupHuntingDayId);

    return SQLExpressions.select(harvest.harvestId)
            .from(harvest)
            .where(harvest.groupHuntingDayId.in(groupHuntingDayIds));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:22,
代码来源:HarvestRepositoryImpl.java

示例4: findHarvestsLinkedToHuntingDayIntersectingRiistanhoitoyhdistysGeometry

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> findHarvestsLinkedToHuntingDayIntersectingRiistanhoitoyhdistysGeometry(
        final String rhyOfficialCode,
        final GameSpecies species,
        final Interval interval) {

    final SQHarvest h2 = new SQHarvest("h2");
    final SQRhy rhy = SQRhy.rhy;

    final BooleanExpression predicate = rhy.id.eq(rhyOfficialCode)
            .and(h2.groupHuntingDayId.isNotNull())
            .and(h2.pointOfTime.between(
                    new Timestamp(interval.getStart().getMillis()),
                    new Timestamp(interval.getEnd().getMillis())))
            .and(h2.gameSpeciesId.eq(species.getId()));

    return SQLExpressions.select(h2.harvestId)
            .from(rhy)
            .join(h2).on(rhy.geom.intersects(getHarvestPointGeometry(h2).transform(GISUtils.SRID.ETRS_TM35.value)))
            .where(predicate);
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:21,
代码来源:HarvestRepositoryImpl.java

示例5: gameObservationLinkedToGroupHuntingDay

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> gameObservationLinkedToGroupHuntingDay(
        final HuntingClubGroup huntingClubGroup) {
    /*
    SELECT o3.game_observation_id
    FROM game_observation o3
    WHERE o3.group_hunting_day_id IN (
      SELECT group_hunting_day_id
      FROM group_hunting_day
      WHERE hunting_group_id = :huntingGroupId)
    */
    final SQObservation gameObservation = new SQObservation("o3");
    final SQGroupHuntingDay groupHuntingDay = SQGroupHuntingDay.groupHuntingDay;

    final SQLQuery<Long> groupHuntingDayIds = SQLExpressions.selectOne()
            .from(groupHuntingDay)
            .where(groupHuntingDay.huntingGroupId.eq(huntingClubGroup.getId()))
            .select(groupHuntingDay.groupHuntingDayId);

    return SQLExpressions.select(gameObservation.gameObservationId)
            .from(gameObservation)
            .where(gameObservation.groupHuntingDayId.in(groupHuntingDayIds));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:23,
代码来源:ObservationRepositoryImpl.java

示例6: buildWhere

点赞 3

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private void buildWhere(HubSearch search, PostgreSQLQuery qry) {
    if (search.getGeometry() != null) {
        if (search.getMaxDistance() != null && search.getMaxDistance() > 0) {
            qry.where(dwithin(qHub.location, ConstantImpl.create(search.getGeometry()), search.getMaxDistance()));
        } else {
            qry.where(qHub.location.intersects(search.getGeometry()));
        }
    }
    if (search.getIds() != null && !search.getIds().isEmpty()) {
        qry.where(qHub.id.in(search.getIds()));
    }
    if (search.getFacilityIds() != null && !search.getFacilityIds().isEmpty()) {
        final SQLQuery<Long> hasFacilityId = SQLExpressions.select(qHubFacility.facilityId)
                .from(qHubFacility)
                .where(qHubFacility.hubId.eq(qHub.id), qHubFacility.facilityId.in(search.getFacilityIds()));
        qry.where(hasFacilityId.exists());
    }
}
 

开发者ID:HSLdevcom,
项目名称:parkandrideAPI,
代码行数:19,
代码来源:HubDao.java

示例7: visit

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
@Override
public Expression<?> visit(Date node) {
    de.fraunhofer.iosb.ilt.sta.query.expression.Expression param = node.getParameters().get(0);
    Expression<?> input = param.accept(this);
    DateTimeExpression inExp = getSingleOfType(DateTimeExpression.class, input);
    DateExpression date = SQLExpressions.date(inExp);
    return date;
}
 

开发者ID:FraunhoferIOSB,
项目名称:SensorThingsServer,
代码行数:9,
代码来源:PgExpressionHandler.java

示例8: huntingDaysOfModeratedGroups

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private SQLQuery<Long> huntingDaysOfModeratedGroups(final Collection<Long> includedGameSpeciesIds,
                                                    final int huntingYear) {
    final SQGroupHuntingDay groupHuntingDay = SQGroupHuntingDay.groupHuntingDay;

    return SQLExpressions
            .select(groupHuntingDay.groupHuntingDayId)
            .from(groupHuntingDay)
            .where(groupHuntingDay.huntingGroupId.in(moderatedGroups(includedGameSpeciesIds, huntingYear)));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:10,
代码来源:AdminMooselikeHuntingMetricsService.java

示例9: findAllPermitPartners

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private List<Long> findAllPermitPartners() {
    final SQHarvestPermit harvestPermit = new SQHarvestPermit("hp");
    final SQHarvestPermitPartners harvestPermitPartners = new SQHarvestPermitPartners("hpp");

    final SQLQuery<Long> mooseLikeHarvestPermitIds = SQLExpressions.select(harvestPermit.harvestPermitId)
            .from(harvestPermit)
            .where(harvestPermit.permitTypeCode.eq(HarvestPermit.MOOSELIKE_PERMIT_TYPE));

    return sqlQueryFactory.from(harvestPermitPartners)
            .where(harvestPermitPartners.harvestPermitId.in(mooseLikeHarvestPermitIds))
            .select(harvestPermitPartners.organisationId)
            .fetch();
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:14,
代码来源:HuntingClubStatisticsFeature.java

示例10: harvestLinkedToClubHuntingDay

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SQLQuery<Long> harvestLinkedToClubHuntingDay(final long huntingClubId,
                                                            final int huntingYear) {
    final SQGroupHuntingDay groupHuntingDay = SQGroupHuntingDay.groupHuntingDay;
    final SQOrganisation group = new SQOrganisation("group");

    return SQLExpressions
            .select(groupHuntingDay.groupHuntingDayId)
            .from(groupHuntingDay)
            .join(group).on(group.parentOrganisationId.eq(huntingClubId)
                    .and(groupHuntingDay.huntingGroupId.eq(group.organisationId)))
            .where(group.huntingYear.eq(huntingYear));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:13,
代码来源:HarvestRepositoryImpl.java

示例11: createMissingActivity

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
void createMissingActivity(PersistenceManager pm) {
  try (JDOQuery<ApiUser> userQuery =
      new JDOQuery<PlayerActivity>(pm)
          .select(apiUser)
          .from(apiUser)
          .where(
              apiUser.gameMode.eq(GameModes.OSU),
              SQLExpressions.select(playerActivity).from(playerActivity)
                  .where(playerActivity.user.eq(apiUser)).exists().not())) {
    List<ApiUser> newUsers = userQuery.fetch();
    newUsers.stream().map(user -> new PlayerActivity(user, 0L, 0L)).forEach(pm::makePersistent);
  }
}
 

开发者ID:OsuCelebrity,
项目名称:OsuCelebrity,
代码行数:14,
代码来源:OsuActivityUpdater.java

示例12: documentOptionsBuilder

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private Builder<String, String, JDocumentVersion<String>> documentOptionsBuilder(Transactions transactions) {
    QDocumentVersion sinceVersion = new QDocumentVersion("SINCE");
    return new Builder<String, String, JDocumentVersion<String>>()
            .defaultsFor("DOCUMENT")
            .versionTable(new JDocumentVersion<>(documentVersion, documentVersion.docId))
            .versionTableSince(new JDocumentVersion<>(sinceVersion, sinceVersion.docId))
            .nextOrdinal(SQLExpressions.nextval("DOCUMENT_VERSION_ORDINAL_SEQ"))
            .transactions(transactions)
            .optimizerType(NONE)
            .publisherType(NONE);
}
 

开发者ID:ssaarela,
项目名称:javersion,
代码行数:12,
代码来源:PersistenceTestConfiguration.java

示例13: harvestForGroupMemberInsideGroupHuntingArea

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> harvestForGroupMemberInsideGroupHuntingArea(final long huntingGroupId,
                                                                                    final Interval interval) {
    /*
    SELECT h2.harvest_id
    FROM occupation groupOcc
    INNER JOIN organisation g ON (g.organisation_id = groupOcc.organisation_id AND g.organisation_type = 'CLUBGROUP')
    INNER JOIN occupation clubOcc ON (clubOcc.deletion_time IS NULL
      AND clubOcc.person_id = groupOcc.person_id AND clubOcc.organisation_id = g.parent_organisation_id)
    INNER JOIN hunting_club_area a ON (a.hunting_club_area_id = g.hunting_area_id)
    INNER JOIN zone z ON (z.zone_id = a.zone_id)
    INNER JOIN person p ON (p.person_id = groupOcc.person_id)
    INNER JOIN harvest h2 ON p.person_id IN (h2.author_id, h2.actual_shooter_id)
    WHERE groupOcc.organisation_id = :huntingGroupId
    AND groupOcc.deletion_time IS NULL
    AND h2.point_of_time BETWEEN COALESCE(groupOcc.begin_date, h2.point_of_time) AND COALESCE(groupOcc.end_date, h2.point_of_time)
    AND h2.point_of_time BETWEEN COALESCE(clubOcc.begin_date, h2.point_of_time) AND COALESCE(clubOcc.end_date, h2.point_of_time)
    AND h2.group_hunting_day_id IS NULL
    AND h2.game_species_id = g.game_species_id
    AND h2.point_of_time >= :beginTime AND h2.point_of_time < :endTime
    AND ST_Intersects(z.geom, ST_SetSRID(ST_MakePoint(h2.longitude, h2.latitude), 3067))
    */
    final SQHarvest harvest = new SQHarvest("h2");
    final SQOrganisation group = new SQOrganisation("g");
    final SQOccupation groupOccupation = new SQOccupation("groupOcc");
    final SQOccupation clubOccupation = new SQOccupation("clubOcc");
    final SQHuntingClubArea huntingClubArea = new SQHuntingClubArea("a");
    final SQZone zone = new SQZone("z");
    final SQPerson person = new SQPerson("p");

    final DateExpression<java.sql.Date> harvestDate = SQLExpressions.date(java.sql.Date.class, harvest.pointOfTime);

    return SQLExpressions.select(harvest.harvestId)
            .from(groupOccupation)
            .join(group).on(group.organisationId.eq(groupOccupation.organisationId)
                    .and(group.organisationType.eq(OrganisationType.CLUBGROUP.name())))
            .join(clubOccupation).on(clubOccupation.deletionTime.isNull()
                    .and(clubOccupation.personId.eq(groupOccupation.personId))
                    .and(clubOccupation.organisationId.eq(group.parentOrganisationId)))
            .join(huntingClubArea).on(huntingClubArea.huntingClubAreaId.eq(group.huntingAreaId))
            .join(zone).on(huntingClubArea.zoneId.eq(zone.zoneId))
            .join(person).on(person.personId.eq(groupOccupation.personId))
            .join(harvest).on(person.personId.eq(harvest.authorId).or(person.personId.eq(harvest.actualShooterId)))
            .where(groupOccupation.organisationId.eq(huntingGroupId)
                    .and(groupOccupation.deletionTime.isNull())
                    .and(harvestDate.between(
                            groupOccupation.beginDate.coalesce(harvestDate),
                            groupOccupation.endDate.coalesce(harvestDate)))
                    .and(harvestDate.between(
                            clubOccupation.beginDate.coalesce(harvestDate),
                            clubOccupation.endDate.coalesce(harvestDate)))
                    .and(harvest.groupHuntingDayId.isNull())
                    .and(harvest.gameSpeciesId.eq(group.gameSpeciesId))
                    .and(harvest.pointOfTime.between(
                            new Timestamp(interval.getStartMillis()),
                            new Timestamp(interval.getEndMillis())
                    ))
                    .and(zone.geom.intersects(getHarvestPointGeometry(harvest))));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:59,
代码来源:HarvestRepositoryImpl.java

示例14: harvestOfClubMemberInsideClubHuntingArea

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SQLQuery<Long> harvestOfClubMemberInsideClubHuntingArea(final Long huntingClubId,
                                                                       final Interval interval,
                                                                       final int huntingYear,
                                                                       final Set<Integer> mooseLikeOfficialCodes) {
    /*
      SELECT h.harvest_id
      FROM occupation occ JOIN person p ON (occ.organisation_id = :clubId AND occ.person_id = p.person_id)
      JOIN harvest h ON ((p.person_id = h.author_id OR p.person_id = h.actual_shooter_id)
        AND h.point_of_time BETWEEN COALESCE(occ.begin_date, h.point_of_time) AND COALESCE(occ.end_date, h.point_of_time))
      LEFT JOIN harvest_report hr ON (hr.harvest_report_id = h.harvest_report_id AND hr.state = 'APPROVED')
      JOIN hunting_club_area hca ON (hca.club_id = :clubId AND hca.hunting_year = :huntingYear AND hca.is_active=TRUE)
      JOIN zone z ON (z.zone_id=hca.zone_id AND ST_Intersects(z.geom, ST_SetSRID(ST_MakePoint(h.longitude, h.latitude), 3067)))
      WHERE occ.deletion_time IS NULL
        AND h.point_of_time >= :beginTime
        AND h.point_of_time < :endTime
        AND (h.harvest_report_required = FALSE OR h.harvest_report_required = TRUE AND hr.harvest_report_id IS NOT NULL)
        AND h.game_species_id NOT IN (SELECT game_species_id FROM game_species WHERE official_code IN (:mooselike))
    */
    final SQOccupation clubOccupation = new SQOccupation("occ");
    final SQPerson person = new SQPerson("p");
    final SQHarvest harvest = new SQHarvest("h2");
    final SQHarvestReport harvestReport = new SQHarvestReport("hr");
    final SQHuntingClubArea huntingClubArea = new SQHuntingClubArea("hca");
    final SQGameSpecies gameSpecies = SQGameSpecies.gameSpecies;
    final SQZone zone = new SQZone("z");

    final BooleanExpression isAuthorOrShooter = harvest.authorId.eq(person.personId)
            .or(harvest.actualShooterId.eq(person.personId));

    final DateExpression<Date> harvestDate = SQLExpressions.date(Date.class, harvest.pointOfTime);

    final SQLQuery<Long> queryMooseLikeSpeciesIds = SQLExpressions
            .select(gameSpecies.gameSpeciesId)
            .from(gameSpecies)
            .where(gameSpecies.officialCode.in(mooseLikeOfficialCodes));

    return SQLExpressions.select(harvest.harvestId)
            .from(clubOccupation)
            .join(person).on(clubOccupation.organisationId.eq(huntingClubId)
                    .and(clubOccupation.personId.eq(person.personId)))
            .join(harvest).on(isAuthorOrShooter.and(harvestDate.between(
                    clubOccupation.beginDate.coalesce(harvestDate),
                    clubOccupation.endDate.coalesce(harvestDate))))
            .leftJoin(harvestReport).on(harvestReport.harvestReportId.eq(harvest.harvestReportId)
                    .and(harvestReport.state.eq(HarvestReport.State.APPROVED.name())))
            .join(huntingClubArea).on(huntingClubArea.clubId.eq(huntingClubId)
                    .and(huntingClubArea.huntingYear.eq(huntingYear))
                    .and(huntingClubArea.isActive.isTrue()))
            .join(zone).on(huntingClubArea.zoneId.eq(zone.zoneId)
                    .and(zone.geom.intersects(getHarvestPointGeometry(harvest))))
            .where(clubOccupation.deletionTime.isNull()
                    .and(harvest.pointOfTime.goe(new Timestamp(interval.getStartMillis())))
                    .and(harvest.pointOfTime.lt(new Timestamp(interval.getEndMillis())))
                    .and(harvest.harvestReportRequired.isFalse().or(harvestReport.harvestReportId.isNotNull()))
                    .and(harvest.gameSpeciesId.notIn(queryMooseLikeSpeciesIds)));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:57,
代码来源:HarvestRepositoryImpl.java

示例15: gameObservationForGroupMemberInsideGroupHuntingArea

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> gameObservationForGroupMemberInsideGroupHuntingArea(
        final HuntingClubGroup huntingClubGroup, final Interval interval) {
    /*
    SELECT o2.game_observation_id
    FROM occupation groupOcc
    INNER JOIN organisation g ON (g.organisation_id = groupOcc.organisation_id AND g.organisation_type = 'CLUBGROUP')
    INNER JOIN occupation clubOcc ON (clubOcc.deletion_time IS NULL AND clubOcc.person_id = groupOcc.person_id AND clubOcc.organisation_id = g.parent_organisation_id)
    INNER JOIN hunting_club_area a ON (a.hunting_club_area_id = g.hunting_area_id)
    INNER JOIN zone z ON (z.zone_id = a.zone_id)
    INNER JOIN person p ON (p.person_id = groupOcc.person_id)
    INNER JOIN game_observation o2 ON p.person_id IN (o2.author_id, o2.observer_id)
    WHERE
      groupOcc.organisation_id = :huntingGroupId
      AND groupOcc.deletion_time IS NULL
      AND o2.point_of_time BETWEEN COALESCE(groupOcc.begin_date, o2.point_of_time) AND COALESCE(groupOcc.end_date, o2.point_of_time)
      AND o2.point_of_time BETWEEN COALESCE(clubOcc.begin_date, o2.point_of_time) AND COALESCE(clubOcc.end_date, o2.point_of_time)
      AND o2.group_hunting_day_id IS NULL
      AND o2.within_moose_hunting = true
      AND o2.point_of_time >= :beginTime AND o2.point_of_time < :endTime
      AND ST_Intersects(z.geom, ST_SetSRID(ST_MakePoint(o2.longitude, o2.latitude), 3067))
    */
    final SQObservation gameObservation = new SQObservation("o2");
    final SQOrganisation group = new SQOrganisation("g");
    final SQOccupation groupOccupation = new SQOccupation("groupOcc");
    final SQOccupation clubOccupation = new SQOccupation("clubOcc");
    final SQHuntingClubArea huntingClubArea = new SQHuntingClubArea("a");
    final SQZone zone = new SQZone("z");
    final SQPerson person = new SQPerson("p");

    final DateExpression<Date> gameObservationDate =
            SQLExpressions.date(java.sql.Date.class, gameObservation.pointOfTime);

    final BooleanExpression authorOrObserver = person.personId.eq(gameObservation.authorId)
            .or(person.personId.eq(gameObservation.observerId));

    return SQLExpressions.select(gameObservation.gameObservationId)
            .from(groupOccupation)
            .join(group).on(group.organisationId.eq(groupOccupation.organisationId)
                    .and(group.organisationType.eq(OrganisationType.CLUBGROUP.name())))
            .join(clubOccupation).on(clubOccupation.deletionTime.isNull()
                    .and(clubOccupation.personId.eq(groupOccupation.personId))
                    .and(clubOccupation.organisationId.eq(group.parentOrganisationId)))
            .join(huntingClubArea).on(huntingClubArea.huntingClubAreaId.eq(group.huntingAreaId))
            .join(zone).on(huntingClubArea.zoneId.eq(zone.zoneId))
            .join(person).on(person.personId.eq(groupOccupation.personId))
            .join(gameObservation).on(authorOrObserver)
            .where(groupOccupation.organisationId.eq(huntingClubGroup.getId())
                    .and(groupOccupation.deletionTime.isNull())
                    .and(gameObservationDate.between(
                            groupOccupation.beginDate.coalesce(gameObservationDate),
                            groupOccupation.endDate.coalesce(gameObservationDate)))
                    .and(gameObservationDate.between(
                            clubOccupation.beginDate.coalesce(gameObservationDate),
                            clubOccupation.endDate.coalesce(gameObservationDate)))
                    .and(gameObservation.groupHuntingDayId.isNull())
                    .and(gameObservation.withinMooseHunting.isTrue())
                    .and(gameObservation.pointOfTime.between(
                            new Timestamp(interval.getStartMillis()),
                            new Timestamp(interval.getEndMillis())
                    ))
                    .and(zone.geom.intersects(getObservationPointGeometry(gameObservation))));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:63,
代码来源:ObservationRepositoryImpl.java

示例16: gameObservationRejected

点赞 2

import com.querydsl.sql.SQLExpressions; //导入依赖的package包/类
private static SubQueryExpression<Long> gameObservationRejected(HuntingClubGroup huntingClubGroup) {
    final SQGroupObservationRejection rejection = SQGroupObservationRejection.groupObservationRejection;
    return SQLExpressions.select(rejection.observationId)
            .from(rejection)
            .where(rejection.huntingClubGroupId.eq(huntingClubGroup.getId()));
}
 

开发者ID:suomenriistakeskus,
项目名称:oma-riista-web,
代码行数:7,
代码来源:ObservationRepositoryImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)