mybatis的使用
来源:互联网 发布:电脑重装系统恢复数据 编辑:程序博客网 时间:2024/05/20 12:49
1、更新设置 (<trim suffixOverrides="," >)
<update id="updateContentProvider" parameterType="Object" >update ott_content_provider cp set <trim suffixOverrides="," ><if test="cpName != null ">cp.cp_name=#{cpName} ,</if><if test="expirationTime != null ">cp.expiration_time=#{expirationTime} ,</if>cp.status = 0</trim>where cp.id=#{id} </update>也可:
<set> <if test="name != null">name=#{name},</if> <if test="status != null">status=#{status}</if></set>
2、删除符合集合中的数据 (<foreach item="item" index="index" collection="list" open="(" separator="," close=")"> )
<delete id="delete" parameterType="list">delete from ott_epg where id in <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> #{item} </foreach> </delete>
3、插入数据后返回--"id" ( <insert id="save" parameterType="com.sdmc.bean.Epg" useGeneratedKeys="true" keyProperty="id"> )
<insert id="save" parameterType="com.sdmc.bean.Epg" useGeneratedKeys="true" keyProperty="id">insert into ott_epg (parent_id,operator_id,create_time) values(#{parent_id},#{operator_id},CURRENT_TIMESTAMP())<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <span style="white-space:pre"></span>select last_insert_id() as id <span style="white-space:pre"></span></selectKey></insert>
0 0
- 学习Mybatis:Mybatis的使用
- MyBatis插件的使用:mybatis-generator、mybatis-plugin、mybatis-pagehelper
- MyBatis框架的使用
- mybatis limit的使用
- MyBatis的使用
- Mybatis的使用
- MyBatis框架的使用
- MyBatis框架的使用
- Mybatis的参数使用
- MyBatis的基本使用
- mybatis collection的使用
- mybatis association的使用
- MyBatis In的使用
- myBatis Like 的使用
- Mybatis-generator的使用
- mybatis 的简单使用
- mybatis简单的使用
- Mybatis ResultMap的使用
- Android中View(视图)绘制不同状态背景图片原理深入分析以及StateListDrawable使用详解
- java9.接口的应用
- Java序列化与反序列化
- 2015 总结
- iOS开发~CocoaPods使用详细说明
- mybatis的使用
- 自守数
- LinkedList
- iOS 四种保存数据的方式 (github上面的)
- Java基于socket编程
- 问题积累
- Linux下安装Tomcat(tar.gz)
- Android性能优化典范(二)
- IOS 学习(基于 iOS 8.0 以上的地理信息查询)