表dw.student
id | bigint | 主键 |
name | string | 姓名 |
age | bigint | 年龄 |
presto 分页 sql
<sql id="Where_Clause"><if test="ages != null and ages.size>0">and d.age in<foreach close=")" collection="ages" item="item" open="(" separator=",">${item}</foreach></if><if test="names != null and names.size>0">and d.name in<foreach close=")" collection="names" item="item" open="(" separator=",">${item}</foreach></if>
</sql>
<select id="queryStudentList" resultType="com.orm.presto.model.Student" statementType="STATEMENT">SELECT * FROM (selectid, name,age,case when age in (0,1) then 1 WHEN age = 2 then 2 else 3 end ageDuration,ROW_NUMBER() over (<if test="orderFlag == null">order by '${sortColumn}' ${sort}</if>) as rowfrom dw.student dwhere<include refid="Where_Clause"/>) awhere a.row between (${currentPage}-1)*${pageSize}+1 and ${currentPage}*${pageSize}
</select>