0
我爲此擴展ResultMap創建了兩個附加字段rowNumber和totalRows。是的,現在我有總計行數,但它存儲在結果地圖中的每個對象。使用myBatis返回ResultMap中行的總計數
<resultMap id="BaseResultMapPagination" type="com.example.emaildto.EmailScheduleDTO" extends="BaseResultMap">
<result property="rowNumber" column="row_number"/>
<result property="totalRows" column="total_count"/>
</resultMap>
<select id="selectByExamplePagination" resultMap="BaseResultMapPagination" parameterType="com.example.emailservice.model.EmailScheduleCriteria">
WITH t as (
select row_number() OVER(<include refid="orderByPagination"/>) as row_number,
count(*) OVER() as total_count,
* from EmailSchedule t
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
)
select * from t where row_number >= #{pageInfo.startRow} AND row_number < #{pageInfo.endRow}
order by row_number ASC
</select>
我該如何解決這個問題?