mybatis update the return value

 

mybatis sql:

 

<update id="test" parameterType="map">
        update test_0731 set name = #{params.name}, age = #{params.age} where id = ${params.id}
    </update>

 

Java program corresponding to the digital printing

 

 

(1) does update the value of certain fields

 

Table data:

 

Data submitted by: Update id record 1,

 

The returned value is 1, indicating a change is

 

(2) However, the update data before and after the update is the same.

 

Continue to send this data, the data before and after the same

 

 

Although not found to affect the value, but the value returned is 1.

 

(3) does not match any data

Data request:

 

 

 

 At this id is 2, the number returned is zero.

 

 

Therefore, the return value is the number of update match to match, and execution of the update statement.

The return value can also update the boolean type, when the return value is corresponding to a boolean false 0, if not zero return is true

 

Guess you like

Origin www.cnblogs.com/chenmz1995/p/11279901.html