0
点赞
收藏
分享

微信扫一扫

Mybatis bind标签的使用

GG_lyf 2022-02-23 阅读 89
java

以一个分页接口来讲解
dao层

	public page(@Param("index")int index, 		   	    @Param("size")int size, 
	@Param("size")int typeId);
	<select id="page " resultMap="要返回的类型 ">
		select * from goods 
			<where>
				<if requred="typeId > 0">
					and typeId=#{typeId}
				</if>
			</where>
			<bind name="current" value="(index - 1) * size"/>
			limit current , #{size}
	</select>

limt 的中参数要与bind中的name值相同,这个name值你可以放到你想要放的地方,value中的值是

举报

相关推荐

0 条评论