當需用到參數Map里面的數據時,直接寫傳進去的key,例Map map = new HashMap(); map.put("currPage1",10); 在mybatis的xml文件中需要引用的地方寫上currPage1,如下文
數據庫語句多層嵌套時,先執行最里層的語句,表的別名定義語句的最里層,紅色字體是多表聯查時定義的查詢最大記錄數
例:
<select id="query" parameterType="java.util.Map" resultMap="CsSmbmsBill1">
select * from (select b.*,rownum rn from
(select b.*,p.PRONAME,count(b.id)over() min from CS_SMBMS_BILL b inner join CS_SMBMS_PROVIDER p on b.Providerid=p.id where 1=1
<if test="pp.Productname!=null">and b.productname like concat(concat('%',#{pp.Productname}),'%')</if>
<if test="pp.PROVIDERID!=0">and p.id=#{pp.PROVIDERID}</if>
<if test="pp.Ispayment!=0"> and b.ispayment=#{pp.Ispayment}</if>
)b where rownum <=#{pageSize1}) b where rn > #{currPage1}
</select>