mybatis sql语句返回值问题

来源:互联网 发布:java大量线程wait状态 编辑:程序博客网 时间:2024/06/18 13:06
1、update
<pre name="code" class="html"><update id="alterPassword">        update user_login set password=#{2} where username=#{0} and password=#{1}    </update>

成功返回: update 执行成功的数目

失败返回:0

2、select

<select id="hasUser" resultType="int">        select count(1) from user_login where username=#{0}    </select>
返回: resultType 类型 ,可以是int,long,自定义的对象等,上面返回的是int

<select id="showFancyById" resultType="com.zc.beauty.model.Fancy">        select id, s_type, s_name, s_desc, s_brand, s_price, s_image, s_from, s_edittime        from fancy where id=#{0}    </select>

返回 com.zc.beauty.model.Fancy 对象

3、insert







0 0
原创粉丝点击