org.springframework.data.jpa.repository.Query Java Examples
The following examples show how to use
org.springframework.data.jpa.repository.Query.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WatchListRepository.java From torrssen2 with MIT License | 11 votes |
@Query(value = "SELECT w.* FROM WATCH_LIST w " + "WHERE w.use = true " + "AND ((w.use_regex = false AND " + " REPLACE(UPPER(?1), ' ', '') LIKE " + " REPLACE(UPPER(CONCAT('%', w.title, '%', IFNULL(w.release_group, ''), '%')), ' ', '')) OR " + " (w.use_regex = true AND REGEXP_LIKE(?1, w.title, 'i')) AND REPLACE(UPPER(?1), ' ', '') LIKE " + " REPLACE(UPPER(CONCAT('%', IFNULL(w.release_group, ''), '%')), ' ', '')) " + " LIMIT 1" // + "AND ((IFNULL(w.quality, '100P+') LIKE '%+' AND " // + " CAST(REPLACE(UPPER(IFNULL(?2, '100')), 'P', '') AS INTEGER) " // + " >= CAST(REPLACE(UPPER(IFNULL(w.quality, '100P+')), 'P+', '' ) AS // INTEGER)) OR " // + " (UPPER(w.quality) LIKE '%P' AND " // + " UPPER(IFNULL(?2, '')) = UPPER(w.quality))) " , nativeQuery = true) public Optional<WatchList> findByTitleRegex(String title, String quality);
Example #2
Source File: AdmCiTypeAttrRepository.java From we-cmdb with Apache License 2.0 | 4 votes |
@Query(value = "SELECT * FROM adm_ci_type_attr WHERE id_adm_ci_type = :ciTypeId and edit_is_null = 0", nativeQuery = true) List<AdmCiTypeAttr> findNotNullableAttrs(@Param("ciTypeId") int ciTypeId);
Example #3
Source File: PermissionRepository.java From WeEvent with Apache License 2.0 | 4 votes |
@Query(value = " select distinct user_id from t_broker where id =:brokerId and delete_at = 0 union select distinct user_id as userId " + "from t_permission where broker_id =:brokerId", nativeQuery = true) List<Integer> findUserIdByBrokerId(@Param("brokerId") Integer brokerId);
Example #4
Source File: ExchangeOrderRepository.java From ZTuoExchange_framework with MIT License | 4 votes |
@Query(value="select base_symbol unit,FROM_UNIXTIME(completed_time/1000, '%Y-%m-%d'),sum(turnover) amount from exchange_order where FROM_UNIXTIME(completed_time/1000, '%Y-%m-%d') = :date and direction = 1 and status = 1 group by unit",nativeQuery = true) List<Object[]> getExchangeTurnoverBase(@Param("date") String date);
Example #5
Source File: MenuRepository.java From flash-waimai with MIT License | 4 votes |
@Query(nativeQuery = true,value = "select url from t_sys_relation rel inner join t_sys_menu m on rel.menuid = m.id where m.status=1 and rel.roleid = ?1") List<String> getResUrlsByRoleId(Long roleId);
Example #6
Source File: AdmCiTypeRepository.java From we-cmdb with Apache License 2.0 | 4 votes |
@Query(value = SQL_SELECT + "LEFT JOIN adm_ci_type t ON c.id_adm_basekey = t.catalog_id " + SQL_WHERE, nativeQuery = true) List<BasekeyInfo> findCatalogCiTypes(@Param("catId") int catId);
Example #7
Source File: AdmCiTypeRepository.java From we-cmdb with Apache License 2.0 | 4 votes |
@Query(value = SQL_SELECT + "LEFT JOIN adm_ci_type t ON c.id_adm_basekey = t.layer_id and t.id_adm_tenement = :idAdmTenement " + SQL_WHERE, nativeQuery = true) List<BasekeyInfo> findLayerCiTypes(@Param("idAdmTenement") int idAdmTenement, @Param("catId") int catId);
Example #8
Source File: MemberDao.java From ZTuoExchange_framework with MIT License | 4 votes |
@Query(value ="select count(id) from member where date_format(certified_business_check_time,'%Y-%m-%d') = :date",nativeQuery = true) int getBussinessNum(@Param("date")String date);
Example #9
Source File: TaskNodeExecParamRepository.java From wecube-platform with Apache License 2.0 | 4 votes |
@Query("select t from TaskNodeExecParamEntity t " + " where t.requestId = :requestId and t.paramType = :paramType ") List<TaskNodeExecParamEntity> findAllByRequestIdAndParamType(@Param("requestId") String requestId, @Param("paramType") String paramType);
Example #10
Source File: ConfigCenterEntityRepository.java From txle with Apache License 2.0 | 4 votes |
@Query("SELECT T FROM ConfigCenter T WHERE T.instanceid IS NULL AND T.status = ?1 AND T.type = ?2") ConfigCenter selectGlobalConfigCenterByType(int status, int type);
Example #11
Source File: InitPlateDao.java From ZTuoExchange_framework with MIT License | 4 votes |
@Query(value = "select * from init_plate where symbol=:symbol" ,nativeQuery = true) InitPlate findInitPlateBySymbol(@Param("symbol") String symbol);
Example #12
Source File: DirectoryRepo.java From staffjoy with MIT License | 4 votes |
@Modifying(clearAutomatically = true) @Query("update Directory directory set directory.internalId = :internalId where directory.companyId = :companyId and directory.userId = :userId") @Transactional int updateInternalIdByCompanyIdAndUserId(@Param("internalId") String internalId, @Param("companyId") String companyId, @Param("userId") String userId);
Example #13
Source File: UserRepository.java From Mastering-Spring-5.1 with MIT License | 4 votes |
@Query("select u from User u where u.name = ?1") List<User> findUsersByNameUsingQuery(String name);
Example #14
Source File: OnlineUserRepository.java From youkefu with Apache License 2.0 | 4 votes |
@Query("select count(id) from AgentService where orgi = ?1 and appid = ?2 and createtime > ?3 and createtime < ?4") Long countByOrgiAndAppidForCount(String orgi ,String appid ,Date start,Date end);
Example #15
Source File: ClusterJpaRepository.java From chronus with Apache License 2.0 | 4 votes |
@Modifying @Query(value = "delete from ClusterH2Entity u where u.cluster = ?1") void deleteByCluster(String cluster);
Example #16
Source File: BlockTaskPoolRepository.java From WeBASE-Collect-Bee with Apache License 2.0 | 4 votes |
@Query(value = "select * from #{#entityName} where block_height% ?1 = ?2 and sync_status = ?3 limit ?4", nativeQuery = true) public List<BlockTaskPool> findBySyncStatusModByBlockHeightLimit(int shardingCount, int shardingItem, short syncStatus, int limit);
Example #17
Source File: SysRoleDao.java From ZTuoExchange_framework with MIT License | 4 votes |
@Modifying @Query("update SysRole s set s.description=?1,s.role=?2 where s.id=?3") int updateSysRole(String description,String role,Long id);
Example #18
Source File: ConnectionRepository.java From flair-engine with Apache License 2.0 | 4 votes |
@Override @Query("select c from Connection c where c.status is null or c.status <> com.fbi.engine.domain.ConnectionStatus.DELETED") Page<Connection> findAll(Pageable pageable);
Example #19
Source File: RoleAuthorityRsRepository.java From wecube-platform with Apache License 2.0 | 4 votes |
@Query("select t from RoleAuthorityRsEntity t " + " where t.roleId = :roleId and t.authorityId = :authorityId and t.deleted = false") RoleAuthorityRsEntity findOneByRoleIdAndAuthorityId(@Param("roleId") String roleId, @Param("authorityId") String authorityId);
Example #20
Source File: ConfigCenterEntityRepository.java From txle with Apache License 2.0 | 4 votes |
@Query("SELECT count(T) FROM ConfigCenter T") long findConfigCount();
Example #21
Source File: UserRepository.java From txle with Apache License 2.0 | 4 votes |
@Transactional @Modifying(clearAutomatically = true) @Query("UPDATE UserEntity T SET T.balance = T.balance - :balance WHERE id = :userId AND T.balance >= :balance") int updateBalanceByUserId(@Param("userId") long userId, @Param("balance") double balance);
Example #22
Source File: MonitorRepository.java From WeBASE-Front with Apache License 2.0 | 4 votes |
@Modifying @Transactional @Query(value = "delete from Monitor m where m.timestamp< ?1", nativeQuery = true) public int deleteTimeAgo(Long time);
Example #23
Source File: SysHelpDao.java From ZTuoExchange_framework with MIT License | 4 votes |
@Query("select max(s.sort) from SysHelp s") int findMaxSort();
Example #24
Source File: RecordRepo.java From auto-subtitle-tool with GNU General Public License v2.0 | 4 votes |
@Query(value = "SELECT count(r.id) FROM Record r WHERE r.userId = ?1 and r.uploadTm LIKE CONCAT('%',?2,'%')") Integer countTodayUploadTimes(Long userId, String today);
Example #25
Source File: NoteRepository.java From code-examples with MIT License | 4 votes |
@Query("SELECT n FROM Note n WHERE n.title IS NOT NULL") List<Note> findByTitleIsNotNull();
Example #26
Source File: DataDictionaryEntityRepository.java From txle with Apache License 2.0 | 4 votes |
@Query("SELECT coalesce(max(t.showorder), 0) FROM DataDictionaryItem t WHERE T.ddcode = ?1") int selectMaxShowOrder(String key);
Example #27
Source File: ClusterJpaRepository.java From chronus with Apache License 2.0 | 4 votes |
@Modifying @Query(value = "update ClusterH2Entity e set e.clusterDesc=:newDesc where e.id =:id") void updateEnvDesc(@Param("id") Long id, @Param("newDesc") String desc);
Example #28
Source File: PluginConfigRepository.java From wecube-platform with Apache License 2.0 | 4 votes |
@Query("select cfg from PluginConfig cfg where cfg.status ='ENABLED' group by cfg.targetPackage,cfg.targetEntity,cfg.targetEntityFilterRule") List<PluginConfig> findAllPluginConfigGroupByTargetEntityWithFilterRule();
Example #29
Source File: NoteRepository.java From code-examples with MIT License | 4 votes |
@Query("SELECT n FROM Note n WHERE n.created > ?1") List<Note> findByCreatedAfter(Date before);
Example #30
Source File: MenuRepository.java From flash-waimai with MIT License | 4 votes |
@Query(nativeQuery = true,value="SELECT m1.id AS id, m1.icon AS icon, ( CASE WHEN (m2.id = 0 OR m2.id IS NULL) " + "THEN 0 ELSE m2.id END ) AS parentId, m1. NAME AS NAME, m1.url AS url, m1.levels AS levels, m1.ismenu AS " + "ismenu, m1.num AS num, m1. CODE AS CODE,m1.status as status FROM t_sys_menu m1 LEFT JOIN t_sys_menu m2 " + "ON " + "m1.pcode = m2. CODE ORDER BY levels, num ASC") List getMenus();