---
# System prepended metadata

title: Annotation Type Query
tags: [Note]

---

---

robots: index, follow
lang: zh-tw
dir: ltr
breaks: true
title: Annotation Type Query     # 簡報的名稱
tags: Note  # 簡報的標籤

---

# Annotation Type Query

### countQuery
 Defines a special count query that shall be used for pagination queries to lookup the total number of elements for a page. If none is configured we will derive the count query from the original query or countProjection() query if any.
 
### countProjection
 Defines the projection part of the count query that is generated for pagination. If neither countQuery() nor countProjection() is configured we will derive the count query from the original query.
 
### nativeQuery
 Configures whether the given query is a native one. Defaults to false.
``` gherkin=
 @Query(value = "XXX",countQuery = "SELECT count(d.id) "
                                + " FROM DISINFECT d " 
                                + " WHERE (d.id = COALESCE(:disinfectId, d.id)) " 
                                + " AND (d.executor = COALESCE(:executorId, d.executor)) " 
                                + " AND (d.execution_time >= COALESCE(:startTime, d.execution_time) AND d.execution_time <= COALESCE(:endTime, d.execution_time)) ", nativeQuery = true)
        public Page<Map<String, Object>> getDisinfectList(@Param("disinfectId") Long disinfectId, @Param("executorId") Long executorId, @Param("startTime") Date startTime, @Param("endTime") Date endTime, Pageable pageable);
```