本文整理了Java中org.springframework.data.jpa.repository.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:org.springframework.data.jpa.repository.Query
类名称:Query
方法名:<init>
暂无
代码示例来源:origin: ctripcorp/apollo
@Query("select message, max(id) as id from ReleaseMessage where message in :messages group by message")
List<Object[]> findLatestReleaseMessagesGroupByMessages(@Param("messages") Collection<String> messages);
}
代码示例来源:origin: ctripcorp/apollo
@Query("SELECT a from Audit a WHERE a.dataChangeCreatedBy = :owner")
List<Audit> findByOwner(@Param("owner") String owner);
代码示例来源:origin: ctripcorp/apollo
@Query("SELECT a from App a WHERE a.name LIKE %:name%")
List<App> findByName(@Param("name") String name);
代码示例来源:origin: ctripcorp/apollo
@Query("SELECT a from Audit a WHERE a.dataChangeCreatedBy = :owner AND a.entityName =:entity AND a.opName = :op")
List<Audit> findAudits(@Param("owner") String owner, @Param("entity") String entity,
@Param("op") String op);
}
代码示例来源:origin: ctripcorp/apollo
@Query(
value = "select b.Id from `InstanceConfig` a inner join `Instance` b on b.Id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
countQuery = "select count(1) from `InstanceConfig` a inner join `Instance` b on b.id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
nativeQuery = true)
Page<Object> findInstanceIdsByNamespaceAndInstanceAppId(
@Param("instanceAppId") String instanceAppId, @Param("configAppId") String configAppId,
@Param("clusterName") String clusterName, @Param("namespaceName") String namespaceName,
@Param("validDate") Date validDate, Pageable pageable);
}
代码示例来源:origin: Raysmond/SpringBlog
@Query("SELECT t.name, count(p) as tag_count from Post p " +
"INNER JOIN p.tags t " +
"WHERE p.postStatus = :status " +
"GROUP BY t.id " +
"ORDER BY tag_count DESC")
List<Object[]> countPostsByTags(@Param("status") PostStatus status);
}
代码示例来源:origin: spring-projects/spring-petclinic
/**
* Retrieve an {@link Owner} from the data store by id.
* @param id the id to search for
* @return the {@link Owner} if found
*/
@Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
@Transactional(readOnly = true)
Owner findById(@Param("id") Integer id);
代码示例来源:origin: spring-projects/spring-petclinic
/**
* Retrieve {@link Owner}s from the data store by last name, returning all owners
* whose last name <i>starts</i> with the given name.
* @param lastName Value to search for
* @return a Collection of matching {@link Owner}s (or an empty Collection if none
* found)
*/
@Query("SELECT DISTINCT owner FROM Owner owner left join fetch owner.pets WHERE owner.lastName LIKE :lastName%")
@Transactional(readOnly = true)
Collection<Owner> findByLastName(@Param("lastName") String lastName);
代码示例来源:origin: 527515025/springBoot
@Query("select s from User s where name like CONCAT('%',:name,'%')")
List<User> findByNameLike(@Param("name") String name);
}
代码示例来源:origin: Raysmond/SpringBlog
@Query("SELECT p FROM Post p INNER JOIN p.tags t WHERE t.name = :tag")
Page<Post> findByTag(@Param("tag") String tag, Pageable pageable);
代码示例来源:origin: shopizer-ecommerce/shopizer
@Query("select t from Transaction t join fetch t.order to left join fetch to.orderAttributes toa left join fetch to.orderProducts too left join fetch to.orderTotal toot left join fetch to.orderHistory tood where to is not null and t.transactionDate BETWEEN :from AND :to")
List<Transaction> findByDates(
@Param("from") @Temporal(javax.persistence.TemporalType.TIMESTAMP) Date startDate,
@Param("to") @Temporal(javax.persistence.TemporalType.TIMESTAMP) Date endDate);
}
代码示例来源:origin: Exrick/x-boot
/**
* 模糊搜索
* @param key
* @return
*/
@Query(value = "select * from t_dict d where d.title like %:key% or d.type like %:key% order by d.sort_order", nativeQuery = true)
List<Dict> findByTitleOrTypeLike(@Param("key") String key);
}
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("" +
"SELECT t FROM ResourceTag t " +
"INNER JOIN TagDefinition td ON (td.myId = t.myTagId) " +
"WHERE t.myResourceId in (:pids)")
Collection<ResourceTag> findByResourceIds(@Param("pids") Collection<Long> pids);
}
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("" +
"SELECT h FROM ResourceHistoryTable h " +
"INNER JOIN ResourceTable r ON (r.myId = h.myResourceId and r.myVersion = h.myResourceVersion) " +
"WHERE r.myId in (:pids)")
Collection<ResourceHistoryTable> findByResourceIds(@Param("pids") Collection<Long> pids);
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("" +
"SELECT v.myId FROM ResourceHistoryTable v " +
"LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) " +
"WHERE v.myResourceVersion != t.myVersion AND " +
"t.myResourceType = :restype")
Slice<Long> findIdsOfPreviousVersionsOfResources(Pageable thePage, @Param("restype") String theResourceName);
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("SELECT COUNT(*) FROM ResourceHistoryTable t WHERE t.myResourceId = :id")
int countForResourceInstance(
@Param("id") Long theId
);
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("SELECT COUNT(*) FROM ResourceHistoryTable t WHERE t.myResourceType = :type")
int countForResourceType(
@Param("type") String theType
);
代码示例来源:origin: jamesagnew/hapi-fhir
@Query("SELECT f FROM ForcedId f WHERE f.myResourcePid in (:pids)")
Collection<ForcedId> findByResourcePids(@Param("pids") Collection<Long> pids);
}
代码示例来源:origin: apache/servicecomb-pack
@Transactional
@Modifying(clearAutomatically = true)
@Query("UPDATE ParticipatedEvent t SET t.status = :status WHERE t.globalTxId = :globalTxId and t.localTxId = :localTxId")
void updateStatusByUniqueKey(@Param("globalTxId") String globalTxId,
@Param("localTxId") String localTxId,
@Param("status") String status);
}
代码示例来源:origin: apache/servicecomb-pack
@Transactional
@Modifying(clearAutomatically = true)
@Query("UPDATE org.apache.servicecomb.pack.alpha.server.cluster.master.provider.jdbc.jpa.MasterLock t "
+ "SET t.expireTime = :expireTime"
+ ",t.lockedTime = :lockedTime "
+ ",t.instanceId = :instanceId "
+ "WHERE t.serviceName = :serviceName AND (t.expireTime <= :lockedTime OR t.instanceId = :instanceId)")
int updateLock(
@Param("serviceName") String serviceName,
@Param("lockedTime") Date lockedTime,
@Param("expireTime") Date expireTime,
@Param("instanceId") String instanceId);
内容来源于网络,如有侵权,请联系作者删除!