WangHan
2024-09-12 d5855a4926926698b740bc6c7ba489de47adb68b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package tech.powerjob.server.persistence.remote.repository;
 
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import tech.powerjob.server.persistence.remote.model.AppInfoDO;
 
import java.util.Collection;
import java.util.List;
import java.util.Optional;
 
/**
 * AppInfo 数据访问层
 *
 * @author tjq
 * @since 2020/4/1
 */
public interface AppInfoRepository extends JpaRepository<AppInfoDO, Long>, JpaSpecificationExecutor<AppInfoDO> {
 
    Optional<AppInfoDO> findByAppName(String appName);
 
    Page<AppInfoDO> findByAppNameLike(String condition, Pageable pageable);
 
    /**
     * 根据 currentServer 查询 appId
     * 其实只需要 id,处于性能考虑可以直接写SQL只返回ID
     */
    List<AppInfoDO> findAllByCurrentServer(String currentServer);
 
    @Query(value = "select id from AppInfoDO where currentServer = :currentServer")
    List<Long> listAppIdByCurrentServer(@Param("currentServer")String currentServer);
 
    List<AppInfoDO> findAllByNamespaceId(Long namespaceId);
 
 
    List<AppInfoDO> findAllByIdIn(Collection<Long> ids);
}