批量sql语句
2016-04-08 10:43
302 查看
批量修改MySQL(orcal)
批量插入
批量查询
<!-- 修改查询状态为0--> <update id="updateCarOptions" parameterType="java.util.List"> UPDATE T_B_CAR_OPTION carOption SET carOption.STATE = 0 <where> carOption.ID in ( <foreach item="id" index="index" collection="array" separator=","> #{id} </foreach> ) </where> </update>
批量插入
<select id="insertCheckingItems" parameterType="java.util.List"> INSERT INTO T_B_CHECKING_ITEM (ID,CAR_TYPE ) <foreach collection="list" item="item" separator="union"> (SELECT #{item.id,jdbcType=VARCHAR}, #{item.carType,jdbcType=VARCHAR}from dual) </foreach> </select>
批量查询
<!-- 批量查询 --> <select id="queryServiceList" resultMap="BaseResultMap"> select * from T_B_SERVICESTATION o where 1=1 <if test="company != null and company !=''" > AND o.COMPANY LIKE '%' || #{company} || '%' </if> <if test="office != null"> AND <foreach item="item" collection="office" separator=" or "> o.OFFICE = #{item} </foreach> </if> order by ADD_TIME desc </select>
相关文章推荐
- mac安装mysql
- SQL limit offset
- Mysql 设置字段自动获取当前时间
- 防SQL注入
- sql server关于left join的记录
- mysql导入导出.sql文件备份还原数据库
- nodejs express mongodb
- Linux自己安装redis扩展
- Windows MySQL5.7安装和配置
- MySQL插入数据
- sqlite3 api sqlite3_busy_timeout 与 sqlite3_busy_handler 的使用与区别
- 查看、分析memcached使用状态
- oracle中varchar和varchar2区别
- 数据库主体在该数据库中拥有架构,无法删除解决方法(转)
- 初学memcached
- MySQL双主环境搭建
- oracle删除用户及其名下对象
- mongodb 添加用户及权限设置详解
- Oracle非重要文件恢复,redo、暂时文件、索引文件、password文件
- MySQL ・ 引擎特性 ・ InnoDB 文件系统之文件物理结构