mapper配置文件中配置sql:
<insert id="saveOrUpdateObject" parameterType="TestCardInf">
<selectKey keyProperty="count" resultType="int" order="BEFORE">
select count(1) as count from t_test_card where AGREE_NO = #{agreeNo} with ur
</selectKey>
<if test="count>0">
<include refid="updateByPrimaryKeySelective" />
</if>
<if test="count==0">
<include refid="insertSelective" />
</if>
</insert>
TestCardInf类中增加属性:
private Integer count;