mybatis collectionc は複数のパラメータを渡します

<?xml version="1.0"coding="UTF-8" ?> 
<!DOCTYPE マッパー PUBLIC 
        "-//mybatis.org//DTD マッパー 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) 前、
        if(#{currentPage}<ceil(count(*)/#{rowPage}),1,0) 次、
        if(#{currentPage}=1,0,1) hasPrevious from 従業員
        ]]> 
    </select> 

    <select id="findEmpByPage" resultType="EmployeesVO"> 
        select * from 従業員制限 ${(c-1)*r }、#{r 
} -- 計算するときに # は必要ありません。$ 記号を使用して計算できます。計算すると二重引用符が消えることに注意してください。
    </select> 
</mapper>

おすすめ

転載: blog.csdn.net/just_learing/article/details/125999646