org.springframework.data.jpa.repository.Query类的使用及代码示例

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

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

Query介绍

暂无

代码示例

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT r.id from Role r where (r.roleName = CONCAT('Master+', ?1) "
  + "OR r.roleName like CONCAT('ModifyNamespace+', ?1, '+%') "
  + "OR r.roleName like CONCAT('ReleaseNamespace+', ?1, '+%'))")
List<Long> findRoleIdsByAppId(String appId);

代码示例来源: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

@Modifying
 @Query("UPDATE ConsumerRole SET IsDeleted=1, DataChange_LastModifiedBy = ?2 WHERE RoleId in ?1")
 Integer batchDeleteByRoleIds(List<Long> roleIds, String operator);
}

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT a from Audit a WHERE a.dataChangeCreatedBy = :owner")
List<Audit> findByOwner(@Param("owner") String owner);

代码示例来源:origin: ctripcorp/apollo

@Modifying
 @Query("UPDATE App SET IsDeleted=1,DataChange_LastModifiedBy = ?2 WHERE AppId=?1")
 int deleteApp(String appId, String operator);
}

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT r.id from Role r where (r.roleName = CONCAT('ModifyNamespace+', ?1, '+', ?2) "
  + "OR r.roleName = CONCAT('ReleaseNamespace+', ?1, '+', ?2))")
List<Long> findRoleIdsByAppIdAndNamespace(String appId, String namespaceName);

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT a from App a WHERE a.name LIKE %:name%")
List<App> findByName(@Param("name") String name);

代码示例来源:origin: ctripcorp/apollo

@Modifying
 @Query("UPDATE AppNamespace SET IsDeleted=1,DataChange_LastModifiedBy = ?3 WHERE AppId=?1 and Name = ?2")
 int delete(String appId, String namespaceName, String operator);
}

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT p.id from Permission p where p.targetId = ?1 or p.targetId like CONCAT(?1, '+%')")
List<Long> findPermissionIdsByAppId(String appId);

代码示例来源: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

@Modifying
 @Query("UPDATE Favorite SET IsDeleted=1,DataChange_LastModifiedBy = ?2 WHERE AppId=?1")
 int batchDeleteByAppId(String appId, String operator);
}

代码示例来源:origin: ctripcorp/apollo

@Query("SELECT p.id from Permission p where p.targetId = CONCAT(?1, '+', ?2)")
List<Long> findPermissionIdsByAppIdAndNamespace(String appId, String namespaceName);

代码示例来源: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: ctripcorp/apollo

@Modifying
 @Query("UPDATE Role SET IsDeleted=1, DataChange_LastModifiedBy = ?2 WHERE Id in ?1")
 Integer batchDelete(List<Long> roleIds, String operator);
}

代码示例来源:origin: spring-projects/spring-data-examples

/**
 * Sample method to demonstrate support for {@link Stream} as a return type with a custom query. The query is executed
 * in a streaming fashion which means that the method returns as soon as the first results are ready.
 *
 * @return
 */
@Query("select c from Customer c")
Stream<Customer> streamAllCustomers();

代码示例来源: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: ctripcorp/apollo

@Modifying
 @Query("UPDATE Permission SET IsDeleted=1, DataChange_LastModifiedBy = ?2 WHERE Id in ?1")
 Integer batchDelete(List<Long> permissionIds, String operator);
}

代码示例来源:origin: spring-projects/spring-data-examples

/**
 * A DTO projection using a constructor expression in a manually declared query.
 *
 * @param firstname
 * @return
 */
@Query("select new example.springdata.jpa.projections.CustomerDto(c.firstname) from Customer c where c.firstname = ?1")
Collection<CustomerDto> findDtoWithConstructorExpression(String firstname);

代码示例来源: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: ctripcorp/apollo

@Modifying
 @Query("UPDATE RolePermission SET IsDeleted=1, DataChange_LastModifiedBy = ?2 WHERE PermissionId in ?1")
 Integer batchDeleteByPermissionIds(List<Long> permissionIds, String operator);
}

相关文章