zoukankan      html  css  js  c++  java
  • MyBatis-Oracle分页

    <select id="selectListPage" resultType="User">
    SELECT id,name,password FROM(
    SELECT id,name,password,ROWNUM rn FROM t_user
    <where>
    <if test="id!=null and id!=''">AND id=#{id}
    </if>
    <if test="
    name!=null and name!=''">
    AND name like #{name}
    </if>
    <if test="password!=null and password!=''">
    AND password like #{password}
    </if>
    </where>
    <if test="columnName!=null and columnName!=''">
    ORDER BY ${columnName} ${sortType}
    </if>
    ) WHERE rn&gt;(#{page}-1)*#{pageSize} AND rn&lt;=#{page}*#{pageSize}
    </select>

    <select id="selectListPage" resultMap="rm">

    SELECT id,name,password,role FROM(
    SELECT id,name,password,role,ROWNUM rn FROM t_user
    <where>
    <if test="id!=null and id!=''">AND id=#{id}
    </if>
    <if test="
    name!=null and name!=''">
    AND name like #{name}
    </if>
    <if test="password!=null and password!=''">
    AND password like #{password}
    </if>
    </where>
    <if test="columnName!=null and columnName!=''">
    ORDER BY ${columnName} ${sortType}
    </if>
    )
    <![CDATA[
    WHERE rn>(#{page}-1)*#{pageSize} AND rn<=#{page}*#{pageSize}
    ]]>
    </select>
  • 相关阅读:
    小故事
    设计模式
    git分支
    git简单操作
    ab命令压力测试
    libcheck ARM交叉编译
    libxml2 ARM 交叉编译
    I.MX6 安装LTIB
    为ARM编译Glib
    QT 4.8 中文显示问题
  • 原文地址:https://www.cnblogs.com/java-ty/p/11809894.html
Copyright © 2011-2022 走看看