mybatis collectionc传入多个参数

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC
        "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kgc.towercrane.tchr.mapper.QueryHrMapper">
    <resultMap id="emp-emp" type="EmpPage">
        <result property="currentPage" column="currentpage"/>
        <result property="rowPage" column="rowPage"/>
<!--        column传入多个参数 -->
          <collection property="datas"
                      column="{c=currentPage,r=rowPage}"
                      ofType="EmployeesVO"
                      select="findEmpByPage"/>
    </resultMap>
    <select id="findEmp" parameterType="EmpPage" resultMap="emp-emp">
<!--        <![CDATA[转义  < -->
        <![CDATA[
        select ceil(count(*)/#{rowPage}) total,#{rowPage} rowPage,#{currentPage} currentPage,
        if(#{currentPage}<ceil(count(*)/#{rowPage}),#{currentPage}+1,#{currentPage}) next,
        if(#{currentPage}=1,#{currentPage},#{currentPage}-1) previous,
        if(#{currentPage}<ceil(count(*)/#{rowPage}),1,0) hasNext,
        if(#{currentPage}=1,0,1) hasPrevious from employees
        ]]>
    </select>

    <select id="findEmpByPage" resultType="EmployeesVO">
        select * from employees limit ${(c-1)*r},#{r}
--       前面做计算不用#   用$符号可以做计算  注意双引号做计算会消失
    </select>
</mapper>

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kjshuan

点个赞就好啦!!!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值