您现在的位置是:网站首页>JavaJava
MyBatis:update动态sql的使用
左鹏03-06 12:33:57【Java】8,774人已围观
简介配置xml文件,使用set if 标签 <update id="save" parameterType="ProductCategory"> update product_category <!-- set会自动去掉最后一个, --> <set> <if test="categoryName!=null and categoryName!=''">category_name=#{c
配置xml文件,使用set if 标签
<update id="save" parameterType="ProductCategory">
update product_category
<!-- set会自动去掉最后一个, -->
<set>
<if test="categoryName!=null and categoryName!=''">category_name=#{categoryName},</if>
<if test="categoryType!=null and categoryType!=''">category_type=#{categoryType},</if>
</set>
where category_id=#{categoryId}
</update>
就可以了
相关文章
- MyBatis查询单条后显示null的问题解决方法
- java实现PHP的password_hash()、password_verif
- SpringBoot获取指定cookie的方法
- MyBatis:update动态sql的使用
- SpringBoot四种读取properties配置文件的方式yml文件通用
- MyBatis报错:Could not set parameters for m
- SpringBoot获取真实的客户端IP地址
- spring boot2.0文件上传配置报错 org.springframewo
- Spring Boot采用yml的方式配置 Log4j2 日志文件
- IDEA开启热启动的方法spring-boot-devtools的热部署使用
点击排行

本栏推荐

猜你喜欢
站点信息
- 建站时间:2018-09-18
- 网站程序:Spring Boot
- 主题模板:《今夕何夕》
- 文章统计:104条
- 微信公众号:扫描二维码,关注我们
