Mybatis bind标签的使用

GG_lyf

关注

阅读 89

2022-02-23

以一个分页接口来讲解
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)

0 0 举报