AddressBookimpl实现类更改如下:
AddressBookMapper.xml更改如下:
<update id="update" parameterType="addressBook"> update address_book <set> <if test="consignee != null"> consignee = #{consignee}, </if> <if test="sex != null"> sex = #{sex}, </if> <if test="phone != null"> phone = #{phone}, </if> <if test="provinceCode != null"> province_code = #{provinceCode}, </if> <if test="provinceName != null"> province_name = #{provinceName}, </if> <if test="cityCode != null"> city_code = #{cityCode}, </if> <if test="cityName != null"> city_name = #{cityName}, </if> <if test="districtCode != null"> district_code = #{districtCode}, </if> <if test="districtName != null"> district_name = #{districtName}, </if> <if test="detail != null"> detail = #{detail}, </if> <if test="label != null"> label = #{label}, </if> <if test="isDefault != null"> is_default = #{isDefault}, </if> </set> where id = #{id} </update>
这样即可实现实时更改地址簿信息