时间:2021-07-01 10:21:17 帮助过:26人阅读
数据库语句多层嵌套时,先执行最里层的语句,表的别名定义语句的最里层,红色字体是多表联查时定义的查询最大记录数
例:
<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>
mybatis框架中parameterType为Map的用法 和 数据库语句多层嵌套
标签:shm min product join row 多层 数据 util ide