动态set mybatis与ibatis的写法
2023-09-27 14:25:37 时间
mybatis:
<set> <if test="obj.buyerId != null"> buyerId = #{obj.buyerId}, </if> <if test="obj.country != null and obj.country.length() > 0"> country = #{obj.country}, </if> <if test="obj.province != null and obj.province.length() > 0"> province = #{province}, </if> <if test="obj.city != null and obj.city.length() > 0"> city = #{obj.city}, </if> <if test="obj.district != null and obj.district.length() > 0"> district = #{obj.district}, </if> <if test="obj.detailAddress != null and obj.detailAddress.length() > 0"> detail_address = #{obj.detailAddress}, </if> <if test="obj.country != null and obj.country.length() > 0"> country = #{obj.country}, </if> <if test="obj.isDefault != null and obj.isDefault.length() > 0"> isDefault = #{obj.isDefault} </if> </set>
ibatis:
<dynamic prepend="SET"> <isNotEmpty prepend="," property="obj.name"> name = #obj.name# </isNotEmpty> <isNotEmpty prepend="," property="obj.nick"> nick = #obj.nick# </isNotEmpty> <isNotEmpty prepend="," property="obj.lastLoginDate"> last_login_date = #obj.lastLoginDate# </isNotEmpty> <isNotEmpty prepend="," property="obj.weixinUnionId"> weixin_union_id = #obj.weixinUnionId# </isNotEmpty> <isNotEmpty prepend="," property="obj.email"> email = #obj.email# </isNotEmpty> <isNotEmpty prepend="," property="obj.qq"> qq = #obj.qq# </isNotEmpty> <isNotEmpty prepend="," property="obj.weixinOpenId"> weixin_open_id = #obj.weixinOpenId# </isNotEmpty> <isNotEmpty prepend="," property="obj.weixinId"> weixin_id = #obj.weixinId# </isNotEmpty> <isNotEmpty prepend="," property="obj.sessionKey"> session_key = #obj.sessionKey# </isNotEmpty> <isNotEmpty prepend="," property="obj.mobile"> mobile = #obj.mobile# </isNotEmpty> <isNotNull prepend="," property="obj.sex"> sex = #obj.sex# </isNotNull> <isNotEmpty prepend="," property="obj.avatar"> avatar = #obj.avatar# </isNotEmpty> <isNotEmpty prepend="," property="obj.sellerId"> seller_id = #obj.sellerId# </isNotEmpty> <isNotEmpty prepend="," property="obj.shopId"> shop_id = #obj.shopId# </isNotEmpty> <isNotEmpty prepend="," property="obj.mpId"> mp_id = #obj.mpId# </isNotEmpty> <isNotEmpty prepend="," property="obj.city"> city = #obj.city# </isNotEmpty> <isNotEmpty prepend="," property="obj.province"> province = #obj.province# </isNotEmpty> <isNotEmpty prepend="," property="obj.language"> language = #obj.language# </isNotEmpty> <isNotEmpty prepend="," property="obj.country"> country = #obj.country# </isNotEmpty> <isNotEmpty prepend="," property="obj.phoneNumber"> phone_number = #obj.phoneNumber# </isNotEmpty> <isNotEmpty prepend="," property="obj.countryCode"> country_code = #obj.countryCode# </isNotEmpty> <isNotEmpty prepend="," property="obj.memberType"> member_type = #obj.memberType# </isNotEmpty> <isNotEmpty prepend="," property="obj.remark"> remark = #obj.remark# </isNotEmpty> </dynamic>
相关文章
- Spark SQL里concat_ws和collect_set的作用
- set 方法是坏味道?
- C++:哈希集合set与向量vector的互转
- C++:CMake语法指令【cmake_minimum_required、project,set】
- SharePoint Set-SPUser 命令拒绝访问
- Oracle入门第六天(中)——SET运算符(交并差集)
- 【JavaScript】Set
- CodeIgniter报错: You must use the "set" method to update an entry
- MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
- SpringBoot整合Elasticsearch报错availableProcessors is already set to [2], rejecting [2]
- 小贝_redis set/zset类型学习
- 记录mybatis添加表数据时报出的错误:Could not set property ‘id‘ of ‘class com.xxx.Manager with value ‘xx...xx‘
- 全网详细解决执行Set-ExecutionPolicy RemoteSigned报出的的错误:对注册表项“HKEY_LOCAL_MACHINESOFTWAREMicrosoft.”的访问被拒拒绝。
- Redis的复合SET命令和简易的分布式锁优化
- Python 集合(set)
- Convert Set to array in Java
- ADO 调用存储过程返回多个记录集的问题(关于存储过程内Set NoCount On的作用)
- 【ybtoj高效进阶 21253】序列修改(分类讨论)(set)(树状数组)
- halcon-disp_message文本输出和set_display_font设置字体
- 2019-3-15-uwp-ScrollViewer-content-out-of-panel-when-set-the-long-width
- set