當前位置: 首頁>>代碼示例>>Java>>正文


Java Query類代碼示例

本文整理匯總了Java中org.springframework.data.jpa.repository.Query的典型用法代碼示例。如果您正苦於以下問題:Java Query類的具體用法?Java Query怎麽用?Java Query使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Query類屬於org.springframework.data.jpa.repository包,在下文中一共展示了Query類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LOWER

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT u FROM UserEntity u WHERE u.tenantId = :tenantId " +
        "AND u.customerId = :customerId AND u.authority = :authority " +
        "AND LOWER(u.searchText) LIKE LOWER(CONCAT(:searchText, '%'))" +
        "AND u.id > :idOffset ORDER BY u.id")
List<UserEntity> findUsersByAuthority(@Param("tenantId") String tenantId,
                                      @Param("customerId") String customerId,
                                      @Param("idOffset") String idOffset,
                                      @Param("searchText") String searchText,
                                      @Param("authority") Authority authority,
                                      Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:11,代碼來源:UserRepository.java

示例2: SUM

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query (
    value = "(SELECT SUM(points) FROM (SELECT COUNT(topic.id_user) AS points FROM topic WHERE topic.id_user = :id" +
            " UNION ALL SELECT 2 * COUNT(answer.id_user) AS points FROM answer WHERE answer.id_user = :id UNION ALL " +
            "SELECT 3 * COUNT(answer.id_user) AS points FROM answer WHERE answer.id_user = :id AND answer.useful = TRUE) t)",
    nativeQuery = true
)
Long getPoints(@Param("id") Long id);
 
開發者ID:plkpiotr,項目名稱:forum,代碼行數:8,代碼來源:UserRepository.java

示例3: IN

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT wb FROM WidgetsBundleEntity wb WHERE wb.tenantId IN (:tenantId, :nullTenantId) " +
        "AND LOWER(wb.searchText) LIKE LOWER(CONCAT(:textSearch, '%')) " +
        "AND wb.id > :idOffset ORDER BY wb.id")
List<WidgetsBundleEntity> findAllTenantWidgetsBundlesByTenantId(@Param("tenantId") String tenantId,
                                                                @Param("nullTenantId") String nullTenantId,
                                                                @Param("textSearch") String textSearch,
                                                                @Param("idOffset") String idOffset,
                                                                Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:9,代碼來源:WidgetsBundleRepository.java

示例4: EXISTS

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT DISTINCT new org.apache.servicecomb.saga.alpha.core.TxEvent("
     + "t.serviceName, t.instanceId, t.globalTxId, t.localTxId, t.parentTxId, t.type, t.compensationMethod, t.payloads"
     + ") FROM TxEvent t "
     + "WHERE t.globalTxId = ?1 AND t.type = 'TxStartedEvent'"
     + "AND EXISTS ("
     + "  SELECT t1.globalTxId"
     + "  FROM TxEvent t1 "
     + "  WHERE t1.globalTxId = ?1 "
     + "  AND t1.localTxId = t.localTxId "
     + "  AND t1.type = 'TxEndedEvent'"
     + ") AND NOT EXISTS ( "
     + "  SELECT t2.globalTxId"
     + "  FROM TxEvent t2 "
     + "  WHERE t2.globalTxId = ?1 "
     + "  AND t2.localTxId = t.localTxId "
     + "  AND t2.type = 'TxCompensatedEvent')"
)
 List<TxEvent> findStartedEventsWithMatchingEndedButNotCompensatedEvents(String globalTxId);
 
開發者ID:apache,項目名稱:incubator-servicecomb-saga,代碼行數:19,代碼來源:TxEventEnvelopeRepository.java

示例5: AND

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query(value="SELECT t FROM #{#entityName} t "
		+ "WHERE t.boTypeId = :boTypeId AND (t.title LIKE %:keywords% OR t.content LIKE %:keywords%) "
		+ "ORDER BY t.lastUpdate DESC")
Page<Article> findByBoAndKeywords(
		@Param(value="boTypeId") long boTypeId, 
		@Param(value="keywords") String keywords, 
		Pageable pageable);
 
開發者ID:bndynet,項目名稱:web-framework-for-java,代碼行數:8,代碼來源:ArticleRepository.java

示例6: findByRouterIpAndRouterMacAndModel

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
/**
 *  SELECT EXECUTOR
 * */

@Query(value = "SELECT routerItemModel FROM RouterItemModel routerItemModel WHERE routerItemModel.routerIp =:routerIp " +
                "AND routerItemModel.routerMac =:routerMac " +
                "AND routerItemModel.model =:model")
public RouterItemModel findByRouterIpAndRouterMacAndModel(@Param("routerIp") String routerIp,
                                                          @Param("routerMac")String routerMac,
                                                          @Param("model")String model);
 
開發者ID:rongwei84n,項目名稱:Auts_Assert_manager,代碼行數:11,代碼來源:RouterItemModelJpaGerepository.java

示例7: findOneWithAllDetails

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("from Movie m " +
        "left outer join fetch m.country " +
        "left outer join fetch m.movieStatus " +
        "left outer join fetch m.movieType " +
        "left outer join fetch m.movieStyleSet " +
        "where m.movieId = ?1")
Movie findOneWithAllDetails(Integer movieId);
 
開發者ID:AwesomeTickets,項目名稱:ServiceServer,代碼行數:8,代碼來源:MovieRepository.java

示例8: findWithoutSeatLayout

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("select c.cinemaHallId, c.cinema.cinemaId, c.hallName from CinemaHall c where c.cinemaHallId = ?1")
List<Object[]> findWithoutSeatLayout(Integer cinemaHallId);
 
開發者ID:AwesomeTickets,項目名稱:ServiceServer,代碼行數:3,代碼來源:CinemaHallRepository.java

示例9: LOWER

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT t FROM TenantEntity t WHERE t.region = :region " +
        "AND LOWER(t.searchText) LIKE LOWER(CONCAT(:textSearch, '%')) " +
        "AND t.id > :idOffset ORDER BY t.id")
