mybatis sql語句返回值問題

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







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章