mybatis分页 sql 语句

 /*自己新增的view*/

<resultMap id="depositItemMap" type="com.suning.auction.model.DepositListExample">
<result property="itemName" column="ITEM_NAME" jdbcType="VARCHAR"/>
<result property="custId" column="CUST_ID" jdbcType="BIGINT"/>
<result property="depStatus" column="DEP_STATUS" jdbcType="CHAR"/>
<result property="itemId" column="ITEM_ID" jdbcType="BIGINT" />
<result property="depositAmount" column="DEPOSIT_AMOUNT" />
<result property="lockTime" column="LOCK_TIME" jdbcType="TIMESTAMP"/>
<result property="unlockTime" column="UNLOCK_TIME" jdbcType="TIMESTAMP"/>
<result property="submitTime" column="SUBMIT_TIME" jdbcType="TIMESTAMP"/>
<result property="mainImgGroupId" column="MAIN_IMG_GROUP_ID" jdbcType="BIGINT"/>
</resultMap>

/*mybatis分页 sql 语句*/

<select id="selectDepositItemPage" resultMap="depositItemMap" parameterType="map" >

  select * from (
select ROW_NUMBER() OVER(ORDER BY EPAY_ID DESC) AS ROWNUM, 
    b.item_name
    ,b.MAIN_IMG_GROUP_ID
    ,d.CUST_ID,d.DEP_STATUS,d.ITEM_ID,d.DEPOSIT_AMOUNT,d.LOCK_TIME,d.UNLOCK_TIME,d.SUBMIT_TIME
FROM
    AUCT_ITEM b  ,AUCT_deposit d 
    where  
d.item_id=b.item_id
  <if test="depStatus != null" >
        and d.DEP_STATUS = #{depStatus,jdbcType=CHAR}
  </if>
  <if test="custId != null" >
        and d.CUST_ID = #{custId,jdbcType=BIGINT}
  </if>
   ) c
      where 1=1 
<![CDATA[ and ROWNUM >= #{startNum} and ROWNUM <= #{endNum} ]]>
  </select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值