List<TenantEntity> findByRegionNextPage(@Param("region") String region,
                                        @Param("textSearch") String textSearch,
                                        @Param("idOffset") String idOffset,
                                        Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:8,代碼來源:TenantRepository.java

示例10: updateEmployeeProfile

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Modifying
@Query(QueryProperties.updateEmployeeProfileByEmpId)
int updateEmployeeProfile(@Param("employeeFirstName") String employeeFirstName,
                          @Param("employeeLastName") String employeeLastName,
                          @Param("employeeTitle") String employeeTitle,
                          @Param("employeePhone") String employeePhone,
                          @Param("employeeId") long employeeId);
 
開發者ID:Mahidharmullapudi,項目名稱:timesheet-upload,代碼行數:8,代碼來源:EmployeeRepository.java

示例11: LOWER

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT a FROM AssetEntity a WHERE a.tenantId = :tenantId " +
        "AND a.customerId = :customerId " +
        "AND LOWER(a.searchText) LIKE LOWER(CONCAT(:textSearch, '%')) " +
        "AND a.id > :idOffset ORDER BY a.id")
List<AssetEntity> findByTenantIdAndCustomerId(@Param("tenantId") String tenantId,
                                              @Param("customerId") String customerId,
                                              @Param("textSearch") String textSearch,
                                              @Param("idOffset") String idOffset,
                                              Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:10,代碼來源:AssetRepository.java

示例12: COALESCE

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
/**
 * Updates counts of test run.
 * @param id Test run id.
 * @param totalCases Total test case count.
 * @param failedCases Total failed test cases count.
 */
@Modifying
@Transactional
@Query("UPDATE TestRun tr SET tr.exampleCount = COALESCE(tr.exampleCount, 0) + :totalCases, " +
		"tr.failureCount = COALESCE(tr.failureCount, 0) + :failedCases, " +
		"tr.duration = COALESCE(tr.duration, 0) + :duration " +
		"WHERE tr.id = :id")
void updateCounts(@Param("id")  Long id, @Param("totalCases") int totalCases, @Param("failedCases") int failedCases,
				  @Param("duration") double duration);
 
開發者ID:ATLANTBH,項目名稱:owl,代碼行數:15,代碼來源:TestRunRepository.java

示例13: IN

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT pmd FROM PluginMetaDataEntity pmd WHERE pmd.tenantId IN (:tenantId, :nullTenantId) " +
        "AND LOWER(pmd.searchText) LIKE LOWER(CONCAT(:textSearch, '%')) " +
        "AND pmd.id > :idOffset ORDER BY pmd.id")
List<PluginMetaDataEntity> findAllTenantPluginsByTenantId(@Param("tenantId") String tenantId,
                                                          @Param("nullTenantId") String nullTenantId,
                                                          @Param("textSearch") String textSearch,
                                                          @Param("idOffset") String idOffset,
                                                          Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:9,代碼來源:PluginMetaDataRepository.java

示例14: LOWER

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT pmd FROM PluginMetaDataEntity pmd WHERE pmd.tenantId = :tenantId " +
        "AND LOWER(pmd.searchText) LIKE LOWER(CONCAT(:textSearch, '%')) " +
        "AND pmd.id > :idOffset ORDER BY pmd.id")
List<PluginMetaDataEntity> findByTenantIdAndPageLink(@Param("tenantId") String tenantId,
                                                     @Param("textSearch") String textSearch,
                                                     @Param("idOffset") String idOffset,
                                                     Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:8,代碼來源:PluginMetaDataRepository.java

示例15: LOWER

import org.springframework.data.jpa.repository.Query; //導入依賴的package包/類
@Query("SELECT di FROM DashboardInfoEntity di WHERE di.tenantId = :tenantId " +
        "AND LOWER(di.searchText) LIKE LOWER(CONCAT(:searchText, '%')) " +
        "AND di.id > :idOffset ORDER BY di.id")
List<DashboardInfoEntity> findByTenantId(@Param("tenantId") String tenantId,
                                         @Param("searchText") String searchText,
                                         @Param("idOffset") String idOffset,
                                         Pageable pageable);
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:8,代碼來源:DashboardInfoRepository.java


注:本文中的org.springframework.data.jpa.repository.Query類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。