<?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>
mybatis collectionc传入多个参数
猜你喜欢
转载自blog.csdn.net/just_learing/article/details/125999646
今日推荐
周排行