方案一, 先查询再修改
接口
int updateShop(Shop shop); |
映射
<update id="updateShop" parameterType="Shop"> UPDATE `tb_shop` SET `owner_id` = ‘owner_id‘, `area_id` = ‘area_id‘, `shop_category_id` = ‘shop_category_id‘, `shop_name` = ‘shop_name‘, `shop_desc` = ‘shop_desc‘, `shop_addr` = ‘shop_addr‘, `phone` = ‘phone‘, `shop_img` = ‘shop_img‘, `priority` = ‘priority‘, `create_time` = ‘create_time‘, `last_edit_time` = ‘last_edit_time‘, `enable_status` = ‘enable_status‘, `advice` = ‘advice‘ WHERE `shop_id` = #{id} ;</update> |
测试略
方案二,动态SQL
原文地址:https://www.cnblogs.com/litran/p/10543839.html
时间: 2024-11-11 15:00:46